diff options
author | sky@chromium.org <sky@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af> | 2014-08-22 22:11:19 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af> | 2014-08-22 22:11:19 +0000 |
commit | fa401a9913d33cfa9a2d1a57511e32076a3cccbb (patch) | |
tree | 1ed84b8a197a655c6e866d1b0fc696141035c7d8 | |
parent | 07465a390fff60fd45e23718212f23895249745c (diff) | |
download | gyp-fa401a9913d33cfa9a2d1a57511e32076a3cccbb.tar.gz |
Makes analyzer output names of all executable target types
This makes it easier to detect if something is going to be built
without knowing all the names of dependent targets. For example, in
chrome it's typical to have a _run target, eg
browser_tests_run. Without this the chrome side would have to look for
all the _foo targets.
BUG=109173
TEST=none
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/496363004
git-svn-id: http://gyp.googlecode.com/svn/trunk@1969 78cadc50-ecff-11dd-a971-7dbc132099af
-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', ], |