I'm trying to get SPM to work with different build configurations other than Debug and Release. Our iOS project has different schemes (e.g. Debug-Staging, Debug-Production, Alpha-Staging, Alpha-Production, etc.) where I set the bundle identifier, some flags, etc.
Is there a way to achieve that diversification even if SPM only "understands" Debug and Release?
Specify path to your custom config file when invoking generate-xcodeproj command.
Sample
swift-package generate-xcodeproj --xcconfig-overrides Config.xcconfig
Related
How to add a dependency that only needs when building with Debug configuration?
Or better yet, how to exclude a Swift Package from Release configuration?
I tried to use EXCLUDED_SOURCE_FILE_NAMES build settings, but package sources are not directly linked.
You can create a Framework for debug libraries, and exclude the actual framework file from Release builds. ✨
Add the Swift Package to the project
Create a framework called DebugPackages
Add the Swift Package to the framework at General/Frameworks and Libraries
Add DebugPackages.framework to the Build Options/Excluded Source File Names build setting in Release configuration.
In my project I have enabled the Build Libraries for Distribution” into ”Yes” into my SDK build setting, to prevent swift upgrades from causing a problem for third party libraries. In this case, When I Build with the project for SDK, I have set legacy mode but I am facing issue like below:
The legacy does not support Build Libraries for Distribution” into ”Yes”.
How to fix this? I can able to build the project new build system instead of legacy mode
The reason for setting legacy mode is When I set a new build system and prepare to build I am getting this below error. To fix this I am using legacy mode
Multiple commands produce '/Path/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-54e75ca4' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
The workaround for this build system issue is to explicitly add all the needed GoogleUtilities subspecs to the Podfile. See the Podfile.lock file to get the list. Full details at https://github.com/firebase/firebase-ios-sdk/issues/4087
I have an iOS application that has many different configurations all under the same Xcode project. I am using Targets to achieve this. My application utilizes Cordova. I am wondering if it is possible/best way to access Xcode variables within my Cordova config.xml file.
I am hoping to achieve having one shared config file with many targets in Xcode and when I select a target and build and run my variables for that target will be dynamically injected into my config.
Try to create 'Configuration Settings File' (.xcconfig) and configure variables from the info.plist with this pattern $(VARIABLE) and add into the .xcconfig file. This way you'll be able to set “Bundle Identifier”, “Bundle name”, “Bundle version” and other stuff you need to configure.
You may refer guide link to get more info: https://www.appcoda.com/xcconfig-guide/
Hope it helps!
I have an iOS app that uses Cocoapods, and has a local cocoa touch framework target, and I'm running into an issue with specifying build settings in the command line using xcodebuild.
I understand that you can specify build settings like PROVISIONING_PROFILE, CODE_SIGN_IDENTITY, and DEVELOPMENT_TEAM by appending their key=value pair to the end of the command.
However those setting appear to be applied to the entire project, but I only need them to apply to the app target since touch frameworks cannot be signed.
How do I specify build settings for an individual target using xcodebuild? If it cannot be done using xcodebuild, could this be accomplished using fastlane?
Use schemes. You can set the scheme to build/archive with a particular build configuration and executable.
I have an app that includes a Watch Extension and App target. I would to be able to have one of my configurations (for a beta) exclude these targets from the target dependencies so that I can distribute the build without the Watch Extension/App. However I still want my debug configuration to include them. Is this possible? Perhaps there is some run script that could add Target Dependencies manually? Thanks.
Duplicate your "Release" Configuration, that will include your Watch Extension. Here the official resource: https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/BasingBuildConfigurationsonConfigurationFiles.html
In this configuration.
Remove the WatchKit extension from Target Dependencies
Remove WatchKit extension from Embed App Extensions
Duplicate your main target and remove the dependencies from the copy. Then duplicate your scheme and set its target to your new target.
Another solution would be to wrap the build and embedding into a separate script and run it manually, you can see how cocoapods are doing that.