-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
post_install
hook doesn't respect adding GCC_PREPROCESSOR_DEFINITIONS
to a specific target.
#1322
Comments
Can you try to print the objects id to see whether they are the same instance (they shouldn't)? puts config.object_id
puts config.build_settings.object_id |
@irrationalfab I've modified post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == 'Pods-MTDates'
puts 'Pods-MTDates'
target.build_configurations.each do |config|
puts " config.name: #{config.name}"
puts " config.object_id: #{config.object_id}"
puts " config.build_settings.object_id: #{config.build_settings.object_id}"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'MTDATES_NO_PREFIX=1'
end
elsif target.name == 'Pods-SVProgressHUD'
puts 'Pods-SVProgressHUD'
target.build_configurations.each do |config|
puts " config.name: #{config.name}"
puts " config.object_id: #{config.object_id}"
puts " config.build_settings.object_id: #{config.build_settings.object_id}"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'SOMETHING_SPECAIL_FOR_SVPROGRESS=1'
end
end
end
end And here it the output:
|
can you print the object id of the
|
@irrationalfab but it's not a string. It's an array or nil... Updated post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == 'Pods-MTDates'
puts 'Pods-MTDates'
target.build_configurations.each do |config|
puts " config.name: #{config.name}"
puts " config.object_id: #{config.object_id}"
puts " config.build_settings.object_id: #{config.build_settings.object_id}"
puts " config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']"
puts " before hooking:"
puts " object_id: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].object_id}"
puts " inspect: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].inspect}"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'MTDATES_NO_PREFIX=1'
puts " after hooking:"
puts " object_id: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].object_id}"
puts " inspect: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].inspect}"
end
elsif target.name == 'Pods-SVProgressHUD'
puts 'Pods-SVProgressHUD'
target.build_configurations.each do |config|
puts " config.name: #{config.name}"
puts " config.object_id: #{config.object_id}"
puts " config.build_settings.object_id: #{config.build_settings.object_id}"
puts " config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']"
puts " before hooking:"
puts " object_id: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].object_id}"
puts " inspect: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].inspect}"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'SOMETHING_SPECAIL_FOR_SVPROGRESS=1'
puts " after hooking:"
puts " object_id: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].object_id}"
puts " inspect: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].inspect}"
end
end
end
end Output:
|
So the issue is that it is the same array. |
I have added a fix, today the new version of CocoaPods should be out but the fix will not be included. However you should be able to test it easily by cloning xcodeproj and running |
@irrationalfab thank you! I also was just looking how it can be fixed. But I was much slower than you in this :) I've just found that in |
@irrationalfab works good! Thanks! 👍 |
🍻 |
fix Calabash Spec for CocoaPods#738 changes
In continuation of the discussion started on SO.
I'm using MTDates in my project and would like to add a preprocessor macros
MTDATES_NO_PREFIX=1
to enable short method names.I've added a
post_install
hook (thanks for the proposal @alloy) to my Podfile:And I've noticed that it adds
MTDATES_NO_PREFIX=1
to Debug configuration of all myPods-*
targets.I've created a test project to demonstrate the issue.
It has Podfile with the contents:
As you can see I've added some special preprocessor macroses for two of three libraries. So I expect that
Pods-TransformerKit
target has only default preprocessor macros, but it has all of them. IncludingMTDATES_NO_PREFIX=1
which is specific forPods-MTDates
target andSOMETHING_SPECAIL_FOR_SVPROGRESS=1
which is specific forPods-SVProgressHUD
target.And please notice that Release configurations have expected preprocessor macros.
Is this a bug?
Thanks in advance.
The text was updated successfully, but these errors were encountered: