ios Xcode14.3中带有参数DSTROOT的xcodebuild错误

8yparm6h  于 2023-05-19  发布在  iOS
关注(0)|答案(1)|浏览(162)

我们有一个工具,它使用xcodebuild命令行工具在内部创建iPhone构建。在Xcode14.3发布之前一切都很好。下面是我的构建命令x1c 0d1x
它使用SYMROOT和DSTROOT参数将生成复制到项目中的特定位置。

buildOutput=$PWD"/"$relativePath"/output"
relativePath is actually the path towards my iOS project

所有其他参数均通过并正常工作。但是当我使用DSTROOT时,我得到以下错误
xcodebuild:错误:无法将“InstallationBuildProductsLocation”移动到“AdHoc 09-05-2023,4.26 pm 2.xcarchive”,因为前者不存在,或者包含后者的文件夹不存在。:无法完成操作。没有这样的文件或目录
下面是完整的错误堆栈

2023-05-09 16:26:55.609 xcodebuild[24614:1420687] Writing error result bundle to /var/folders/vt/bxdl1j6x111fjsjmw5r11s680000gn/T/ResultBundle_2023-09-05_4-26-0055 pm.xcresult
xcodebuild: error: “InstallationBuildProductsLocation” couldn’t be moved to “AdHoc 09-05-2023, 4.26 pm 2.xcarchive” because either the former doesn’t exist, or the folder containing the latter doesn’t exist.: The operation couldn’t be completed. No such file or directory

但令我惊讶的是,在output目录下,我可以看到.app生成的(output/Applications/myApp.app),我不确定为什么在这种情况下构建失败。由于失败,我无法继续进行构建脚本的下一步。有人能帮帮我吗?我花了很多时间,但无法找到这个问题背后的原因。请帮帮我

6jygbczu

6jygbczu1#

在我将系统更新到macOS 13.x和Xcode 14.x(从macOS 12.x和Xcode 13.x)之后,我开始从我的库构建脚本中收到完全相同的错误消息
通过反复试验,我得出结论,新的Xcode在归档我的库产品以供分发时,不再“喜欢”将SYMROOT和DSTROOT路径/内容与派生数据路径/内容分开。
对我有效的是开始使用derivedDataPatharchivePath,而不是SYMROOTDSTROOT
就像这样:

xcodebuild -workspace $product.xcworkspace -scheme $scheme -destination "generic/platform=iOS" clean archive -quiet ENABLE_BITCODE=NO OTHER_SWIFT_FLAGS='$(inherited) -D EXTERNAL' SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -derivedDataPath $(PWD)/tmp-derived-data -archivePath $(PWD)/tmp-derived-data/$productName
 if [[ $? == 0 ]]; then
     echo "Success"
 else
     echo "Failed"
     error_exit "Error: Exit code: $?"
 fi

我现在可以在与以前略有不同的位置找到构建的框架产品:

tmp-derived-data/$product.xcarchive/Products/Library/Frameworks/$productName.framework

也许这也能帮你解决问题。
这是我以前的:

xcodebuild -workspace $productName.xcworkspace -scheme $scheme -destination "generic/platform=iOS" clean archive -quiet SYMROOT=$(PWD)/tmp-build-symroot DSTROOT=$(PWD)/tmp-build-dstroot ENABLE_BITCODE=NO OTHER_SWIFT_FLAGS='$(inherited) -D EXTERNAL' SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

相关问题