Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: pylib/gyp/input.py

Issue 11048018: Add "standalone_static_library" target flag (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/configurations/invalid/gyptest-configurations.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from compiler.ast import Const 5 from compiler.ast import Const
6 from compiler.ast import Dict 6 from compiler.ast import Dict
7 from compiler.ast import Discard 7 from compiler.ast import Discard
8 from compiler.ast import List 8 from compiler.ast import List
9 from compiler.ast import Module 9 from compiler.ast import Module
10 from compiler.ast import Node 10 from compiler.ast import Node
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 'link_languages', 76 'link_languages',
77 'libraries', 77 'libraries',
78 'postbuilds', 78 'postbuilds',
79 'product_dir', 79 'product_dir',
80 'product_extension', 80 'product_extension',
81 'product_name', 81 'product_name',
82 'product_prefix', 82 'product_prefix',
83 'rules', 83 'rules',
84 'run_as', 84 'run_as',
85 'sources', 85 'sources',
86 'standalone_static_library',
86 'suppress_wildcard', 87 'suppress_wildcard',
87 'target_name', 88 'target_name',
88 'toolset', 89 'toolset',
89 'toolsets', 90 'toolsets',
90 'type', 91 'type',
91 'variants', 92 'variants',
92 93
93 # Sections that can be found inside targets or configurations, but that 94 # Sections that can be found inside targets or configurations, but that
94 # should not be propagated from targets into their configurations. 95 # should not be propagated from targets into their configurations.
95 'variables', 96 'variables',
96 ] 97 ]
97 non_configuration_keys = [] 98 non_configuration_keys = []
98 99
99 # Keys that do not belong inside a configuration dictionary. 100 # Keys that do not belong inside a configuration dictionary.
100 invalid_configuration_keys = [ 101 invalid_configuration_keys = [
101 'actions', 102 'actions',
102 'all_dependent_settings', 103 'all_dependent_settings',
103 'configurations', 104 'configurations',
104 'dependencies', 105 'dependencies',
105 'direct_dependent_settings', 106 'direct_dependent_settings',
106 'libraries', 107 'libraries',
107 'link_settings', 108 'link_settings',
108 'sources', 109 'sources',
110 'standalone_static_library',
109 'target_name', 111 'target_name',
110 'type', 112 'type',
111 ] 113 ]
112 114
113 # Controls how the generator want the build file paths. 115 # Controls how the generator want the build file paths.
114 absolute_build_file_paths = False 116 absolute_build_file_paths = False
115 117
116 # Controls whether or not the generator supports multiple toolsets. 118 # Controls whether or not the generator supports multiple toolsets.
117 multiple_toolsets = False 119 multiple_toolsets = False
118 120
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 Raises an exception on error. 2275 Raises an exception on error.
2274 """ 2276 """
2275 VALID_TARGET_TYPES = ('executable', 'loadable_module', 2277 VALID_TARGET_TYPES = ('executable', 'loadable_module',
2276 'static_library', 'shared_library', 2278 'static_library', 'shared_library',
2277 'none') 2279 'none')
2278 target_type = target_dict.get('type', None) 2280 target_type = target_dict.get('type', None)
2279 if target_type not in VALID_TARGET_TYPES: 2281 if target_type not in VALID_TARGET_TYPES:
2280 raise GypError("Target %s has an invalid target type '%s'. " 2282 raise GypError("Target %s has an invalid target type '%s'. "
2281 "Must be one of %s." % 2283 "Must be one of %s." %
2282 (target, target_type, '/'.join(VALID_TARGET_TYPES))) 2284 (target, target_type, '/'.join(VALID_TARGET_TYPES)))
2285 if (target_dict.get('standalone_static_library', 0) and
2286 not target_type == 'static_library'):
2287 raise GypError('Target %s has type %s but standalone_static_library flag is'
2288 ' only valid for static_library type.' % (target,
2289 target_type))
2283 2290
2284 2291
2285 def ValidateSourcesInTarget(target, target_dict, build_file): 2292 def ValidateSourcesInTarget(target, target_dict, build_file):
2286 # TODO: Check if MSVC allows this for non-static_library targets. 2293 # TODO: Check if MSVC allows this for non-static_library targets.
2287 if target_dict.get('type', None) != 'static_library': 2294 if target_dict.get('type', None) != 'static_library':
2288 return 2295 return
2289 sources = target_dict.get('sources', []) 2296 sources = target_dict.get('sources', [])
2290 basenames = {} 2297 basenames = {}
2291 for source in sources: 2298 for source in sources:
2292 name, ext = os.path.splitext(source) 2299 name, ext = os.path.splitext(source)
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 ValidateRunAsInTarget(target, target_dict, build_file) 2629 ValidateRunAsInTarget(target, target_dict, build_file)
2623 ValidateActionsInTarget(target, target_dict, build_file) 2630 ValidateActionsInTarget(target, target_dict, build_file)
2624 2631
2625 # Generators might not expect ints. Turn them into strs. 2632 # Generators might not expect ints. Turn them into strs.
2626 TurnIntIntoStrInDict(data) 2633 TurnIntIntoStrInDict(data)
2627 2634
2628 # TODO(mark): Return |data| for now because the generator needs a list of 2635 # TODO(mark): Return |data| for now because the generator needs a list of
2629 # build files that came in. In the future, maybe it should just accept 2636 # build files that came in. In the future, maybe it should just accept
2630 # a list, and not the whole data dict. 2637 # a list, and not the whole data dict.
2631 return [flat_list, targets, data] 2638 return [flat_list, targets, data]
OLDNEW
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/configurations/invalid/gyptest-configurations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698