Source release v3.2.0
This commit is contained in:
1
third_party/gyp/MSVSUtil.py
vendored
1
third_party/gyp/MSVSUtil.py
vendored
@@ -14,6 +14,7 @@ TARGET_TYPE_EXT = {
|
||||
'loadable_module': 'dll',
|
||||
'shared_library': 'dll',
|
||||
'static_library': 'lib',
|
||||
'windows_driver': 'sys',
|
||||
}
|
||||
|
||||
|
||||
|
||||
17
third_party/gyp/generator/make.py
vendored
17
third_party/gyp/generator/make.py
vendored
@@ -31,6 +31,8 @@ import gyp.xcode_emulation
|
||||
from gyp.common import GetEnvironFallback
|
||||
from gyp.common import GypError
|
||||
|
||||
import hashlib
|
||||
|
||||
generator_default_variables = {
|
||||
'EXECUTABLE_PREFIX': '',
|
||||
'EXECUTABLE_SUFFIX': '',
|
||||
@@ -90,7 +92,10 @@ def CalculateVariables(default_variables, params):
|
||||
if flavor == 'android':
|
||||
operating_system = 'linux' # Keep this legacy behavior for now.
|
||||
default_variables.setdefault('OS', operating_system)
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
|
||||
if flavor == 'aix':
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.a')
|
||||
else:
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
|
||||
default_variables.setdefault('SHARED_LIB_DIR','$(builddir)/lib.$(TOOLSET)')
|
||||
default_variables.setdefault('LIB_DIR', '$(obj).$(TOOLSET)')
|
||||
|
||||
@@ -1347,7 +1352,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
|
||||
if target[:3] == 'lib':
|
||||
target = target[3:]
|
||||
target_prefix = 'lib'
|
||||
target_ext = '.so'
|
||||
if self.flavor == 'aix':
|
||||
target_ext = '.a'
|
||||
else:
|
||||
target_ext = '.so'
|
||||
elif self.type == 'none':
|
||||
target = '%s.stamp' % target
|
||||
elif self.type != 'executable':
|
||||
@@ -1743,7 +1751,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
|
||||
# actual command.
|
||||
# - The intermediate recipe will 'touch' the intermediate file.
|
||||
# - The multi-output rule will have an do-nothing recipe.
|
||||
intermediate = "%s.intermediate" % (command if command else self.target)
|
||||
|
||||
# Hash the target name to avoid generating overlong filenames.
|
||||
cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
|
||||
intermediate = "%s.intermediate" % (cmddigest)
|
||||
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
|
||||
self.WriteLn('\t%s' % '@:');
|
||||
self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate))
|
||||
|
||||
47
third_party/gyp/generator/msvs.py
vendored
47
third_party/gyp/generator/msvs.py
vendored
@@ -46,6 +46,8 @@ VALID_MSVS_GUID_CHARS = re.compile(r'^[A-F0-9\-]+$')
|
||||
|
||||
|
||||
generator_default_variables = {
|
||||
'DRIVER_PREFIX': '',
|
||||
'DRIVER_SUFFIX': '.sys',
|
||||
'EXECUTABLE_PREFIX': '',
|
||||
'EXECUTABLE_SUFFIX': '.exe',
|
||||
'STATIC_LIB_PREFIX': '',
|
||||
@@ -272,6 +274,10 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
|
||||
tool[setting] = value
|
||||
|
||||
|
||||
def _ConfigTargetVersion(config_data):
|
||||
return config_data.get('msvs_target_version', 'Windows7')
|
||||
|
||||
|
||||
def _ConfigPlatform(config_data):
|
||||
return config_data.get('msvs_configuration_platform', 'Win32')
|
||||
|
||||
@@ -919,6 +925,8 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
|
||||
toolset = default_config.get('msbuild_toolset')
|
||||
if not toolset and version.DefaultToolset():
|
||||
toolset = version.DefaultToolset()
|
||||
if spec['type'] == 'windows_driver':
|
||||
toolset = 'WindowsKernelModeDriver10.0'
|
||||
return toolset
|
||||
|
||||
|
||||
@@ -1102,6 +1110,7 @@ def _GetMSVSConfigurationType(spec, build_file):
|
||||
'shared_library': '2', # .dll
|
||||
'loadable_module': '2', # .dll
|
||||
'static_library': '4', # .lib
|
||||
'windows_driver': '5', # .sys
|
||||
'none': '10', # Utility type
|
||||
}[spec['type']]
|
||||
except KeyError:
|
||||
@@ -1286,6 +1295,7 @@ def _GetOutputFilePathAndTool(spec, msbuild):
|
||||
'executable': ('VCLinkerTool', 'Link', '$(OutDir)', '.exe'),
|
||||
'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'),
|
||||
'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'),
|
||||
'windows_driver': ('VCLinkerTool', 'Link', '$(OutDir)', '.sys'),
|
||||
'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)lib\\', '.lib'),
|
||||
}
|
||||
output_file_props = output_file_map.get(spec['type'])
|
||||
@@ -1348,7 +1358,8 @@ def _GetDisabledWarnings(config):
|
||||
|
||||
def _GetModuleDefinition(spec):
|
||||
def_file = ''
|
||||
if spec['type'] in ['shared_library', 'loadable_module', 'executable']:
|
||||
if spec['type'] in ['shared_library', 'loadable_module', 'executable',
|
||||
'windows_driver']:
|
||||
def_files = [s for s in spec.get('sources', []) if s.endswith('.def')]
|
||||
if len(def_files) == 1:
|
||||
def_file = _FixPath(def_files[0])
|
||||
@@ -2668,6 +2679,18 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64':
|
||||
properties[0].append(['PreferredToolArchitecture', 'x64'])
|
||||
|
||||
if spec.get('msvs_target_platform_version'):
|
||||
target_platform_version = spec.get('msvs_target_platform_version')
|
||||
properties[0].append(['WindowsTargetPlatformVersion',
|
||||
target_platform_version])
|
||||
if spec.get('msvs_target_platform_minversion'):
|
||||
target_platform_minversion = spec.get('msvs_target_platform_minversion')
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_minversion])
|
||||
else:
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_version])
|
||||
|
||||
if spec.get('msvs_enable_winrt'):
|
||||
properties[0].append(['DefaultLanguage', 'en-US'])
|
||||
properties[0].append(['AppContainerApplication', 'true'])
|
||||
@@ -2676,18 +2699,6 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
properties[0].append(['ApplicationTypeRevision', app_type_revision])
|
||||
else:
|
||||
properties[0].append(['ApplicationTypeRevision', '8.1'])
|
||||
|
||||
if spec.get('msvs_target_platform_version'):
|
||||
target_platform_version = spec.get('msvs_target_platform_version')
|
||||
properties[0].append(['WindowsTargetPlatformVersion',
|
||||
target_platform_version])
|
||||
if spec.get('msvs_target_platform_minversion'):
|
||||
target_platform_minversion = spec.get('msvs_target_platform_minversion')
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_minversion])
|
||||
else:
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_version])
|
||||
if spec.get('msvs_enable_winphone'):
|
||||
properties[0].append(['ApplicationType', 'Windows Phone'])
|
||||
else:
|
||||
@@ -2710,14 +2721,20 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
|
||||
return properties
|
||||
|
||||
|
||||
def _GetMSBuildConfigurationDetails(spec, build_file):
|
||||
properties = {}
|
||||
for name, settings in spec['configurations'].iteritems():
|
||||
msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file)
|
||||
condition = _GetConfigurationCondition(name, settings)
|
||||
character_set = msbuild_attributes.get('CharacterSet')
|
||||
config_type = msbuild_attributes.get('ConfigurationType')
|
||||
_AddConditionalProperty(properties, condition, 'ConfigurationType',
|
||||
msbuild_attributes['ConfigurationType'])
|
||||
config_type)
|
||||
if config_type == 'Driver':
|
||||
_AddConditionalProperty(properties, condition, 'DriverType', 'WDM')
|
||||
_AddConditionalProperty(properties, condition, 'TargetVersion',
|
||||
_ConfigTargetVersion(settings))
|
||||
if character_set:
|
||||
if 'msvs_enable_winrt' not in spec :
|
||||
_AddConditionalProperty(properties, condition, 'CharacterSet',
|
||||
@@ -2816,6 +2833,7 @@ def _ConvertMSVSConfigurationType(config_type):
|
||||
'1': 'Application',
|
||||
'2': 'DynamicLibrary',
|
||||
'4': 'StaticLibrary',
|
||||
'5': 'Driver',
|
||||
'10': 'Utility'
|
||||
}[config_type]
|
||||
return config_type
|
||||
@@ -2855,6 +2873,7 @@ def _GetMSBuildAttributes(spec, config, build_file):
|
||||
'executable': 'Link',
|
||||
'shared_library': 'Link',
|
||||
'loadable_module': 'Link',
|
||||
'windows_driver': 'Link',
|
||||
'static_library': 'Lib',
|
||||
}
|
||||
msbuild_tool = msbuild_tool_map.get(spec['type'])
|
||||
|
||||
21
third_party/gyp/generator/ninja.py
vendored
21
third_party/gyp/generator/ninja.py
vendored
@@ -148,6 +148,9 @@ class Target(object):
|
||||
# because dependents only link against the lib (not both the lib and the
|
||||
# dll) we keep track of the import library here.
|
||||
self.import_lib = None
|
||||
# Track if this target contains any C++ files, to decide if gcc or g++
|
||||
# should be used for linking.
|
||||
self.uses_cpp = False
|
||||
|
||||
def Linkable(self):
|
||||
"""Return true if this is a target that can be linked against."""
|
||||
@@ -375,9 +378,6 @@ class NinjaWriter(object):
|
||||
self.target = Target(spec['type'])
|
||||
self.is_standalone_static_library = bool(
|
||||
spec.get('standalone_static_library', 0))
|
||||
# Track if this target contains any C++ files, to decide if gcc or g++
|
||||
# should be used for linking.
|
||||
self.uses_cpp = False
|
||||
|
||||
self.target_rpath = generator_flags.get('target_rpath', r'\$$ORIGIN/lib/')
|
||||
|
||||
@@ -425,6 +425,8 @@ class NinjaWriter(object):
|
||||
target = self.target_outputs[dep]
|
||||
actions_depends.append(target.PreActionInput(self.flavor))
|
||||
compile_depends.append(target.PreCompileInput())
|
||||
if target.uses_cpp:
|
||||
self.target.uses_cpp = True
|
||||
actions_depends = filter(None, actions_depends)
|
||||
compile_depends = filter(None, compile_depends)
|
||||
actions_depends = self.WriteCollapsedDependencies('actions_depends',
|
||||
@@ -450,7 +452,12 @@ class NinjaWriter(object):
|
||||
|
||||
# Write out the compilation steps, if any.
|
||||
link_deps = []
|
||||
sources = extra_sources + spec.get('sources', [])
|
||||
try:
|
||||
sources = extra_sources + spec.get('sources', [])
|
||||
except TypeError:
|
||||
print 'extra_sources: ', str(extra_sources)
|
||||
print 'spec.get("sources"): ', str(spec.get('sources'))
|
||||
raise
|
||||
if sources:
|
||||
if self.flavor == 'mac' and len(self.archs) > 1:
|
||||
# Write subninja file containing compile and link commands scoped to
|
||||
@@ -1027,7 +1034,7 @@ class NinjaWriter(object):
|
||||
obj_ext = self.obj_ext
|
||||
if ext in ('cc', 'cpp', 'cxx'):
|
||||
command = 'cxx'
|
||||
self.uses_cpp = True
|
||||
self.target.uses_cpp = True
|
||||
elif ext == 'c' or (ext == 'S' and self.flavor != 'win'):
|
||||
command = 'cc'
|
||||
elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files.
|
||||
@@ -1042,7 +1049,7 @@ class NinjaWriter(object):
|
||||
command = 'objc'
|
||||
elif self.flavor == 'mac' and ext == 'mm':
|
||||
command = 'objcxx'
|
||||
self.uses_cpp = True
|
||||
self.target.uses_cpp = True
|
||||
elif self.flavor == 'win' and ext == 'rc':
|
||||
command = 'rc'
|
||||
obj_ext = '.res'
|
||||
@@ -1178,7 +1185,7 @@ class NinjaWriter(object):
|
||||
implicit_deps.add(final_output)
|
||||
|
||||
extra_bindings = []
|
||||
if self.uses_cpp and self.flavor != 'win':
|
||||
if self.target.uses_cpp and self.flavor != 'win':
|
||||
extra_bindings.append(('ld', '$ldxx'))
|
||||
|
||||
output = self.ComputeOutput(spec, arch)
|
||||
|
||||
14
third_party/gyp/input.py
vendored
14
third_party/gyp/input.py
vendored
@@ -33,6 +33,7 @@ linkable_types = [
|
||||
'shared_library',
|
||||
'loadable_module',
|
||||
'mac_kernel_extension',
|
||||
'windows_driver',
|
||||
]
|
||||
|
||||
# A list of sections that contain links to other targets.
|
||||
@@ -1734,12 +1735,13 @@ class DependencyGraphNode(object):
|
||||
dependencies.add(self.ref)
|
||||
return dependencies
|
||||
|
||||
# Executables, mac kernel extensions and loadable modules are already fully
|
||||
# and finally linked. Nothing else can be a link dependency of them, there
|
||||
# can only be dependencies in the sense that a dependent target might run
|
||||
# an executable or load the loadable_module.
|
||||
# Executables, mac kernel extensions, windows drivers and loadable modules
|
||||
# are already fully and finally linked. Nothing else can be a link
|
||||
# dependency of them, there can only be dependencies in the sense that a
|
||||
# dependent target might run an executable or load the loadable_module.
|
||||
if not initial and target_type in ('executable', 'loadable_module',
|
||||
'mac_kernel_extension'):
|
||||
'mac_kernel_extension',
|
||||
'windows_driver'):
|
||||
return dependencies
|
||||
|
||||
# Shared libraries are already fully linked. They should only be included
|
||||
@@ -2490,7 +2492,7 @@ def ValidateTargetType(target, target_dict):
|
||||
"""
|
||||
VALID_TARGET_TYPES = ('executable', 'loadable_module',
|
||||
'static_library', 'shared_library',
|
||||
'mac_kernel_extension', 'none')
|
||||
'mac_kernel_extension', 'none', 'windows_driver')
|
||||
target_type = target_dict.get('type', None)
|
||||
if target_type not in VALID_TARGET_TYPES:
|
||||
raise GypError("Target %s has an invalid target type '%s'. "
|
||||
|
||||
2
third_party/gyp/mac_tool.py
vendored
2
third_party/gyp/mac_tool.py
vendored
@@ -147,7 +147,7 @@ class MacTool(object):
|
||||
fp = open(file_name, 'rb')
|
||||
try:
|
||||
header = fp.read(3)
|
||||
except e:
|
||||
except:
|
||||
fp.close()
|
||||
return None
|
||||
fp.close()
|
||||
|
||||
83
third_party/gyp/xcode_emulation.py
vendored
83
third_party/gyp/xcode_emulation.py
vendored
@@ -312,6 +312,56 @@ class XcodeSettings(object):
|
||||
return self.GetBundleContentsFolderPath()
|
||||
return os.path.join(self.GetBundleContentsFolderPath(), 'Resources')
|
||||
|
||||
def GetBundleExecutableFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's executables folder. E.g.
|
||||
Chromium.app/Contents/MacOS. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
if self.spec['type'] in ('shared_library') or self.isIOS:
|
||||
return self.GetBundleContentsFolderPath()
|
||||
elif self.spec['type'] in ('executable', 'loadable_module'):
|
||||
return os.path.join(self.GetBundleContentsFolderPath(), 'MacOS')
|
||||
|
||||
def GetBundleJavaFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's Java resource folder.
|
||||
E.g. Chromium.app/Contents/Resources/Java. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
return os.path.join(self.GetBundleResourceFolder(), 'Java')
|
||||
|
||||
def GetBundleFrameworksFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's frameworks folder. E.g,
|
||||
Chromium.app/Contents/Frameworks. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
return os.path.join(self.GetBundleContentsFolderPath(), 'Frameworks')
|
||||
|
||||
def GetBundleSharedFrameworksFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's frameworks folder. E.g,
|
||||
Chromium.app/Contents/SharedFrameworks. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
return os.path.join(self.GetBundleContentsFolderPath(),
|
||||
'SharedFrameworks')
|
||||
|
||||
def GetBundleSharedSupportFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's shared support folder. E.g,
|
||||
Chromium.app/Contents/SharedSupport. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
if self.spec['type'] == 'shared_library':
|
||||
return self.GetBundleResourceFolder()
|
||||
else:
|
||||
return os.path.join(self.GetBundleContentsFolderPath(),
|
||||
'SharedSupport')
|
||||
|
||||
def GetBundlePlugInsFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's plugins folder. E.g,
|
||||
Chromium.app/Contents/PlugIns. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
return os.path.join(self.GetBundleContentsFolderPath(), 'PlugIns')
|
||||
|
||||
def GetBundleXPCServicesFolderPath(self):
|
||||
"""Returns the qualified path to the bundle's XPC services folder. E.g,
|
||||
Chromium.app/Contents/XPCServices. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
return os.path.join(self.GetBundleContentsFolderPath(), 'XPCServices')
|
||||
|
||||
def GetBundlePlistPath(self):
|
||||
"""Returns the qualified path to the bundle's plist file. E.g.
|
||||
Chromium.app/Contents/Info.plist. Only valid for bundles."""
|
||||
@@ -371,11 +421,8 @@ class XcodeSettings(object):
|
||||
"""Returns the name of the bundle binary of by this target.
|
||||
E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles."""
|
||||
assert self._IsBundle()
|
||||
if self.spec['type'] in ('shared_library') or self.isIOS:
|
||||
path = self.GetBundleContentsFolderPath()
|
||||
elif self.spec['type'] in ('executable', 'loadable_module'):
|
||||
path = os.path.join(self.GetBundleContentsFolderPath(), 'MacOS')
|
||||
return os.path.join(path, self.GetExecutableName())
|
||||
return os.path.join(self.GetBundleExecutableFolderPath(), \
|
||||
self.GetExecutableName())
|
||||
|
||||
def _GetStandaloneExecutableSuffix(self):
|
||||
if 'product_extension' in self.spec:
|
||||
@@ -426,8 +473,8 @@ class XcodeSettings(object):
|
||||
return self._GetStandaloneBinaryPath()
|
||||
|
||||
def GetExecutablePath(self):
|
||||
"""Returns the directory name of the bundle represented by this target. E.g.
|
||||
Chromium.app/Contents/MacOS/Chromium."""
|
||||
"""Returns the qualified path to the primary executable of the bundle
|
||||
represented by this target. E.g. Chromium.app/Contents/MacOS/Chromium."""
|
||||
if self._IsBundle():
|
||||
return self._GetBundleBinaryPath()
|
||||
else:
|
||||
@@ -1541,13 +1588,14 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
|
||||
additional_settings: An optional dict with more values to add to the
|
||||
result.
|
||||
"""
|
||||
|
||||
if not xcode_settings: return {}
|
||||
|
||||
# This function is considered a friend of XcodeSettings, so let it reach into
|
||||
# its implementation details.
|
||||
spec = xcode_settings.spec
|
||||
|
||||
# These are filled in on a as-needed basis.
|
||||
# These are filled in on an as-needed basis.
|
||||
env = {
|
||||
'BUILT_FRAMEWORKS_DIR' : built_products_dir,
|
||||
'BUILT_PRODUCTS_DIR' : built_products_dir,
|
||||
@@ -1580,10 +1628,27 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
|
||||
env['MACH_O_TYPE'] = mach_o_type
|
||||
env['PRODUCT_TYPE'] = xcode_settings.GetProductType()
|
||||
if xcode_settings._IsBundle():
|
||||
# xcodeproj_file.py sets the same Xcode subfolder value for this as for
|
||||
# FRAMEWORKS_FOLDER_PATH so Xcode builds will actually use FFP's value.
|
||||
env['BUILT_FRAMEWORKS_DIR'] = \
|
||||
os.path.join(built_products_dir + os.sep \
|
||||
+ xcode_settings.GetBundleFrameworksFolderPath())
|
||||
env['CONTENTS_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleContentsFolderPath()
|
||||
xcode_settings.GetBundleContentsFolderPath()
|
||||
env['EXECUTABLE_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleExecutableFolderPath()
|
||||
env['UNLOCALIZED_RESOURCES_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleResourceFolder()
|
||||
env['JAVA_FOLDER_PATH'] = xcode_settings.GetBundleJavaFolderPath()
|
||||
env['FRAMEWORKS_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleFrameworksFolderPath()
|
||||
env['SHARED_FRAMEWORKS_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleSharedFrameworksFolderPath()
|
||||
env['SHARED_SUPPORT_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleSharedSupportFolderPath()
|
||||
env['PLUGINS_FOLDER_PATH'] = xcode_settings.GetBundlePlugInsFolderPath()
|
||||
env['XPCSERVICES_FOLDER_PATH'] = \
|
||||
xcode_settings.GetBundleXPCServicesFolderPath()
|
||||
env['INFOPLIST_PATH'] = xcode_settings.GetBundlePlistPath()
|
||||
env['WRAPPER_NAME'] = xcode_settings.GetWrapperName()
|
||||
|
||||
|
||||
109
third_party/gyp/xcodeproj_file.py
vendored
109
third_party/gyp/xcodeproj_file.py
vendored
@@ -1945,24 +1945,40 @@ class PBXCopyFilesBuildPhase(XCBuildPhase):
|
||||
'name': [0, str, 0, 0],
|
||||
})
|
||||
|
||||
# path_tree_re matches "$(DIR)/path" or just "$(DIR)". Match group 1 is
|
||||
# "DIR", match group 3 is "path" or None.
|
||||
path_tree_re = re.compile('^\\$\\((.*)\\)(/(.*)|)$')
|
||||
# path_tree_re matches "$(DIR)/path", "$(DIR)/$(DIR2)/path" or just "$(DIR)".
|
||||
# Match group 1 is "DIR", group 3 is "path" or "$(DIR2") or "$(DIR2)/path"
|
||||
# or None. If group 3 is "path", group 4 will be None otherwise group 4 is
|
||||
# "DIR2" and group 6 is "path".
|
||||
path_tree_re = re.compile(r'^\$\((.*?)\)(/(\$\((.*?)\)(/(.*)|)|(.*)|)|)$')
|
||||
|
||||
# path_tree_to_subfolder maps names of Xcode variables to the associated
|
||||
# dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase object.
|
||||
path_tree_to_subfolder = {
|
||||
'BUILT_FRAMEWORKS_DIR': 10, # Frameworks Directory
|
||||
'BUILT_PRODUCTS_DIR': 16, # Products Directory
|
||||
# Other types that can be chosen via the Xcode UI.
|
||||
# TODO(mark): Map Xcode variable names to these.
|
||||
# : 1, # Wrapper
|
||||
# : 6, # Executables: 6
|
||||
# : 7, # Resources
|
||||
# : 15, # Java Resources
|
||||
# : 11, # Shared Frameworks
|
||||
# : 12, # Shared Support
|
||||
# : 13, # PlugIns
|
||||
# path_tree_{first,second}_to_subfolder map names of Xcode variables to the
|
||||
# associated dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase
|
||||
# object.
|
||||
path_tree_first_to_subfolder = {
|
||||
# Types that can be chosen via the Xcode UI.
|
||||
'BUILT_PRODUCTS_DIR': 16, # Products Directory
|
||||
'BUILT_FRAMEWORKS_DIR': 10, # Not an official Xcode macro.
|
||||
# Existed before support for the
|
||||
# names below was added. Maps to
|
||||
# "Frameworks".
|
||||
}
|
||||
|
||||
path_tree_second_to_subfolder = {
|
||||
'WRAPPER_NAME': 1, # Wrapper
|
||||
# Although Xcode's friendly name is "Executables", the destination
|
||||
# is demonstrably the value of the build setting
|
||||
# EXECUTABLE_FOLDER_PATH not EXECUTABLES_FOLDER_PATH.
|
||||
'EXECUTABLE_FOLDER_PATH': 6, # Executables.
|
||||
'UNLOCALIZED_RESOURCES_FOLDER_PATH': 7, # Resources
|
||||
'JAVA_FOLDER_PATH': 15, # Java Resources
|
||||
'FRAMEWORKS_FOLDER_PATH': 10, # Frameworks
|
||||
'SHARED_FRAMEWORKS_FOLDER_PATH': 11, # Shared Frameworks
|
||||
'SHARED_SUPPORT_FOLDER_PATH': 12, # Shared Support
|
||||
'PLUGINS_FOLDER_PATH': 13, # PlugIns
|
||||
# For XPC Services, Xcode sets both dstPath and dstSubfolderSpec.
|
||||
# Note that it re-uses the BUILT_PRODUCTS_DIR value for
|
||||
# dstSubfolderSpec. dstPath is set below.
|
||||
'XPCSERVICES_FOLDER_PATH': 16, # XPC Services.
|
||||
}
|
||||
|
||||
def Name(self):
|
||||
@@ -1983,14 +1999,61 @@ class PBXCopyFilesBuildPhase(XCBuildPhase):
|
||||
|
||||
path_tree_match = self.path_tree_re.search(path)
|
||||
if path_tree_match:
|
||||
# Everything else needs to be relative to an Xcode variable.
|
||||
path_tree = path_tree_match.group(1)
|
||||
relative_path = path_tree_match.group(3)
|
||||
|
||||
if path_tree in self.path_tree_to_subfolder:
|
||||
subfolder = self.path_tree_to_subfolder[path_tree]
|
||||
path_tree = path_tree_match.group(1);
|
||||
if path_tree in self.path_tree_first_to_subfolder:
|
||||
subfolder = self.path_tree_first_to_subfolder[path_tree]
|
||||
relative_path = path_tree_match.group(3)
|
||||
if relative_path is None:
|
||||
relative_path = ''
|
||||
|
||||
if subfolder == 16 and path_tree_match.group(4) is not None:
|
||||
# BUILT_PRODUCTS_DIR (16) is the first element in a path whose
|
||||
# second element is possibly one of the variable names in
|
||||
# path_tree_second_to_subfolder. Xcode sets the values of all these
|
||||
# variables to relative paths so .gyp files must prefix them with
|
||||
# BUILT_PRODUCTS_DIR, e.g.
|
||||
# $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH). Then
|
||||
# xcode_emulation.py can export these variables with the same values
|
||||
# as Xcode yet make & ninja files can determine the absolute path
|
||||
# to the target. Xcode uses the dstSubfolderSpec value set here
|
||||
# to determine the full path.
|
||||
#
|
||||
# An alternative of xcode_emulation.py setting the values to absolute
|
||||
# paths when exporting these variables has been ruled out because
|
||||
# then the values would be different depending on the build tool.
|
||||
#
|
||||
# Another alternative is to invent new names for the variables used
|
||||
# to match to the subfolder indices in the second table. .gyp files
|
||||
# then will not need to prepend $(BUILT_PRODUCTS_DIR) because
|
||||
# xcode_emulation.py can set the values of those variables to
|
||||
# the absolute paths when exporting. This is possibly the thinking
|
||||
# behind BUILT_FRAMEWORKS_DIR which is used in exactly this manner.
|
||||
#
|
||||
# Requiring prepending BUILT_PRODUCTS_DIR has been chosen because
|
||||
# this same way could be used to specify destinations in .gyp files
|
||||
# that pre-date this addition to GYP. However they would only work
|
||||
# with the Xcode generator. The previous version of xcode_emulation.py
|
||||
# does not export these variables. Such files will get the benefit
|
||||
# of the Xcode UI showing the proper destination name simply by
|
||||
# regenerating the projects with this version of GYP.
|
||||
path_tree = path_tree_match.group(4)
|
||||
relative_path = path_tree_match.group(6)
|
||||
separator = '/'
|
||||
|
||||
if path_tree in self.path_tree_second_to_subfolder:
|
||||
subfolder = self.path_tree_second_to_subfolder[path_tree]
|
||||
if relative_path is None:
|
||||
relative_path = ''
|
||||
separator = ''
|
||||
if path_tree == 'XPCSERVICES_FOLDER_PATH':
|
||||
relative_path = '$(CONTENTS_FOLDER_PATH)/XPCServices' \
|
||||
+ separator + relative_path
|
||||
else:
|
||||
# subfolder = 16 from above
|
||||
# The second element of the path is an unrecognized variable.
|
||||
# Include it and any remaining elements in relative_path.
|
||||
relative_path = path_tree_match.group(3);
|
||||
|
||||
else:
|
||||
# The path starts with an unrecognized Xcode variable
|
||||
# name like $(SRCROOT). Xcode will still handle this
|
||||
|
||||
Reference in New Issue
Block a user