美文网首页
iOS 打包framework 自动合成真机和测试机的aggre

iOS 打包framework 自动合成真机和测试机的aggre

作者: 不说谎的匹诺曹Y | 来源:发表于2018-01-31 15:04 被阅读0次

    # Constants

    SF_TARGET_NAME="TXGame"

    #自定义的用来存放最后合并的framework

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

    #IPHONE_DEVICE_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos

    WORKSPACE_NAME=${PROJECT_NAME}.xcworkspace

    YO_SCHEME=${PROJECT_NAME}

    xcodebuild -workspace ${WORKSPACE_NAME} -scheme ${YO_SCHEME} -sdk iphonesimulator -configuration "${CONFIGURATION}"

    xcodebuild -workspace ${WORKSPACE_NAME} -scheme ${YO_SCHEME} -sdk iphoneos -configuration "${CONFIGURATION}"

    # Build the other (non-simulator) platform

    #xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk iphoneos BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" CONFIGURATION_BUILD_DIR="${IPHONE_DEVICE_BUILD_DIR}/arm64" SYMROOT="${SYMROOT}" ARCHS='arm64' VALID_ARCHS='arm64' $ACTION

    #xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk iphoneos BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}"  CONFIGURATION_BUILD_DIR="${IPHONE_DEVICE_BUILD_DIR}/armv7" SYMROOT="${SYMROOT}" ARCHS='armv7 armv7s' VALID_ARCHS='armv7 armv7s' $ACTION

    # Copy the framework structure to the universal folder (clean it first)

    # 因为framework的合并,lipo只是合并了最后的 二进制可执行文件,所以其它的需要我们自己复制过来

    rm -rf "${UNIVERSAL_OUTPUTFOLDER}"

    mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

    cp -R "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework"

    # 合并模拟器和真机的架构

    lipo -create  "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}"

    open "${UNIVERSAL_OUTPUTFOLDER}"

    相关文章

      网友评论

          本文标题:iOS 打包framework 自动合成真机和测试机的aggre

          本文链接:https://www.haomeiwen.com/subject/ugzkzxtx.html