what's the default scheme in xcodebuild? - xcode

When I run xcodebuild -list, I will get
Targets:
iKM
iKMTests
dailybuildipa
Build Configurations:
Debug
Release
DailyBuild
If no build configuration is specified and -scheme is not passed then "Release" is used.
Schemes:
dailybuildipa
DemoApp
Documentation
but in practice ,I did not set specific scheme in my build command(because i did not use workspace for building)
xcodebuild -target dailybuildipa -configuration DailyBuild -sdk iphoneos12.2
so in this situation, which scheme the xcodebuild will use as default scheme?
or it's because xcodebuild can build without any scheme?

Related

How to: `xcodebuild -xcworkspace..` with project and swift packages

I have created a xcworkspace to add my iOS.xcproj and local swift package. The workspace builds and runs great from Xcode. What would be the xcodebuild command to do in my CI?
I have been trying using the following:
xcodebuild -workspace [name].xcworkspace -scheme [scheme_name] -configuration [config] -xcconfig [path_xcconfig]
I get this in the output console:
...note: Building targets in dependency order
error: Multiple commands produce <RegisterExecutionPolicyException...
sample:
note: Target 'Firebase_FirebaseInAppMessaging_iOS' (project 'Firebase'): Touch /Users...

Inject provisioning profile name with xcodebuild command

We are using a manual signing strategy for our iOS app. Our CI/CD pipeline is set up on Jenkins and we need to build the app using the xcodebuild command. We are using the following command to archive the app.
xcodebuild -scheme Integration -xcconfig Integration.xcconfig -configuration Debug clean archive -archivePath build/app -destination generic/platform=iOS
When we archive the app using the above command, it always fails on the below error. I would like to know how to pass the provisioning profile name with the above xcodebuild command.
I was able to find the solution. It can be done by using:
xcodebuild -scheme Integration -xcconfig Integration.xcconfig -configuration Debug clean archive -archivePath build/app -destination generic/platform=iOS PROVISIONING_PROFILE="[Your profile Unique ID here]"

How do I change the XCode build location to Legacy using the console?

Ok, so I know how to change XCode build setting to Legacy using the UI shown below.
But how do I build an app from the console using that Legacy setting? I think it has something to do with the command xcodebuild -derivedDataPath <path>. But how do I set it to legacy?
There is no Legacy setting from xcodebuild, although you could use CONFIGURATION_BUILD_DIR to change the default build path:
xcodebuild -project 'MyProject.xcodeproj' \
-configuration 'Release' \
-sdk macosx10.10 CONFIGURATION_BUILD_DIR=/Path/To/Build/Release
If you wanted to build a Debug version just change the configuration flag. If the path is a nonexistent directory xcodebuild should create it automatically.

Running Xcode target from command line

I am new to running unit tests using Catch.
I am using the Catch to run unit tests in my Xcode project. I have added a target to my project which includes my Catch files and tests cases. Selecting that target and running from Xcode runs fine. I am now trying to get it to run from the command line which will be the way it is run from Jenkins. I have a shell script that contains:
xcodebuild clean install
xcodebuild -target TestApp -configuration “Debug” -sdk iphonesimulator7.1 CONFIGURATION_BUILD_DIR=TestBuild ONLY_ACTIVE_ARCH=NO
The result is:
** INSTALL SUCCEEDED **
Build settings from command line:
CONFIGURATION_BUILD_DIR = TestBuild
ONLY_ACTIVE_ARCH = NO
SDKROOT = iphonesimulator7.1
--- xcodebuild: WARNING: Configuration “Release” is not in the project. Building default configuration.
=== BUILD TARGET CreativeSDKTest OF PROJECT CreativeSDKImage WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
** BUILD SUCCEEDED **
But the application doesn’t launch in the simulator. Maybe I’m not seeing the obvious but from all the docs I’ve read, this should launch the application.
I think you'll need to tell xcodebuild to test the project:
xcodebuild clean install
xcodebuild -target TestApp -configuration “Debug” -sdk iphonesimulator7.1 CONFIGURATION_BUILD_DIR=TestBuild ONLY_ACTIVE_ARCH=NO clean test
(See the end of the last command)
EDIT: In fact you probably don't even need the first command and just the second will do.

TeamCity Xcode Build Runner Configuration (Command Line)

I'm trying to setup a continuous build server with TeamCity and configure it so it can run "xcodebuild -configuration release -sdk iphoneos3.0 clean build".
i installed the plugin for teamcity-xcode integration and for the 'Build Runner' settings, i set it up as
Build Runner: Command Line
Command Executable: xcodebuild -configuration release -sdk iphoneos3.0 clean build
--The error -> [11:52:29]: RunBuildException when running build stage CallRunnerStage: Cannot run process xcodebuild -configuration "Release" : file not found
[11:52:30]: Build finished
But when i set the 'Command Executable' to just "xcodebuild", it works just fine but i need it to build the release config.
Thanks in advance for the help.
use the field command parameters for the parameters.

Resources