This is a known issue that Apple folks are tracking internally. Currently, Swift packages default to the "Release" configuration when anything other than Debug and Release is used. In theory, adding $(BUILD_DIR)/Release to SWIFT_INCLUDE_PATHS build setting for the custom configurations should work around this issue but it can lead to some weird errors in case something unexpected gets picked from that directory.
It seems to work if SWIFT_INCLUDE_PATHS is set to $(BUILD_DIR)/Release${EFFECTIVE_PLATFORM_NAME}
I also added a new user-defined build setting named DEFAULT_CONFIGURATION where I map between all custom build configurations to either "Debug" or "Release". Then I set SWIFT_INCLUDE_PATHS to $(BUILD_DIR)/${DEFAULT_CONFIGURATION}${EFFECTIVE_PLATFORM_NAME} which should work properly both for Debug and Release builds (I hope, since it's still a work in progress on my side).
We just did some testing with Xcode 11.3, and SPM packages don't build in the intended location anymore in archive mode.
Our apps typically have a number of configurations (like Debug, Release, Distribution, Sparkle, and some other), but our libs typically don't (just 2, Debug and Release) which makes it a lot easier to manager (tens of libs, but just 2 configs to maintain). When building archives, we force Distribution build to go into the Release subfolder by using the CONFIGURATION_BUILD_DIR=$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME) (Xcode target)
It looks like SPM integration in Xcode does not honor this setting anymore in Xcode 11.3 (was ok in 11.2, just broke), and the SPM targets are now built in the Distribution subfolder instead of the Release one, where other Xcode targets are, which break the build.
Is there a way to make the SPM targets inherit the appropriate setting from Xcode and restore previous behavior?
With the new Xcode 11.3, I had zero problems building & running an iOS app project with custom build configurations + local Swift packages without any changes in SWIFT_INCLUDE_PATHS. That's great!
However, when I tried to archive & export I realized that I only get "Generic Xcode Archive" which isn't really useful for export and distribution. Any ideas what's causing this issue or how to fix it?
Did this break in Xcode 12.5? Suddenly my archives using SPM on 12.5 (with an empty "Imports Path") are failing, as I can see it's not picking up stuff from under our custom build configuration path when archiving. It works for SPMs in general but if the SPM has a .bundle, it fails.
I'm seeing this error for a module that includes a resource bundle:
error: .../Build/Intermediates.noindex/ArchiveIntermediates/App BETA/BuildProductsPath/Trial/TagPicker_AppkitTagPicker.bundle: No such file or directory (in target 'App Trial' from project 'App')
I've been experimenting with CONFIGURATION_BUILD_DIR and the issue seems to be happening when SPM packages use resources and produce bundles. I've managed things to build with everything but when a package has a bundle – sounds like a bug. Before I file a ticket, wondering if anyone managed to fix this?