Closed GoogleCodeExporter closed 9 years ago
$ svn diff
Index: pylib/gyp/generator/xcode.py
===================================================================
--- pylib/gyp/generator/xcode.py (revision 896)
+++ pylib/gyp/generator/xcode.py (working copy)
@@ -77,6 +77,10 @@
'mac_framework_headers',
]
+def listify(singleton_or_list):
+ if hasattr(singleton_or_list, '__len__'):
+ return singleton_or_list
+ return [singleton_or_list]
def CreateXCConfigurationList(configuration_names):
xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []})
@@ -168,9 +172,10 @@
for xck, xcv in self.build_file_dict.get('xcode_settings', {}).iteritems():
xccl.SetBuildSetting(xck, xcv)
if 'xcode_config_file' in self.build_file_dict:
- config_ref = self.project.AddOrGetFileInRootGroup(
- self.build_file_dict['xcode_config_file'])
- xccl.SetBaseConfiguration(config_ref)
+ config_files = listify(self.build_file_dict['xcode_config_file'])
+ for config_file in config_files:
+ config_ref = self.project.AddOrGetFileInRootGroup(config_file)
+ xccl.SetBaseConfiguration(config_ref)
build_file_configurations = self.build_file_dict.get('configurations', {})
if build_file_configurations:
for config_name in configurations:
@@ -182,9 +187,11 @@
{}).iteritems():
xcc.SetBuildSetting(xck, xcv)
if 'xcode_config_file' in build_file_configuration_named:
- config_ref = self.project.AddOrGetFileInRootGroup(
+ config_files = listify(
build_file_configurations[config_name]['xcode_config_file'])
- xcc.SetBaseConfiguration(config_ref)
+ for config_file in config_files:
+ config_ref = self.project.AddOrGetFileInRootGroup(config_file)
+ xcc.SetBaseConfiguration(config_ref)
# Sort the targets based on how they appeared in the input.
# TODO(mark): Like a lot of other things here, this assumes internal
@@ -1169,9 +1176,10 @@
for xck, xcv in configuration['xcode_settings'].iteritems():
xcbc.SetBuildSetting(xck, xcv)
if 'xcode_config_file' in configuration:
- config_ref = pbxp.AddOrGetFileInRootGroup(
- configuration['xcode_config_file'])
- xcbc.SetBaseConfiguration(config_ref)
+ config_files = listify(configuration['xcode_config_file'])
+ for config_file in config_files:
+ config_ref = pbxp.AddOrGetFileInRootGroup(config_file)
+ xcbc.SetBaseConfiguration(config_ref)
build_files = []
for build_file, build_file_dict in data.iteritems():
Original comment by abarth@chromium.org
on 26 Feb 2011 at 2:44
I'm not really sure how to submit a code review, but the above patch seems to
work.
Original comment by abarth@chromium.org
on 26 Feb 2011 at 2:44
There can only be one .xcconfig file set in an XCBuildConfiguration. An
XCBuildConfiguration represents a “configuration” such as “Debug” or
“Release,” including all of its settings, and can be applied either to a
target or an .xcodeproj as a whole. When an .xcconfig is in use, it is treated
as the “base” configuration for the XCBuildConfiguration. You can have only
one “base” configuration, if you want multiple .xcconfigs to apply to a
single XCBuildConfiguration, you need to specify a single one, and then have it
include other .xcconfigs.
Your proposed change only makes the final .xcconfig listed in an
xcode_config_file list effective, because the most recent call to
(XCBuildConfiguration).SetBaseConfiguration will supersede the base
configuration set by any earlier call. The only thing that calling
(XCBuildConfiguration).SetBaseConfiguration on the other .xcconfig files
achieves is getting their file references added to the .xcodeproj.
Since the structure of an Xcode project only allows a single base configuration
for each XCBuildConfiguration, it’s an error for the GYP xcode_config_file
property to allow anything other than a single file as a reference.
If you want to get other files, such as .xcconfigs that aren’t used as base
configurations for XCBuildConfigurations (not named in any xcode_config_files
property) listed in the project, you can simply list them in a sources section.
Because .xcconfig isn’t a known extension for any source that Xcode can
handle (or that a custom rule you define can handle), the .xcconfigs will
merely be added to the project, but will not be made part of any target or any
build. You can list all .xcconfigs you want to appear in this way, you don’t
need to restrict it to .xcconfigs not named in an xcode_config_files property.
If you’re extra-paranoid, you can also list them in sources! or sources/ to
ensure they’re excluded from compilation.
Original comment by mark@chromium.org
on 26 Feb 2011 at 4:24
Thanks for the explanation! I see the include structure of the xcconfigs that
I need to use now:
http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/Configurations
It sounds like JavaScriptCore.xcconfig should be the project-level xcconfig and
DebugRelease.xcconfig should be the target-level xcconfig.
Original comment by abarth@chromium.org
on 26 Feb 2011 at 7:25
Original issue reported on code.google.com by
abarth@chromium.org
on 26 Feb 2011 at 2:43