I am getting errors for few frameworks/module integrated into my workspace.
warning build: Run script build phase ‘Module name’ will be run during
every build because it does not specify any outputs. To address this
warning, either add output dependencies to the script phase, or
configure it to run in every build by unchecking "Based on dependency
analysis" in the script phase.
I am looking for a solution on how to address that issue.
To address this warning… or configure it to run in every build by
unchecking "Based on dependency analysis" in the script phase.
I don’t want to use the solution described above as this will cost me a build time. I’d rather know how to do below:
… either add output dependencies to the script phase
Unfortunately I don’t have enough knowledge on how to do it. I searched online and found nothing specific.
How to output those dependencies?
Thanks
6
Answers
See the script phase documentation for details, especially the "Specify the Input and Output Files for Your Script" section. You need to edit your build phase and specify which files your script is using as input (if any) and which files it’s going to generate.
Using this information, the Xcode build process can determine whether a script phase needs to be run: if the input files haven’t changed, there’s no need to run the script phase at all. If it does run, Xcode at least knows which output files were generated and thus which other build processes depending on these files need to be run.
See also the "Declare Inputs and Outputs for Custom Scripts and Build Rules" section in Improving the Speed of Incremental Builds
If you are using CocoaPods, your warnings are mostly coming from it. I came up with 2 temporary solutions for this, by modifying the Podfile. A permanent solution would require fixing the issue directly in CocoaPods itself. For custom run scripts that are not generated by CocoaPods, simply uncheck the "Based on dependency analysis" to indicate to Xcode that you intentionally don’t have input/output files to determine whether this script should be run or not.
Both set the
always_out_of_date
(aka "Based on dependency analysis") flag to true ("1"
) when needed, on any given project <=> target pair.Solution A: Do this all in the
post_integrate
hookPros: single block, compact solution
Cons: less performant than Solution B when running
pod install
, but it’s not perceptible, honestly.Solution B: Same as A, except modify the
pods_project
within thepost_install
hook, for a slightly better performancePros: technically more performant than Solution A because it saves one expensive call to
xcodeproj.save
Con: the solution is more scattered throughout your Podfile.
After running
pod install
, commit the changes made to your main xcodeproj if your xcodeproj file is stored in git.I have created a sample project with a working solution on how to address these warnings. You can find the repository here: https://github.com/steven851007/SwiftLint_build_phase_example
We can generate the input and output file list as a pre-build phase script, so the build phase only executes if that list has changed.
Alternatively, you can configure the "Create Symlinks to Header Folders" build phase to run in every build by unchecking "Based on dependency analysis" in the script phase. To do this, follow these steps:
sidebar.
it to select it.
Save your changes and rebuild your project.
For flutter developers if you are using latest macOS and Xcode version to publish app to app store
-Don’t try to change anything in Xcode
[for example Run Script,Thin Binary – check "Based on dependency analysis" or "for install build only" (except if you are using firebase crash analytics)]
Just try
Upgrading to latest version - Flutter
Channel stable, 3.7.7 – 3.7.10 etcUpdate minimum deployment version of project and any xcodeproj file, if you are using in your project like SDWebImage, I updated it, now it is working fine.