针对模拟器和设备的Jenkins iOS版本

时间:2018-08-02 20:48:22

标签: ios jenkins build

让我首先说一下我知道如何手动创建胖子库,如这篇文章所述:How to build a library for both iPhone simulator and device?

我的问题是,有人知道如何配置Jenkins来完成相同的工作吗?

一点背景知识:我正在创建一个库,因此每次发布时,我都必须完成模拟器和设备的所有构建过程,然后进入各自的文件夹中以获取生成的框架,并使用lipo工具将它们在一起。

我能够通过脚本使集总过程自动化,所以我想知道是否可以使Jenkins自动化以输出两种体系结构类型的框架,然后调用然后调用此自定义脚本。

谢谢

1 个答案:

答案 0 :(得分:2)

您可以一个一个地构建它们。跟着,用lipo组合起来。

CURRENTPATH=`pwd`

xcodebuild -project ${PROJECT_NAME}.xcodeproj -configuration 
  ${CONFIGURATION} - 
  sdk iphoneos clean build ARCHS='armv7 armv7s' 
  IPHONEOS_DEPLOYMENT_TARGET='5.0' 
  TARGET_BUILD_DIR='./build-arm' BUILT_PRODUCTS_DIR='./build-arm'

 xcodebuild -project ${PROJECT_NAME}.xcodeproj -configuration ${CONFIGURATION} 
  -sdk iphoneos clean build ARCHS='arm64' IPHONEOS_DEPLOYMENT_TARGET='7.0' 
   TARGET_BUILD_DIR='./build-arm64' BUILT_PRODUCTS_DIR='./build-arm64'

xcodebuild -project ${PROJECT_NAME}.xcodeproj -configuration ${CONFIGURATION} - 
  sdk iphonesimulator clean build ARCHS='i386' IPHONEOS_DEPLOYMENT_TARGET='5.0' 
  TARGET_BUILD_DIR='./build-i386' BUILT_PRODUCTS_DIR='./build-i386'

xcodebuild -project ${PROJECT_NAME}.xcodeproj -configuration ${CONFIGURATION} - 
  sdk iphonesimulator clean build ARCHS='x86_64' VALID_ARCHS='x86_64' 
  IPHONEOS_DEPLOYMENT_TARGET='7.0' TARGET_BUILD_DIR='./build-x86_64' 
  BUILT_PRODUCTS_DIR='./build-x86_64'

cp -r "${CURRENTPATH}/build-arm64/include" "${CURRENTPATH}/build-universal"

lipo -create ./build-arm/lib${PROJECT_NAME}.a ./build- 
  arm64/lib${PROJECT_NAME}.a ./build-i386/lib${PROJECT_NAME}.a ./build- 
   x86_64/lib${PROJECT_NAME}.a -output ./build-universal/lib${PROJECT_NAME}.a

希望有帮助。