2016-07-13 5 views
1

iosダイナミックライブラリを作成しようとしています。このライブラリには、cocoapods.Iを使ってインストールされた多くの依存関係が含まれています。私はそれがすべてのアーキテクチャで動作する必要があり、したがって、集約ターゲットを作成する必要があります。私はdoesntを持っていない集計ターゲットのスクリプトは、cocoapodsの依存関係が含まれています私は集計をコンパイルします。依存関係のファイルのようなエラーが見つかりません。フォローは私が使用しているスクリプトです。私が代わりにプロジェクトを使用しての我々はしかし依存関係をcocoapodsとして含む動的ライブラリの集約ターゲットを構築する方法

xcrun xcodebuild ONLY_ACTIVE_ARCH=NO -workspace "${PROJECT_DIR}/${PROJECT_NAME}.xcworkspace" -scheme "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION 

このもdoesntの仕事で

# Build the other platform. 
xcrun xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION 

を交換することにより、ワークスペースを構築する必要があることがわかったhttps://github.com/jverkoey/iOS-Framework/#developing-the-framework-as-a-dependent-project

他のブログで

# Merge Script 

# 1 
# Set bash script to exit immediately if any commands fail. 
set -e 

# 2 
# Setup some constants for use later on. 
FRAMEWORK_NAME="MyProject" 

# 3 
# If remnants from a previous build exist, delete them. 
if [ -d "${SRCROOT}/build" ]; then 
rm -rf "${SRCROOT}/build" 
fi 

# 4 
# Build the framework for device and for simulator (using 
# all needed architectures). 


xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch arm64 -arch armv7 -arch armv7s only_active_arch=no defines_module=yes -sdk "iphoneos" 
xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch x86_64 -arch i386 only_active_arch=no defines_module=yes -sdk "iphonesimulator" 

# 5 
# Remove .framework file if exists on Desktop from previous run. 
if [ -d "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" ]; then 
rm -rf "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" 
fi 

# 6 
# Copy the device version of framework to Desktop. 
cp -r "${SRCROOT}/build/Release-iphoneos/${FRAMEWORK_NAME}.framework" "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" 

# 7 
# Replace the framework executable within the framework with 
# a new version created by merging the device and simulator 
# frameworks' executables with lipo. 
lipo -create -output "${HOME}/Desktop/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" "${SRCROOT}/build/Release-iphoneos/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" "${SRCROOT}/build/Release-iphonesimulator/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" 

# 8 
# Copy the Swift module mappings for the simulator into the 
# framework. The device mappings already exist from step 6. 
cp -r "${SRCROOT}/build/Release-iphonesimulator/${FRAMEWORK_NAME}.framework/Modules/${FRAMEWORK_NAME}.swiftmodule/" "${HOME}/Desktop/${FRAMEWORK_NAME}.framework/Modules/${FRAMEWORK_NAME}.swiftmodule" 

# 9 
# Delete the most recent build. 
if [ -d "${SRCROOT}/build" ]; then 
rm -rf "${SRCROOT}/build" 
fi 

私のために、そしてエラーを投げている。あなたのために集計を構築する正しい方法は何ですか?依存関係を持つプロジェクト?

答えて

6

次のスクリプトで動作しました。

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal 

# make sure the output directory exists 
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" 

# Step 1. Build Device and Simulator versions 
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build 
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build 

# Step 2. Copy the framework structure (from iphoneos build) to the universal folder 
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" 

# Step 3. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory 
SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/." 
if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then 
cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule" 
fi 

# Step 4. Create universal binary file using lipo and place the combined executable in the copied framework directory 
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" 

# Step 5. Convenience step to copy the framework to the project's directory 
cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}" 

# Step 6. Convenience step to open the project's directory in Finder 
open "${PROJECT_DIR}" 
+0

戻ってきてくれてありがとう!多くの助けを借りて – kgaidis

関連する問題