以下脚本是聚合目标构建阶段的一部分,该阶段用于将模拟器和设备目标组合到一个通用框架构建中。该构建源自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)中剥离它的过程:
1.在脚本中添加了echo
调用,以显示xcodebuild
的所有命令行输入。如您所见,此路径不是从命令行调用中输入的。
1.已清除所有目标(选择每个目标,产品-〉清除)。
1.已检查此框架项目中包含的所有文件-所有这些文件在检查器中都将location
设置为Relative to Project
。
1.已重新启动Xcode。
1.已重新启动Mac。
1.已检查项目包内容中的project.pbxproj
和所有其他XML文件-未找到绝对路径。
1.已在检查器中检查目标-其位置是绝对的(无法更改)并正确指向新路径(/Volumes/localmy-project/...
)
1.进入组织者,然后进入项目-〉我的项目-〉衍生数据-〉删除。
经过这一切,错误仍然存在。那么-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
- 更新2-现在有更多回音!**
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
仍然没有一个指向老路。
2条答案
按热度按时间bsxbgnwa1#
我遇到了这个问题,并通过在Xcode首选项中重置派生数据文件夹的位置来解决。设置后,我退出Xcode并再次重新启动。它解决了。
wribegjk2#
我仍然不知道这条老路是怎么走进来的,但我找到了一个适合我的变通方案:我可以通过以下方式使用
xcodebuild
强制正确的DerivedData路径(替换脚本中的旧调用):如果有人知道老路在哪里还能坚持下去,请告诉我。