zoukankan      html  css  js  c++  java
  • Xcode打包framework脚本

    参考文章:

    http://blog.csdn.net/liangliang2727/article/details/52941394

    http://www.jianshu.com/p/1cb4c4fe5481

    https://gist.github.com/cromandini/1a9c4aeab27ca84f5d79

    检测类库支持的版本:lipo -info ~/Documents/SFMapKit/Products/SFMapKit.framework/SFMapKit
     
    参考网上资料后,自己整合的脚本:
    #!/bin/sh
    
    OUTPUT_DIR=${BUILD_DIR}/${CONFIGURATION}-universal
    TARGET_DIR=${HOME}/Downloads
    
    # make sure the output directory exists
    mkdir -p "${OUTPUT_DIR}"
    
    # Step 1. Build Device and Simulator versions
    
    xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphoneos  ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" -arch armv7 -arch armv7s -arch arm64 clean build
    
    xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" -arch x86_64 clean build
    
    # Step 2. Copy the framework structure (from iphoneos build) to the universal folder
    cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${OUTPUT_DIR}/"
    
    # 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}" "${OUTPUT_DIR}/${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 "${OUTPUT_DIR}/${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 "${OUTPUT_DIR}/${PROJECT_NAME}.framework" "${TARGET_DIR}/"
    
    # Cleaning the oldest.
    if [ -d "${OUTPUT_DIR}" ]
    then
    rm -rf "${OUTPUT_DIR}"
    fi
    
    # Step 6. Convenience step to open the project's directory in Finder
    open "${TARGET_DIR}"
  • 相关阅读:
    011-iOS核心动画(Core Animation)
    010-CALayer(图层)
    009-手势触摸事件处理
    008-Quartz2D
    007-多控制器管理及其控制器间的数据传递
    007-多控制器管理(控制器间的数据传递)
    通过底层 socket 监控 http/https 思路
    NDK 线程同步
    时间同步算法探究
    Android 事件小结
  • 原文地址:https://www.cnblogs.com/duelsol/p/5113799.html
Copyright © 2011-2022 走看看