以下脚本是聚合目标构建阶段的一部分,该阶段应该用于将模拟器和设备目标组合到一个通用框架构建中。构建源自this SO answer。
set -e
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework"
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal"
FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework"
######################
# Build Frameworks
######################
echo "PROJECT_NAME: ${PROJECT_NAME}"
echo "CONFIGURATION: ${CONFIGURATION}"
echo "BUILD_DIR: ${BUILD_DIR}"
echo "SIMULATOR_LIBRARY_PATH: ${SIMULATOR_LIBRARY_PATH}"
echo "DEVICE_LIBRARY_PATH: ${DEVICE_LIBRARY_PATH}"
echo "UNIVERSAL_LIBRARY_DIR: ${UNIVERSAL_LIBRARY_DIR}"
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator
这是执行此脚本时遇到的第一个错误:
PROJECT_NAME: My-project_Framework
CONFIGURATION: Debug
BUILD_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products
SIMULATOR_LIBRARY_PATH: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_Framework.framework
DEVICE_LIBRARY_PATH: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos/My-project_Framework.framework
UNIVERSAL_LIBRARY_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneuniversal
Build settings from command line:
CONFIGURATION_BUILD_DIR = /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator
SDKROOT = iphonesimulator8.1
=== CLEAN TARGET My-project_Framework OF PROJECT My-project_Framework WITH CONFIGURATION Debug ===
Check dependencies
Create product structure
/bin/mkdir -p /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_iOS.framework
Clean.Remove clean /Volumes/local\ my-project/my-project/ios/Framework/build/My-project_Framework.build/Debug-iphonesimulator/My-project_Framework.build
builtin-rm -rf /Volumes/local\ my-project/my-project/ios/Framework/build/My-project_Framework.build/Debug-iphonesimulator/My-project_Framework.build
Clean.Remove clean /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_iOS.framework
builtin-rm -rf /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_iOS.framework
** CLEAN SUCCEEDED **
=== BUILD TARGET My-project_Framework OF PROJECT My-project_Framework WITH CONFIGURATION Debug ===
Check dependencies
error: Unable to create directory: /Volumes/local my-project/my-project/ios/Framework/build (Permission denied)
现在问题是
此挂载点/Volumes/local my-project
(带空格)已被替换 /Volumes/localmy-project
(没有空格)。然而,XCode似乎仍然在某个地方拥有旧路径。
以下是我尝试将其从XCode(版本6.1.1)中删除的内容:
echo
次调用,以显示xcodebuild
的所有命令行输入。正如您所看到的,此路径不是来自命令行调用。location
Relative to Project
。 project.pbxproj
以及项目包内容中找到的所有其他XML文件 - 找不到绝对路径。/Volumes/localmy-project/...
)毕竟,错误仍然存在。那么 - XCode到底是从哪里走过这条老路?
更新
我添加了以下echos
以根据@Louis Tur显示更多构建环境变量:
BUILT_PRODUCTS_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos
CACHE_ROOT: /var/folders/w1/v31fpgnd7sl0yp5ctqjgsxsh0000gn/C/com.apple.DeveloperTools/6.1.1-6A2008a/Xcode
CONFIGURATION_BUILD_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos
CONFIGURATION_TEMP_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-Project_Framework.build/Debug-iphoneos
SYMROOT: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products
Update2 - 现在有了更多的回声!
DEPLOYMENT_LOCATION: NO
DERIVED_FILE_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/DerivedSources
DSTROOT: /tmp/My-project_Framework.dst
INSTALL_DIR: /tmp/My-project_Framework.dst
INSTALL_PATH:
OBJECT_FILE_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/Objects
OBJECT_FILE_DIR_normal: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/Objects-normal
OBJECT_FILE_DIR_debug:
OBJROOT: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates
PROJECT_TEMP_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build
REZ_COLLECTOR_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/ResourceManagerResources
REZ_OBJECTS_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/ResourceManagerResources/Objects
SHARED_PRECOMPS_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/PrecompiledHeaders
SRCROOT: /Volumes/localmy-project/my-project/ios/Framework
TARGET_BUILD_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos
TARGET_TEMP_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build
然而,这些都没有指向旧路径。
答案 0 :(得分:1)
我遇到了这个问题,并通过在Xcode首选项中重置Derived数据文件夹的位置来解决。 设置完成后,我退出Xcode并重新启动。它解决了。
答案 1 :(得分:0)
我仍然不知道旧的路径是如何进入的,但我找到了一个适用于我的解决方法:我可以通过以下方式使用xcodebuild
来强制使用正确的DerivedData路径(这取代了脚本中的旧调用):
xcodebuild -scheme ${PROJECT_NAME} -derivedDataPath ${BUILD_DIR}/../../ -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator
xcodebuild -scheme ${PROJECT_NAME} -derivedDataPath ${BUILD_DIR}/../../ -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos
如果有人知道旧路仍然存在,请告诉我。