fix: Resolve Xcode stale files warnings #1496
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
iOS
Motivation and Context
Closes GH-1372.
Description
To get output app/ipa files in the expected places, we were overriding the
SYMROOT
value for command-line builds. However, this doesn't get applied when building in Xcode, and then it complains about "Stale files" in the Derived Data folder due to some things having been compiled with one SYMROOT value and others with a different one.Setting SYMROOT is a hack anyways, what we really want to do is set an install path and force the app bundles to be installed into the destination folders after they are built. This allows Xcode to use the same Derived Data path for all builds, and avoids cluttering the Cordova destination folders with intermediate build artifacts.
Except, that we can't do this for iOS app bundles because changing the install path corrupts the xcarchives that are produced as part of exporting an ipa bundle. So we need to make all this
INSTALL_PATH
andDEPLOYMENT_ROOT
stuff conditional based on whether we're building for a Simulator, Catalyst/macOS, or for a real iOS device.Testing
Alternated building a project in both Xcode and command-line and ensured that there were no warnings about stale files.
(Note if you are trying this yourself, it needs to be a new project that has not been built already, otherwise you need to clean it to remove any existing stale files pre-dating this change)
Checklist