🌈
Added a pod which is dependant on a build configuration and realised that the [CP] Embed Pods Frameworks build phase was running on rebuilds even though no changes were made.
I expect [CP] Embed Pods Frameworks to not run every time if no changes are made in the project.
The [CP] Embed Pods Frameworks build phase runs every time even though no changes are made in the project.

In the screenshot above from my example project, since Alamofire.framework is not present when building for Debug, the build phase will always run.
CocoaPods : 1.5.3
Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
RubyGems : 2.5.2.3
Host : Mac OS X 10.14 (18A391)
Xcode : 9.4.1 (9F2000)
Git : git version 2.18.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ d30f7da086ecff8c87d0ac2345a8bd33b76971c9
Executable Path: /Users/raphaeloliveira/Workspace/iOS/CocoapodsBuildConfiguration/vendor/bundle/ruby/2.3.0/bin/pod
cocoapods-deintegrate : 1.0.2
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.1
cocoapods-try : 1.1.0
platform :ios, '11.4'
use_frameworks!
target 'CocoapodsBuildConfiguration' do
pod 'Alamofire', '~> 4.7', :configuration => ['Release']
end
https://github.com/raphaeloliveira/CocoaPodsBuildConfiguration
I briefly discussed this issue on https://github.com/CocoaPods/CocoaPods/issues/6118 and if it's not possible because build phases are tied to a target rather than a build configuration, I'd love to know what alternatives I could use.
I'm also curious if Xcode 10 .xcfilelist could help in the future.
Thank you very much.
@raphaeloliveira yes I dont think we can achieve this. The script itself manages to accomplish this but there is no other way to pass or deal with input output paths per configuration for a script phase.
The only way around this is for CocoaPods to actually produce different script phases per configuration and debounce inside the script if the phase is not for the configuration being built.
I will mark it this as a hard enhancement but I wouldn't expect to land for a while, maybe version 1.7.0 or 2.0.0.
This should be possible in Xcode 10 by using the new file lists feature of run script build phases. That way CocoaPods could point to different file lists based on the current config
How would we point to different file lists based on the config? I believe the same problem arises in that we have to set a value at pod install that works for all configs.
I don't think we can do conditionals inside the file list itself, but the docs are pretty sparse:
Run Script build phases now support declaring input and output files in a .xcfilelist file. This file should contain a newline-seperated list of the file paths for the inputs or outputs. Build setting references may be used in these paths. The path to a copy of the .xcfilelist file with resolved build setting references will be provided in the SCRIPT_INPUT_FILE_LIST_(#) and SCRIPT_OUTPUT_FILE_LIST_(#) environment variables of the Run Script phase. Projects which use an .xcfilelist require Xcode 10. (39241255)
I dont think file lists would solve this problem. You cannot have 2 different sets of file lists or input/output paths on a single script phase unless as @amorde said you can do conditionals within the file lists.
The best solution here is for CocoaPods to integrate into multiple script phases for each configuration and have the other configurations "debounce" if it's not meant to run for them.
The other hard solution is to perform the same input/output logic that Xcode does and move all of it inside the script phase itself rather than using input/output paths. This is not favorable as we have no idea how Xcode performs these checks to ensures no inputs or outputs have changed.
The path to the .xcfilelist can include build settings, like $(CONFIGURATION). We'd probably put the value in the existing .xcconfig files though and reference them like this:

Interesting and cool! That might work then :D
PR open.
Nice!
Most helpful comment
PR open.