diff options
author | Android Chromium Automerger <chromium-automerger@android> | 2014-09-05 03:49:22 +0000 |
---|---|---|
committer | Android Chromium Automerger <chromium-automerger@android> | 2014-09-05 03:49:22 +0000 |
commit | 7e215e20b5b62619e71cf27e17f72f64f4de713d (patch) | |
tree | c29cc25e500a58669da104a3111058fea495bf44 | |
parent | 3b2438dd9cac1267282c0c2d7436f920e8be3ebd (diff) | |
parent | 1ff523f4eccd38fb9f73e60dddd895736ce90346 (diff) | |
download | gyp-7e215e20b5b62619e71cf27e17f72f64f4de713d.tar.gz |
Merge tools/gyp from https://chromium.googlesource.com/external/gyp.git at 1ff523f4eccd38fb9f73e60dddd895736ce90346
This commit was generated by merge_from_chromium.py.
Change-Id: I09db4caa53f4e9192c3638f21faf7d5aedef59ab
-rw-r--r-- | pylib/gyp/generator/ninja.py | 15 | ||||
-rw-r--r-- | test/empty-target/empty-target.gyp | 12 | ||||
-rw-r--r-- | test/empty-target/gyptest-empty-target.py | 18 |
3 files changed, 45 insertions, 0 deletions
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py index 3336a896..f5e1be96 100644 --- a/pylib/gyp/generator/ninja.py +++ b/pylib/gyp/generator/ninja.py @@ -2150,6 +2150,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, # objects. target_short_names = {} + # short name of targets that were skipped because they didn't contain anything + # interesting. + empty_target_names = [] + for qualified_target in target_list: # qualified_target is like: third_party/icu/icu.gyp:icui18n#target build_file, name, toolset = \ @@ -2193,6 +2197,8 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, target_outputs[qualified_target] = target if qualified_target in all_targets: all_outputs.add(target.FinalOutput()) + else: + empty_target_names.append(name) if target_short_names: # Write a short name to build this target. This benefits both the @@ -2204,6 +2210,15 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in target_short_names[short_name]]) + 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): + master_ninja.build(name, 'phony') + if all_outputs: master_ninja.newline() master_ninja.build('all', 'phony', list(all_outputs)) diff --git a/test/empty-target/empty-target.gyp b/test/empty-target/empty-target.gyp new file mode 100644 index 00000000..feefa280 --- /dev/null +++ b/test/empty-target/empty-target.gyp @@ -0,0 +1,12 @@ +# 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': 'none', + }, + ], +} diff --git a/test/empty-target/gyptest-empty-target.py b/test/empty-target/gyptest-empty-target.py new file mode 100644 index 00000000..ecadd4a8 --- /dev/null +++ b/test/empty-target/gyptest-empty-target.py @@ -0,0 +1,18 @@ +#!/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 building a target with nothing succeeds. +""" + +import os +import sys +import TestGyp + +test = TestGyp.TestGyp() +test.run_gyp('empty-target.gyp') +test.build('empty-target.gyp', target='empty_target') +test.pass_test() |