是我误解了-derivedDataPath的功能,还是这是一个bug?您可以在输出中清楚地看到,xcodebuild忽略了命令行值,默认为Library/Developer/Xcode/DerivedData。
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project MyProj.xcodeproj -scheme “MyProj (iOS)" -destination "name=iPhone 12" -derivedDataPath=/Users/alpe77/myproj/MyProj/Build build
User defaults from command line:
derivedDataPath = /Users/alpe77/myproj/MyProj/Build
IDEPackageSupportUseBuiltinSCM = YES
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Using build description from disk
note: Build preparation complete
CodeSign /Users/alpe77/Library/Developer/Xcode/DerivedData/MyProj-aozsidihjyumkvevtfoqflhumohn/Build/Products/Debug-iphonesimulator/MyProj.app (in target 'MyProj (iOS)' from project 'MyProj')
cd /Users/alpe77/myproj/MyProj
export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: "-"
/usr/bin/codesign --force --sign - --entitlements
/Users/alpe77/Library/Developer/Xcode/DerivedData/MyProj-aozsidihjyumkvevtfoqflhumohn/Build/Intermediates.noindex/MyProj.build/Debug-iphonesimulator/MyProj\ \(iOS\).build/MyProj.app.xcent --timestamp\=none
/Users/alpe77/Library/Developer/Xcode/DerivedData/MyProj-aozsidihjyumkvevtfoqflhumohn/Build/Products/Debug-iphonesimulator/MyProj.app
/Users/alpe77/Library/Developer/Xcode/DerivedData/MyProj-aozsidihjyumkvevtfoqflhumohn/Build/Products/Debug-iphonesimulator/MyProj.app: replacing existing signature
** BUILD SUCCEEDED ** [0.771 sec]
% xcrun xcodebuild -version
Xcode 12.5.1
Build version 12E507发布于 2021-10-20 12:32:43
我遇到了同样的问题(Xcode12.4),并发现构建环境配置变量CONFIGURATION_BUILD_DIR覆盖了-derivedDataPath中给出的路径
我打开"Xcode首选项>位置>派生数据>高级“,并将构建位置设置从我的自定义设置更改为”唯一“,这解决了问题。
感兴趣的是如何防止CONFIGURATION_BUILD_DIR在命令行上覆盖-derivedDataPath ...
编辑
有关解决方案,请参阅https://stackoverflow.com/a/35662727/403750。
https://stackoverflow.com/questions/69397106
复制相似问题