diff options
author | Android Chromium Automerger <chromium-automerger@android> | 2014-09-09 17:46:04 +0000 |
---|---|---|
committer | Android Chromium Automerger <chromium-automerger@android> | 2014-09-09 17:46:04 +0000 |
commit | a9a7545ffc56a4786482816ffaacecd481453e3f (patch) | |
tree | 873bacff722773aa3b11a6e0f6ce2516d148b6f6 | |
parent | 7e215e20b5b62619e71cf27e17f72f64f4de713d (diff) | |
parent | 94b57d39a88ceb03e228804eec4b9013c5ea8b4c (diff) | |
download | gyp-a9a7545ffc56a4786482816ffaacecd481453e3f.tar.gz |
Merge tools/gyp from https://chromium.googlesource.com/external/gyp.git at 94b57d39a88ceb03e228804eec4b9013c5ea8b4c
This commit was generated by merge_from_chromium.py.
Change-Id: Ib4056146058977e349f4127c6f7757e07054d759
4 files changed, 72 insertions, 5 deletions
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py index f5e1be96..4484f93a 100644 --- a/pylib/gyp/generator/ninja.py +++ b/pylib/gyp/generator/ninja.py @@ -2152,7 +2152,12 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, # short name of targets that were skipped because they didn't contain anything # interesting. - empty_target_names = [] + # NOTE: there may be overlap between this an non_empty_target_names. + empty_target_names = set() + + # Set of non-empty short target names. + # NOTE: there may be overlap between this an empty_target_names. + non_empty_target_names = set() for qualified_target in target_list: # qualified_target is like: third_party/icu/icu.gyp:icui18n#target @@ -2197,8 +2202,9 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, target_outputs[qualified_target] = target if qualified_target in all_targets: all_outputs.add(target.FinalOutput()) + non_empty_target_names.add(name) else: - empty_target_names.append(name) + empty_target_names.add(name) if target_short_names: # Write a short name to build this target. This benefits both the @@ -2210,10 +2216,11 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in target_short_names[short_name]]) + # Write phony targets for any empty targets that weren't written yet. As + # short names are not necessarily unique only do this for short names that + # haven't already been output for another target. + empty_target_names = empty_target_names - non_empty_target_names if empty_target_names: - # Write out any targets that were skipped because they didn't contain - # anything interesting. This way the targets can still be built without - # causing build errors. master_ninja.newline() master_ninja.comment('Empty targets (output for completeness).') for name in sorted(empty_target_names): diff --git a/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py b/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py new file mode 100644 index 00000000..1279ead3 --- /dev/null +++ b/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies a phony target isn't output if a target exists with the same name that +was output. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['ninja']) + +test.run_gyp('test.gyp') + +# Check for both \r and \n to cover both windows and linux. +test.must_not_contain('out/Default/build.ninja', 'build empty_target: phony\r') +test.must_not_contain('out/Default/build.ninja', 'build empty_target: phony\n') + +test.pass_test() diff --git a/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp b/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp new file mode 100644 index 00000000..1b9fc42f --- /dev/null +++ b/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'empty_target', + 'type': 'executable', + 'sources': [ + 'test.cc', + ], + }, + { + 'target_name': 'included_empty_target', + 'type': 'none', + }, + ], +} diff --git a/test/ninja/empty-and-non-empty-duplicate-name/test.gyp b/test/ninja/empty-and-non-empty-duplicate-name/test.gyp new file mode 100644 index 00000000..9aa6287c --- /dev/null +++ b/test/ninja/empty-and-non-empty-duplicate-name/test.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'All', + 'type': 'none', + 'dependencies': [ + 'subdir/included.gyp:included_empty_target' + ] + }, + { + 'target_name': 'empty_target', + 'type': 'none', + }, + ], +} |