Clean IOS xcode target in command line
Asked Answered
P

2

34

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.

Passion answered 30/9, 2013 at 10:22 Comment(0)
C
61

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.

Cardiganshire answered 30/9, 2013 at 10:48 Comment(0)
K
-3

You can just delete build folder:

rm -rf ./build
Ketti answered 11/12, 2020 at 18:6 Comment(2)
That is a custom setup you are talking aboutRoderic
I had the same build folder in a react-native app and then xcodebuild clean workedLes

© 2022 - 2024 — McMap. All rights reserved.