In creating a CocoaPod Podspec for a vendored_framework
I need to install a shell script to be run after all other build_phases
in the main project. The only way I have found to do this is by groping the directory for the .xcodeproj
file from the Podfile
.
post_install do |installer|
project_name = Dir.glob("*.xcodeproj").first
project = Xcodeproj::Project.open(project_name)
project.targets.each do |target|
inject_shell_script_build_phase(target)
end
project.save
end
This seems ridiculous given that pod install
or pod update
is running and clearly has this information already. Is there a way to get the project
reference directly without having to glob or hardcode the project filename?
This should do the trick... Notice the post_integrate
hook. Otherwise my changes got overridden (ignored?) unless I did it via the direct file open.
post_integrate do |installer|
project = installer.aggregate_targets[0].user_project
project.targets.each do |target|
inject_shell_script_build_phase(target)
end
project.save
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With