Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clean IOS xcode target in command line

I am building/running an IOS app from command line with following commands:

xcodebuild  -sdk "${TARGET_SDK}" -xcconfig "${CONFIG_FILE_PATH}"  -configuration Release  /usr/bin/xcrun -sdk "${TARGET_SDK}" PackageApplication -v "${PROJECT_BUILD_DIR}/${APPLICATION_NAME}.app" -o "${OUTPUT_DIR}/${APPLICATION_NAME}.ipa" 

Is there any command to clean the targets. or these commands take care of cleaning themselves.

like image 938
clint Avatar asked Sep 30 '13 10:09

clint


People also ask

How do I clean up my Xcode build folder?

Clean the Build Folder To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder .

What is Xcodebuild command?

xcodebuild is a command-line tool that offers the ability to build and test your Xcode projects.

How do I rebuild in Xcode?

This can be achieved by going to Product > Clean Build Folder . Or by using the keyboard shortcut Cmd + Shift + K. Xcode will begin to clean your build folder - this might take a couple of minutes. Once it's completed, you can try running and building your project again.

What is target in IOS Xcode?

A Target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.


1 Answers

From xcodebuild manual page:

xcodebuild [-project projectname] [-target targetname ...] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...] 

and build action could take following values (UPD 13.08.2018):

action ...        Specify one or more actions to perform. Available actions are:         build                  Build the target in the build root (SYMROOT).  This is the default action, and                               is used if no action is given.         build-for-testing      Build the target and associated tests in the build root (SYMROOT).  This will                               also produce an xctestrun file in the build root. This requires specifying a                               scheme.         analyze                Build and analyze a target or scheme from the build root (SYMROOT).  This                               requires specifying a scheme.         archive                Archive a scheme from the build root (SYMROOT).  This requires specifying a                               scheme.         test                   Test a scheme from the build root (SYMROOT).  This requires specifying a                               scheme and optionally a destination.         test-without-building  Test compiled bundles. If a scheme is provided with -scheme then the command                               finds bundles in the build root (SRCROOT).  If an xctestrun file is provided                               with -xctestrun then the command finds bundles at paths specified in the                               xctestrun file.         install-src            Copy the source of the project to the source root (SRCROOT).         install                Build the target and install it into the target's installation directory in                               the distribution root (DSTROOT).         clean                  Remove build products and intermediate files from the build root (SYMROOT). 

In your case

xcodebuild  -sdk "${TARGET_SDK}" -xcconfig "${CONFIG_FILE_PATH}"  -configuration Release clean build 

There are two build actions in this command line: 'clean' and 'build'. The 'clean' action is performed first, then the 'build'. As the documentation states, you can specify multiple build actions in a command, and doing so rather than using separate commands ensures that the other options are the same for all the build actions.

like image 68
Oleg Shulakov Avatar answered Oct 21 '22 23:10

Oleg Shulakov