diff options
author | sbaig1@bloomberg.net <sbaig1@bloomberg.net@78cadc50-ecff-11dd-a971-7dbc132099af> | 2014-05-29 19:15:27 +0000 |
---|---|---|
committer | sbaig1@bloomberg.net <sbaig1@bloomberg.net@78cadc50-ecff-11dd-a971-7dbc132099af> | 2014-05-29 19:15:27 +0000 |
commit | fb36c3fe0124493d0f54c7ac1e03870a6da0c715 (patch) | |
tree | 73559b8ac8b3eec3f7f5e19413f75666851c00bc | |
parent | 482fd5de5c82799a58f233042a6a93930c2bc778 (diff) | |
download | gyp-fb36c3fe0124493d0f54c7ac1e03870a6da0c715.tar.gz |
msvs: Revert r1920 and add a test for excluded idl
The test uses a "bad" idl to verify that it gets excluded from the msvs build.
If it doesn't get excluded, then the build will fail because the bad.idl is
syntactically wrong.
BUG=
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/307953002
git-svn-id: http://gyp.googlecode.com/svn/trunk@1925 78cadc50-ecff-11dd-a971-7dbc132099af
-rw-r--r-- | pylib/gyp/generator/msvs.py | 4 | ||||
-rw-r--r-- | test/win/gyptest-midl-excluded.py | 22 | ||||
-rw-r--r-- | test/win/idl-excluded/bad.idl | 6 | ||||
-rw-r--r-- | test/win/idl-excluded/copy-file.py | 11 | ||||
-rw-r--r-- | test/win/idl-excluded/idl-excluded.gyp | 58 | ||||
-rw-r--r-- | test/win/idl-excluded/program.cc | 7 |
6 files changed, 106 insertions, 2 deletions
diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py index e786c0b8..843f97fc 100644 --- a/pylib/gyp/generator/msvs.py +++ b/pylib/gyp/generator/msvs.py @@ -833,7 +833,7 @@ def _AdjustSourcesForRules(spec, rules, sources, excluded_sources): outputs = OrderedSet(_FixPaths(outputs)) inputs.remove(_FixPath(trigger_file)) sources.update(inputs) - if spec['type'] != 'none' and not spec.get('msvs_external_builder'): + if not spec.get('msvs_external_builder'): excluded_sources.update(inputs) sources.update(outputs) @@ -1392,7 +1392,7 @@ def _PrepareListOfSources(spec, generator_flags, gyp_file): # Add all inputs to sources and excluded sources. inputs = OrderedSet(inputs) sources.update(inputs) - if spec['type'] != 'none' and not spec.get('msvs_external_builder'): + if not spec.get('msvs_external_builder'): excluded_sources.update(inputs) if int(a.get('process_outputs_as_sources', False)): _AddNormalizedSources(sources, a.get('outputs', [])) diff --git a/test/win/gyptest-midl-excluded.py b/test/win/gyptest-midl-excluded.py new file mode 100644 index 00000000..70059ab6 --- /dev/null +++ b/test/win/gyptest-midl-excluded.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. + +""" +Test that .idl files in actions and non-native rules are excluded. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'idl-excluded' + test.run_gyp('idl-excluded.gyp', chdir=CHDIR) + test.build('idl-excluded.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/test/win/idl-excluded/bad.idl b/test/win/idl-excluded/bad.idl new file mode 100644 index 00000000..38554e96 --- /dev/null +++ b/test/win/idl-excluded/bad.idl @@ -0,0 +1,6 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +This is a dummy .idl file that will trigger an error if it is not excluded from +the build. diff --git a/test/win/idl-excluded/copy-file.py b/test/win/idl-excluded/copy-file.py new file mode 100644 index 00000000..5a5feae1 --- /dev/null +++ b/test/win/idl-excluded/copy-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 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. +import sys + +contents = open(sys.argv[1], 'r').read() +open(sys.argv[2], 'wb').write(contents) + +sys.exit(0) diff --git a/test/win/idl-excluded/idl-excluded.gyp b/test/win/idl-excluded/idl-excluded.gyp new file mode 100644 index 00000000..972b7ded --- /dev/null +++ b/test/win/idl-excluded/idl-excluded.gyp @@ -0,0 +1,58 @@ +# Copyright (c) 2014 The Chromium Authors. 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': 'exclude_with_action', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'actions': [{ + 'action_name': 'copy_action', + 'inputs': [ + 'copy-file.py', + 'bad.idl', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/bad.idl', + ], + 'action': [ + 'python', '<@(_inputs)', '<@(_outputs)', + ], + }], + }, + { + 'target_name': 'exclude_with_rule', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'bad.idl', + ], + 'rules': [{ + 'rule_name': 'copy_rule', + 'extension': 'idl', + 'inputs': [ + 'copy-file.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).idl', + ], + 'action': [ + 'python', '<@(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + }], + }, + { + 'target_name': 'program', + 'type': 'executable', + 'sources': [ + 'program.cc', + ], + 'dependencies': [ + 'exclude_with_action', + 'exclude_with_rule', + ], + }, + ], +} diff --git a/test/win/idl-excluded/program.cc b/test/win/idl-excluded/program.cc new file mode 100644 index 00000000..9dc3c94f --- /dev/null +++ b/test/win/idl-excluded/program.cc @@ -0,0 +1,7 @@ +// 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. + +int main() { + return 0; +} |