Permalink
Browse files

[UserProjectIntegrator] Check if the xcconfig files is overridden.

Closes #92.
  • Loading branch information...
1 parent 0a5cd24 commit 4980095bc74694b2873066c0deb69dcf2d171680 @fabiopelosin fabiopelosin committed Aug 22, 2012
View
@@ -1,6 +1,10 @@
## Master
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.12.0...master)
+###### Enhancements
+
+- Check if any of the build settings defined in the xcconfig files is overridden. [#92](https://github.com/CocoaPods/CocoaPods/issues/92)
+
###### Bug fixes
- The final project isn’t affected anymore by the `inhibit_all_warnings!` option.
@@ -105,6 +105,8 @@ def create_files(pods, sandbox)
end
puts "- Generating xcconfig file at `#{sandbox.root + @target_definition.xcconfig_name}'" if config.verbose?
xcconfig.save_as(sandbox.root + @target_definition.xcconfig_name)
+ @target_definition.xcconfig = xcconfig
+
puts "- Generating prefix header at `#{sandbox.root + @target_definition.prefix_header_name}'" if config.verbose?
save_prefix_header_as(sandbox.root + @target_definition.prefix_header_name, pods)
puts "- Generating copy resources script at `#{sandbox.root + @target_definition.copy_resources_script_name}'" if config.verbose?
@@ -135,9 +135,28 @@ def targets
def add_xcconfig_base_configuration
xcconfig = user_project.files.new('path' => @target_definition.xcconfig_relative_path)
targets.each do |target|
+ config_build_names_by_overriden_key = {}
target.build_configurations.each do |config|
+ config_name = config.attributes["name"]
+ if @target_definition.xcconfig
+ @target_definition.xcconfig.attributes.each do |key, value|
+ target_value = config.build_settings[key]
+ if target_value && !target_value.include?('$(inherited)')
+ config_build_names_by_overriden_key[key] ||= []
+ config_build_names_by_overriden_key[key] << config_name
+ end
+ end
+ end
+
config.base_configuration = xcconfig
end
+
+ config_build_names_by_overriden_key.each do |key, config_build_names|
+ name = "#{target.attributes["name"]} [#{config_build_names.join(' - ')}]"
+ puts "\n[!] The target `#{name}' overrides the `#{key}' build setting defined in `#{@target_definition.xcconfig_relative_path}'.".yellow
+ puts " - Use the `$(inherited)' flag, or"
+ puts " - Remove the build settings from the target."
+ end
end
end
@@ -143,6 +143,8 @@ def xcconfig_relative_path
relative_to_srcroot("Pods/#{xcconfig_name}").to_s
end
+ attr_accessor :xcconfig
+
def copy_resources_script_name
"#{label}-resources.sh"
end

0 comments on commit 4980095

Please sign in to comment.