diff options
-rw-r--r-- | pylib/gyp/generator/analyzer.py | 14 | ||||
-rw-r--r-- | test/analyzer/gyptest-analyzer.py | 6 | ||||
-rw-r--r-- | test/analyzer/test3.gyp | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/pylib/gyp/generator/analyzer.py b/pylib/gyp/generator/analyzer.py index ba53e493..37a9e805 100644 --- a/pylib/gyp/generator/analyzer.py +++ b/pylib/gyp/generator/analyzer.py @@ -178,7 +178,8 @@ class Target(object): See _DoesTargetTypeRequireBuild for details. 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.""" + 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.""" def __init__(self, name): self.deps = set() self.match_status = MATCH_STATUS_TBD @@ -190,6 +191,7 @@ class Target(object): self.requires_build = False self.added_to_compile_targets = False self.in_roots = False + self.is_executable = False class Config(object): @@ -302,6 +304,7 @@ 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' build_file = gyp.common.ParseQualifiedTarget(target_name)[0] if not build_file in build_file_in_files: @@ -404,8 +407,13 @@ def _AddBuildTargets(target, roots, add_if_no_ancestor, result): target.added_to_compile_targets |= back_dep_target.added_to_compile_targets target.in_roots |= back_dep_target.in_roots - if not target.added_to_compile_targets and target.in_roots and \ - (add_if_no_ancestor or target.requires_build): + # 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. + if target.in_roots and \ + (target.is_executable or + (not target.added_to_compile_targets and + (add_if_no_ancestor or target.requires_build))): result.add(target) target.added_to_compile_targets = True diff --git a/test/analyzer/gyptest-analyzer.py b/test/analyzer/gyptest-analyzer.py index 89d62522..378996a2 100644 --- a/test/analyzer/gyptest-analyzer.py +++ b/test/analyzer/gyptest-analyzer.py @@ -305,7 +305,7 @@ EnsureContains(matched=True, build_targets={'a', 'b'}) _CreateConfigFile(['c.c', 'e.c'], []) run_analyzer3() -EnsureContains(matched=True, build_targets={'a', 'b'}) +EnsureContains(matched=True, build_targets={'a', 'b', 'c', 'e'}) _CreateConfigFile(['d.c'], ['a']) run_analyzer3() @@ -342,11 +342,11 @@ EnsureContains(matched=True, build_targets={'a', 'b'}) # Assertions around test4.gyp. _CreateConfigFile(['f.c'], []) run_analyzer4() -EnsureContains(matched=True, build_targets={'e'}) +EnsureContains(matched=True, build_targets={'e', 'f'}) _CreateConfigFile(['d.c'], []) run_analyzer4() -EnsureContains(matched=True, build_targets={'a'}) +EnsureContains(matched=True, build_targets={'a', 'b', 'c', 'd'}) _CreateConfigFile(['i.c'], []) run_analyzer4() diff --git a/test/analyzer/test3.gyp b/test/analyzer/test3.gyp index a1fdfdde..40c7534c 100644 --- a/test/analyzer/test3.gyp +++ b/test/analyzer/test3.gyp @@ -61,7 +61,7 @@ }, { 'target_name': 'f', - 'type': 'executable', + 'type': 'static_library', 'sources': [ 'f.c', ], |