Chromium Code Reviews| Index: pylib/gyp/generator/analyzer.py |
| diff --git a/pylib/gyp/generator/analyzer.py b/pylib/gyp/generator/analyzer.py |
| index 15b80ef973793c5c8a02f50eb9bbabe5d2e602fb..a77ca69373383602e1f16b7b160544d8aaeaefb0 100644 |
| --- a/pylib/gyp/generator/analyzer.py |
| +++ b/pylib/gyp/generator/analyzer.py |
| @@ -183,7 +183,10 @@ class Target(object): |
| added_to_compile_targets: used when determining if the target was added to the |
| set of targets that needs to be built. |
| in_roots: true if this target is a descendant of one of the root nodes. |
| - is_executable: true if the type of target is executable.""" |
| + is_executable: true if the type of target is executable. |
| + is_static_library: true if the type of target is static_library. |
| + is_or_has_executable_ancestor: true if the target is executable, or if there |
| + is a target in back_deps that is executable.""" |
| def __init__(self, name): |
| self.deps = set() |
| self.match_status = MATCH_STATUS_TBD |
| @@ -196,6 +199,8 @@ class Target(object): |
| self.added_to_compile_targets = False |
| self.in_roots = False |
| self.is_executable = False |
| + self.is_static_library = False |
| + self.is_or_has_executable_ancestor = False |
| class Config(object): |
| @@ -309,7 +314,9 @@ def _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files, |
| target.visited = True |
| target.requires_build = _DoesTargetTypeRequireBuild( |
| target_dicts[target_name]) |
| - target.is_executable = target_dicts[target_name]['type'] == 'executable' |
| + target_type = target_dicts[target_name]['type'] |
| + target.is_executable = target_type == 'executable' |
| + target.is_static_library = target_type == 'static_library' |
| build_file = gyp.common.ParseQualifiedTarget(target_name)[0] |
| if not build_file in build_file_in_files: |
| @@ -406,19 +413,27 @@ def _AddBuildTargets(target, roots, add_if_no_ancestor, result): |
| target.visited = True |
| target.in_roots = not target.back_deps and target in roots |
| + target.is_or_has_executable_ancestor = target.is_executable |
| for back_dep_target in target.back_deps: |
| _AddBuildTargets(back_dep_target, roots, False, result) |
| target.added_to_compile_targets |= back_dep_target.added_to_compile_targets |
| target.in_roots |= back_dep_target.in_roots |
| + target.is_or_has_executable_ancestor |= ( |
| + back_dep_target.is_or_has_executable_ancestor) |
| # Always add 'executable' targets. Even though they may be built by other |
| # targets that depend upon them it makes detection of what is going to be |
| # built easier. |
| + # And always add static_libraries that have no dependencies on them from |
| + # executables. This is necessary as the other dependencies on them may be |
| + # static libraries themselves, which are not compile time dependencies. |
| if target.in_roots and \ |
| (target.is_executable or |
| (not target.added_to_compile_targets and |
| - (add_if_no_ancestor or target.requires_build))): |
| + (add_if_no_ancestor or target.requires_build)) or |
| + (target.is_static_library and add_if_no_ancestor and |
| + not target.is_or_has_executable_ancestor)): |
|
Nico
2015/06/08 17:37:56
you care about "is_or_has_linked_ancestor", right?
sky
2015/06/08 17:46:26
Done.
|
| result.add(target) |
| target.added_to_compile_targets = True |