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

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

Issue 376603002: This CL adds support for extension in GYP. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: comment corrections Created 6 years, 5 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
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 10 matching lines...) Expand all
21 import subprocess 21 import subprocess
22 import sys 22 import sys
23 import threading 23 import threading
24 import time 24 import time
25 import traceback 25 import traceback
26 from gyp.common import GypError 26 from gyp.common import GypError
27 from gyp.common import OrderedSet 27 from gyp.common import OrderedSet
28 28
29 29
30 # A list of types that are treated as linkable. 30 # A list of types that are treated as linkable.
31 linkable_types = ['executable', 'shared_library', 'loadable_module'] 31 linkable_types = [
32 'executable',
33 'shared_library',
34 'loadable_module',
35 'extension'
36 ]
32 37
33 # A list of sections that contain links to other targets. 38 # A list of sections that contain links to other targets.
34 dependency_sections = ['dependencies', 'export_dependent_settings'] 39 dependency_sections = ['dependencies', 'export_dependent_settings']
35 40
36 # base_path_sections is a list of sections defined by GYP that contain 41 # base_path_sections is a list of sections defined by GYP that contain
37 # pathnames. The generators can provide more keys, the two lists are merged 42 # pathnames. The generators can provide more keys, the two lists are merged
38 # into path_sections, but you should call IsPathSection instead of using either 43 # into path_sections, but you should call IsPathSection instead of using either
39 # list directly. 44 # list directly.
40 base_path_sections = [ 45 base_path_sections = [
41 'destination', 46 'destination',
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 # dependencies are intended to apply to the target itself (initial is 1701 # dependencies are intended to apply to the target itself (initial is
1697 # True) and this target won't be linked. 1702 # True) and this target won't be linked.
1698 return dependencies 1703 return dependencies
1699 1704
1700 # Don't traverse 'none' targets if explicitly excluded. 1705 # Don't traverse 'none' targets if explicitly excluded.
1701 if (target_type == 'none' and 1706 if (target_type == 'none' and
1702 not targets[self.ref].get('dependencies_traverse', True)): 1707 not targets[self.ref].get('dependencies_traverse', True)):
1703 dependencies.add(self.ref) 1708 dependencies.add(self.ref)
1704 return dependencies 1709 return dependencies
1705 1710
1706 # Executables and loadable modules are already fully and finally linked. 1711 # Executables, loadable modules, and extensions are already fully and
1707 # Nothing else can be a link dependency of them, there can only be 1712 # finally linked. Nothing else can be a link dependency of them, there can
1708 # dependencies in the sense that a dependent target might run an 1713 # only be dependencies in the sense that a dependent target might run an
1709 # executable or load the loadable_module. 1714 # executable or load the loadable_module.
1710 if not initial and target_type in ('executable', 'loadable_module'): 1715 FULLY_LINKED_TYPES = ('executable', 'loadable_module', 'extension')
pkl (ping after 24h if needed) 2014/07/09 08:07:50 This is just a "normal" local variable. It should
olivierrobin 2014/07/09 12:46:27 Done.
1716 if not initial and target_type in FULLY_LINKED_TYPES:
1711 return dependencies 1717 return dependencies
1712 1718
1713 # Shared libraries are already fully linked. They should only be included 1719 # Shared libraries are already fully linked. They should only be included
1714 # in |dependencies| when adjusting static library dependencies (in order to 1720 # in |dependencies| when adjusting static library dependencies (in order to
1715 # link against the shared_library's import lib), but should not be included 1721 # link against the shared_library's import lib), but should not be included
1716 # in |dependencies| when propagating link_settings. 1722 # in |dependencies| when propagating link_settings.
1717 # The |include_shared_libraries| flag controls which of these two cases we 1723 # The |include_shared_libraries| flag controls which of these two cases we
1718 # are handling. 1724 # are handling.
1719 if (not initial and target_type == 'shared_library' and 1725 if (not initial and target_type == 'shared_library' and
1720 not include_shared_libraries): 1726 not include_shared_libraries):
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 """Ensures the 'type' field on the target is one of the known types. 2449 """Ensures the 'type' field on the target is one of the known types.
2444 2450
2445 Arguments: 2451 Arguments:
2446 target: string, name of target. 2452 target: string, name of target.
2447 target_dict: dict, target spec. 2453 target_dict: dict, target spec.
2448 2454
2449 Raises an exception on error. 2455 Raises an exception on error.
2450 """ 2456 """
2451 VALID_TARGET_TYPES = ('executable', 'loadable_module', 2457 VALID_TARGET_TYPES = ('executable', 'loadable_module',
2452 'static_library', 'shared_library', 2458 'static_library', 'shared_library',
2453 'none') 2459 'extension', 'none')
2454 target_type = target_dict.get('type', None) 2460 target_type = target_dict.get('type', None)
2455 if target_type not in VALID_TARGET_TYPES: 2461 if target_type not in VALID_TARGET_TYPES:
2456 raise GypError("Target %s has an invalid target type '%s'. " 2462 raise GypError("Target %s has an invalid target type '%s'. "
2457 "Must be one of %s." % 2463 "Must be one of %s." %
2458 (target, target_type, '/'.join(VALID_TARGET_TYPES))) 2464 (target, target_type, '/'.join(VALID_TARGET_TYPES)))
2459 if (target_dict.get('standalone_static_library', 0) and 2465 if (target_dict.get('standalone_static_library', 0) and
2460 not target_type == 'static_library'): 2466 not target_type == 'static_library'):
2461 raise GypError('Target %s has type %s but standalone_static_library flag is' 2467 raise GypError('Target %s has type %s but standalone_static_library flag is'
2462 ' only valid for static_library type.' % (target, 2468 ' only valid for static_library type.' % (target,
2463 target_type)) 2469 target_type))
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 ValidateRunAsInTarget(target, target_dict, build_file) 2857 ValidateRunAsInTarget(target, target_dict, build_file)
2852 ValidateActionsInTarget(target, target_dict, build_file) 2858 ValidateActionsInTarget(target, target_dict, build_file)
2853 2859
2854 # Generators might not expect ints. Turn them into strs. 2860 # Generators might not expect ints. Turn them into strs.
2855 TurnIntIntoStrInDict(data) 2861 TurnIntIntoStrInDict(data)
2856 2862
2857 # TODO(mark): Return |data| for now because the generator needs a list of 2863 # TODO(mark): Return |data| for now because the generator needs a list of
2858 # build files that came in. In the future, maybe it should just accept 2864 # build files that came in. In the future, maybe it should just accept
2859 # a list, and not the whole data dict. 2865 # a list, and not the whole data dict.
2860 return [flat_list, targets, data] 2866 return [flat_list, targets, data]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698