Xcode 构建工作区并设置自定义构建路径 [英] Xcodebuild'ing a workspace and setting a custom build path

查看:29
本文介绍了Xcode 构建工作区并设置自定义构建路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 xcodebuild 在工作区中构建多项目项目.当 XCode 构建工作区时,它会自动将所有构建工件放在 DerivedData 中的一个公共目录中,以便每个项目都可以访问它的依赖项.

I'm trying to use xcodebuild to build a multi-project project in a workspace. When XCode builds a workspace it automatically places all build artifacts in a common directory in DerivedData so that each project can access it dependencies.

如果我使用这个命令:

xcodebuild -workspace myWorkspace.xcworkspace -schema builtIt -configuration Release

一切正常,但工件放置在通常的派生数据目录中.然后我希望出现在我可以从 CI 构建访问的特定目录中.所以我尝试了这个

Eveything works, but the artifacts are placed in usual derived data directory. I want then to appear in a specific directory which I can access from CI builds. So I tried this

xcodebuild -workspace myWorkspace.xcworkspace -schema builtIt -configuration Release SYMROOT=build/products OBJROOT=build/intermediates

但是 xcodebuild 失败了

However xcodebuild fails with this saying

Details:  Failed to load dependencies output contents from ``/Users/d4rkf1br3/projects/dNodi/build/intermediates/dNodi.build/Debug-iphoneos/dNodi.build/StaticAnalyzer/normal/armv7/DNRootSelector.d''. 
Error: Error Domain=NSCocoaErrorDomain Code=260 "The file "DNRootSelector.d" couldn’t be opened because there is no such file." 
UserInfo=0x4012fea40 {NSFilePath=/Users/d4rkf1br3/projects/dNodi/build/intermediates/dNodi.build/Debug-iphoneos/dNodi.build/StaticAnalyzer/normal/armv7/DNRootSelector.d, NSUnderlyingError=0x4012fc240 "The operation couldn’t be completed. No such file or directory"}. 
User info: {
    NSFilePath = "/Users/d4rkf1br3/projects/dNodi/build/intermediates/dNodi.build/Debug-iphoneos/dNodi.build/StaticAnalyzer/normal/armv7/DNRootSelector.d";
    NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}

问题似乎是 xcodebuild 不再为工作区中的所有项目使用中央目录,而是将工件存储在每个项目中.因此它无法定位正在编译的代码与其他项目中生成的工件之间的依赖关系.

The problem appears to be that xcodebuild is no longer using a central directory for all projects in the workspace and is storing the artifacts in each project instead. Hence it cannot locate the dependencies between code being compiled and artifacts produced in other projects.

有人知道在命令行上设置的正确参数吗?

Does anyone know the correct parameter to set on the command line?

Xcode 的 Build Setting Reference 已经两年没有更新了,所以不知道有没有新的构建设置可以应用.

Xcode's Build Setting Reference has not been updated for two years so I don't know if there are new build settings I can apply.

推荐答案

我不确定这是否是一个新选项,但 xcodebuild 的 5.0 版本有一个选项 -derivedDataPath 允许您指定所有构建产品所在的目录.

I'm not sure if this is a new option but the 5.0 release of xcodebuild has an option -derivedDataPath which allows you to specify the directory you'd like all the build products to sit in.

例如,传递 -derivedDataPath build 会创建相对于您运行 xcodebuild 的位置的文件夹 build,您可以预测地找到您的应用在像 build/Build/Products/Release-iphoneos 这样的子文件夹中.

For instance, passing -derivedDataPath build creates the folder build relative to where you ran xcodebuild from, and you can find your app predictably in a subfolder like build/Build/Products/Release-iphoneos.

文档:https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html

这篇关于Xcode 构建工作区并设置自定义构建路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆