Guest User

Untitled

a guest
May 30th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
  4.  
  5. # make sure the output directory exists
  6. mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
  7.  
  8. # Step 1. Build Device and Simulator versions
  9. xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
  10. xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
  11.  
  12. # Step 2. Copy the framework structure (from iphoneos build) to the universal folder
  13. cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
  14.  
  15. # Step 3. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory
  16. SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/."
  17. if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then
  18. cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule"
  19. fi
  20.  
  21. # Step 4. Create universal binary file using lipo and place the combined executable in the copied framework directory
  22. 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}"
  23.  
  24. # Step 5. Convenience step to copy the framework to the project's directory
  25. cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}"
  26.  
  27. # Step 6. Convenience step to open the project's directory in Finder
  28. open "${PROJECT_DIR}"
Add Comment
Please, Sign In to add comment