在命令行中清理 IOS xcode 目标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19091769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Clean IOS xcode target in command line
提问by clint
I am building/running an IOS app from command line with following commands:
我正在使用以下命令从命令行构建/运行 IOS 应用程序:
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.
是否有任何命令可以清理目标。或者这些命令负责清理自己。
回答by Oleg Shulakov
From xcodebuild manual page:
从 xcodebuild 手册页:
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):
和构建操作可以采用以下值(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 twobuild 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.
此命令行中有两个构建操作:“clean”和“build”。首先执行“清理”操作,然后执行“构建”。正如文档所述,您可以在一个命令中指定多个构建操作,这样做而不是使用单独的命令可确保所有构建操作的其他选项都相同。