用于更改 Xcode DerivedData 位置的命令行选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33044633/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:01:38  来源:igfitidea点击:

Command line option to change Xcode DerivedData location

xcodexcodebuild

提问by Neo

I know the way to change the location of DerivedDatausing Xcode (Preferences->Locations->DerivedData..).

我知道更改DerivedData使用 Xcode位置的方法(Preferences->Locations->DerivedData..)。

However the Mac that I am trying to build on is in a remote location with only ssh access. I want to build a specific project where I want to keep the DerivedData location relative to the project.

但是,我尝试构建的 Mac 位于仅具有 ssh 访问权限的远程位置。我想构建一个特定的项目,我想在其中保留 DerivedData 相对于项目的位置。

Whenever I build the project using xcodebuild, the files end up generating under /Users/builduser/Library/Developer/Xcode/DerivedDatahowever I want them under '$PROJECT/target/DerivedData'

每当我使用 构建项目时xcodebuild,文件最终都会/Users/builduser/Library/Developer/Xcode/DerivedData在“$PROJECT/target/DerivedData”下生成,但我希望它们在“$PROJECT/target/DerivedData”下

What is the command line equivalent to changing the DerivedData location setting as can be done via XCode?

与通过 XCode 更改 DerivedData 位置设置等效的命令行是什么?

回答by Bryan Musial

The Xcode UI's DerivedData setting is passed to xcodebuildvia the -derivedDataPathargument. From man xcodebuild:

Xcode UI 的 DerivedData 设置xcodebuild通过-derivedDataPath参数传递给。来自man xcodebuild

-derivedDataPath path
   Overrides the folder that should be used for derived data when performing a build action on a scheme in a workspace.

While it isn't clear what your goal is with changing the DerivedData path, you should be aware that there are some additional settings you can adjust in your app's build configuration to affect where the final build gets deployed. One of the phases of the build is the installphase which can move the final artifact(s) elsewhere. Settings that control these behaviors can be found under the 'Deployment' build settings group. See DSTROOT, INSTALL_PATH, and DEPLOYMENT_LOCATIONfor additional options that may be helpful for reorganizing where your products get deployed.

虽然不清楚更改 DerivedData 路径的目标是什么,但您应该知道,您可以在应用程序的构建配置中调整一些其他设置,以影响最终构建的部署位置。构建的阶段之一是install可以将最终工件移到别处的阶段。可以在“部署”构建设置组下找到控制这些行为的设置。有关可能有助于重新组织产品部署位置的其他选项,请参阅DSTROOTINSTALL_PATHDEPLOYMENT_LOCATION