I've been going round and round for a couple days now trying to figure out why my post_install hook isn't producing the output I'm expecting. Here's my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
target "SCCommon" do
platform :ios, "6.0"
pod 'AFNetworking', '~> 1.2.1'
pod 'Mantle', '~> 1.3'
pod 'PubNub', '3.5.5'
end
target "SCCommon-TestHarness" do
platform :ios, "6.0"
# inhibit_all_warnings!
pod 'SCCommon', :path => '../SCCommon.podspec'
end
target "SCCommon-UnitTests" do
platform :ios, "6.0"
# inhibit_all_warnings!
pod 'OCMock', '2.2.3'
pod 'SCCommon', :path => '../SCCommon.podspec'
end
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == 'Pods-SCCommon-UnitTests'
puts "Setting preprocessor macro for #{target.name}..."
target.build_configurations.each do |config|
puts "#{config} configuration..."
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)','SC_DEBUG_SCCOMMON=1','FOOBAR']
puts config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
puts '---'
end
end
end
end
After running pod update
on the above, I get the following output:
Update all pods
Analyzing dependencies
CocoaPods 0.35.0 is available.
To update use: `sudo gem install cocoapods`
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Fetching podspec for `SCCommon` from `../SCCommon.podspec`
Downloading dependencies
Using AFNetworking (1.2.1)
Using Mantle (1.5.1)
Using OCMock (2.2.3)
Using PubNub (3.5.5)
Using SCCommon (0.3)
Generating Pods project
Setting preprocessor macro for Pods-SCCommon-UnitTests...
Release configuration...
$(inherited)
SC_DEBUG_SCCOMMON=1
FOOBAR
---
Debug configuration...
DEBUG=1
$(inherited)
---
Integrating client project
The question I have is: Why isn't the Debug configuration updating with the new macro definitions? You can see in the output that the Release configuration is setup correctly, but not Debug.
Any ideas?
Found the answer to my specific issue in the way I was adding macros. I had to break the
config.build_settings ...
line into two lines like so:As a side note, I was also setting the definition on the wrong target. Now that both of those issues are resolved, I am officially unstuck! Yay!