Commit cfec15d0 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[TargetEnvironmentHeader] Properly sanitize configuration defines

Closes https://github.com/CocoaPods/CocoaPods/issues/3301.
parent 598de4d4
......@@ -6,11 +6,18 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
## Master
##### Bug Fixes
* Fix the resource script's handling of `.xcasset` files.
[sodas](https://github.com/sodastsai)
[Tony Li](https://github.com/crazytonyli)
[#3247](https://github.com/CocoaPods/CocoaPods/issues/3247)
* Fix the sanitization of configuration names in the generated target
environment header.
[Samuel Giddins](https://github.com/segiddins)
[#3301](https://github.com/CocoaPods/CocoaPods/issues/3301)
## 0.36.0
......
......@@ -46,10 +46,12 @@ module Pod
common_specs = common_specs(specs_by_configuration)
common_specs.each { |spec| result << spec_defines(spec) }
c99ext_identifier_method = Target.new.method(:c99ext_identifier)
specs_by_config = specs_scoped_by_configuration(common_specs, specs_by_configuration)
specs_by_config.each do |config, specs|
result << "// #{config} build configuration\n"
result << "#ifdef #{config.gsub(/[^a-zA-Z0-9_]/, '_').upcase}\n\n"
result << "#ifdef #{c99ext_identifier_method[config].upcase}\n\n"
specs.each { |spec| result << spec_defines(spec, 1) }
result << "#endif\n"
end
......
......@@ -74,9 +74,11 @@ describe Pod::Generator::TargetEnvironmentHeader do
'Debug' => [],
'build configuration copy' => [spec],
'build-_config@copy' => [spec],
'1 - Develop' => [spec],
}
@gen = Pod::Generator::TargetEnvironmentHeader.new(specs_by_configuration)
@gen.generate.should.include 'BUILD_CONFIGURATION_COPY'
@gen.generate.should.include 'BUILD__CONFIG_COPY'
@gen.generate.should.include '_1___DEVELOP'
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment