iOS Builds

References

Plugins

Plugins are the key to getting the most out of Jenkins. Here are some that we use:

  • XCode integration
  • Clang Scan-Build Plugin
  • GitHub plugin
  • Github Pull Request Builder
  • Jenkins IRC Plugin
  • Warnings Plug-in
  • Static Analysis Utilities

Jenkins Integration:

plugins require :

This plugin provides builders to build xcode projects, invoke agvtool and package .ipa files

Warning: This plugin requires dependent plugins that are built for Jenkins 1.609 or newer. The dependent plugins may or may not work in your Jenkins and consequently this plugin may or may not work in your Jenkins.

Checkout Source Code in git:

Available provisioning profiles

[abc] $ /usr/bin/security find-identity -p codesigning -v

1) ######################################## "iPhone Developer: (**********)"

2) ######################################## "iPhone Developer: CI Tools (**********)"

3) ######################################## "iPhone Developer: CI Tools (**********)"

3 valid identities found

Available SDKs

[abc] $ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild –showsdks

OS X SDKs:

OS X 10.11 -sdk macosx10.11

iOS SDKs:

iOS 9.3 -sdk iphoneos9.3

iOS Simulator SDKs:

Simulator - iOS 9.3 -sdk iphonesimulator9.3

tvOS SDKs:

tvOS 9.2 -sdk appletvos9.2

tvOS Simulator SDKs:

Simulator - tvOS 9.2 -sdk appletvsimulator9.2

watchOS SDKs:

watchOS 2.2 -sdk watchos2.2

watchOS Simulator SDKs:

Simulator - watchOS 2.2 -sdk watchsimulator2.2

Available schemes

[abc] $ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list -project abc.xcodeproj

Information about project "abc":

Targets:

abcDev

abcApplicationTests

abcApplicationBundle

abcIntegrationTests

Mogenerator

Appledoc

Presubmit

abcFileGenerator

Build Configurations:

Development

DevelopmentKIF

Developmentabc

AppStore

QA

If no build configuration is specified and -scheme is not passed then "Development" is used.

Schemes:

Appledoc

AppStore

Development

Developmentabc

IntegrationTests

Mogenerator

Presubmit

QA

abcApplicationTests

abcFileGenerator

======

Xcrun

xcodebuild -workspace MyAppName.xcworkspace -scheme QA clean build archive -archivePath ./MyAppNameQA.xcarchive

cp -rf /Users/abeadm/prd/MyAppName-gmqwvxiorltgfxctbpgxbkjzmnkq/Build/Products/AppStore-iphoneos/MyAppName.app .

xcrun -sdk iphoneos PackageApplication -v MyAppName.app -o MyAppName-2.3.0.ipa

##xcodebuild -workspace MyAppName.xcworkspace -scheme AppStore clean build archive -archivePath ./archive/MyAppName.xcarchive

##xcodebuild -workspace MyAppName.xcworkspace -scheme AppStore build

##cp -rf /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-gscckfxmliexjmfrmpjdnoxnglnl/Build/Products/AppStore-iphoneos/MyAppName.app .

##xcodebuild archive -archivePath ./archive/MyAppName.xcarchive -exportArchive -exportFormat IPA -exportPath ./archive/MyAppName.ipa -exportProvisioningProfile /jenkins/workspace/IOS/ios/MyAppName/Pods/Pods/MyAppName.app/embedded.mobileprovision

##export PROJECT_BUILDDIR ##= "/Users/abeadm/Desktop/jenkins/workspace/build/PRD/Build/Products/Release-iphoneos"

##APPLICATION_NAME="MyAppName-2.3.0-PRD"

##BUILD_HISTORY_DIR="/Users/abeadm/Provisioning/builds'

##PROVISIONING_PROFILE="/Users/abeadm/prd/ProvisioningMyAppNameUniversalPRD.mobileprovision"

##cp -rf /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-gscckfxmliexjmfrmpjdnoxnglnl/Build/Products/AppStore-iphoneos/MyAppName.app .

cd MyAppName

ls

##xcrun -sdk iphoneos PackageApplication -v MyAppName.app -o /Users/abeadm/Desktop/jenkins/workspace/ios_archive/MyAppName/MyAppName-2-3-PRD.ipa --embed "/Users/abeadm/prd/MyAppNameUniversalPRD.mobileprovision"

##xcodebuild archive -workspace MyAppName.xcworkspace -scheme AppStore -archivePath /Users/abeadm/Desktop/jenkins/workspace/ios_archive/MyAppName.xcarchive

##sleep 10

xcodebuild archive -archivePath "/Users/abeadm/Desktop/jenkins/workspace/ios_archive/MyAppName.xcarchive" -exportArchive -exportFormat IPA -exportPath "/Users/abeadm/Desktop/jenkins/workspace/ios_archive/MyAppName-skher-prd.ipa" exportProvisioningProfile "/Users/abeadm/Desktop/jenkins/prd/MyAppNameUniversalPRD.mobileprovision"

Provisioning Profile

PROVISIONING_PROFILE="/Users/abeadm/Desktop/jenkins/prd/MY_Mobile_Uiversal_Tablet_3T4HJTHB37.mobileprovision"

xcodebuild -workspace MyAppName.xcworkspace -configuration QA -scheme QA clean build archive -archivePath ./archive/MyAppName.xcarchive

##PROVISIONING_PROFILE="/Users/abeadm/Desktop/jenkins/prd/MY_Mobile_Uiversal_Tablet_3T4HJTHB37.mobileprovision"

xcodebuild -workspace MyAppName.xcworkspace -configuration AppStore -scheme AppStore clean build

xcodebuild -workspace MyAppName.xcworkspace -scheme AppStore build archive -archivePath ./MyAppName.xcarchive

##cp -rf /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-gscckfxmliexjmfrmpjdnoxnglnl/Build/Products/AppStore-iphoneos/MyAppName.app .

##cp -rf /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-grhfazimmfkvgqcoxwjyjlwbjady/Build/Products/AppStore-iphoneos/MyAppName.app .

cp -rf /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-gscckfxmliexjmfrmpjdnoxnglnl/Build/Products/AppStore-iphoneos/MyAppName.app .

xcodebuild -archivePath ./MyAppName.xcarchive -exportArchive -exportFormat IPA -exportPath ./MyAppName-2_3_0-PRD.ipa exportProvisioningProfile /Users/abeadm/Desktop/jenkins/prd/MyAppNameUniversalPRD.mobileprovision

Xcodebuild

Usage: xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...

xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...

xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...

xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]

xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]]

xcodebuild -showsdks

xcodebuild -exportArchive -archivePath <xcarchivepath> -exportPath <destinationpath> -exportOptionsPlist <plistpath>

xcodebuild -exportLocalizations -localizationPath <path> -project <projectname> [-exportLanguage <targetlanguage>...]

xcodebuild -importLocalizations -localizationPath <path> -project <projectname>

Options:

-usage print brief usage

-help print complete usage

-verbose provide additional status output

-license show the Xcode and SDK license agreements

-checkFirstLaunchStatus Check if any First Launch tasks need to be performed

-project NAME build the project NAME

-target NAME build the target NAME

-alltargets build all targets

-workspace NAME build the workspace NAME

-scheme NAME build the scheme NAME

-configuration NAME use the build configuration NAME for building each target

-xcconfig PATH apply the build settings defined in the file at PATH as overrides

-arch ARCH build each target for the architecture ARCH; this will override architectures defined in the project

-sdk SDK use SDK as the name or path of the base SDK when building the project

-toolchain NAME use the toolchain with identifier or name NAME

-destination DESTINATIONSPECIFIER use the destination described by DESTINATIONSPECIFIER (a comma-separated set of key=value pairs describing the destination to use)

-destination-timeout TIMEOUT wait for TIMEOUT seconds while searching for the destination device

-parallelizeTargets build independent targets in parallel

-jobs NUMBER specify the maximum number of concurrent build operations

-dry-run do everything except actually running the commands

-hideShellScriptEnvironment don't show shell script environment variables in build log

-showsdks display a compact list of the installed SDKs

-showBuildSettings display a list of build settings and values

-list lists the targets and configurations in a project, or the schemes in a workspace

-find-executable NAME display the full path to executable NAME in the provided SDK and toolchain

-find-library NAME display the full path to library NAME in the provided SDK and toolchain

-version display the version of Xcode; with -sdk will display info about one or all installed SDKs

-enableAddressSanitizer YES|NO turn the address sanitizer on or off when testing

-resultBundlePath PATH specifies the directory where a result bundle describing what occurred will be placed

-derivedDataPath PATH specifies the directory where build products and other derived data will go

-archivePath PATH specifies the directory where any created archives will be placed, or the archive that should be exported

-exportArchive specifies that an archive should be exported

-exportOptionsPlist PATH specifies a path to a plist file that configures archive exporting

-enableCodeCoverage YES|NO turn code coverage on or off when testing

-exportPath PATH specifies the destination for the product exported from an archive

-skipUnavailableActions specifies that scheme actions that cannot be performed should be skipped instead of causing a failure

-exportLocalizations exports completed and outstanding project localizations

-importLocalizations imports localizations for a project, assuming any necessary localized resources have been created in Xcode

-localizationPath specifies a path to XLIFF localization files

-exportLanguage specifies multiple optional ISO 639-1 languages included in a localization export

Finished: SUCCESS

Plist

ProcessInfoPlistFile /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-ersjcmvwbtkkxwdzwjltfuubxltn/Build/Products/AppStore-iphoneos/MyAppName.app/Info.plist Classes/MyAppName-Info.plist

Generate DSYM file

GenerateDSYMFile /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-ersjcmvwbtkkxwdzwjltfuubxltn/Build/Products/AppStore-iphoneos/MyAppName.app.dSYM /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-ersjcmvwbtkkxwdzwjltfuubxltn/Build/Products/AppStore-iphoneos/MyAppName.app/MyAppName

LinkStoryboards

PhaseScriptExecution Run\ Script

PhaseScriptExecution ?\ Embed\ Pods\ Frameworks

PhaseScriptExecution ?\ Copy\ Pods\ Resources

ProcessProductPackaging /Users/abeadm/Library/MobileDevice/Provisioning\ Profiles/3ede0ede-38a2-4c5c-afc3-c0e14abf6717.mobileprovision /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-ersjcmvwbtkkxwdzwjltfuubxltn/Build/Products/AppStore-iphoneos/MyAppName.app/embedded.mobileprovision

CopySwiftLibs /Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-ersjcmvwbtkkxwdzwjltfuubxltn/Build/Products/AppStore-iphoneos/MyAppName.app

Codesign

/usr/bin/xcrun '--toolchain' '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain' 'codesign' '--force' '--sign' '2AA8A3A703CDC123C935B57FA4EB1F7F26DC24C5' '--verbose' '/Users/abeadm/Library/Developer/Xcode/DerivedData/MyAppName-ersjcmvwbtkkxwdzwjltfuubxltn/Build/Products/AppStore-iphoneos/MyAppName.app/Frameworks/libswiftCore.dylib'

iOS Devices

Available destinations for the "QA" scheme:

{ platform:iOS Simulator, id:C547623E-7AEE-4629-8DBB-73DD07B44546, OS:9.3, name:iPad 2 }

{ platform:iOS Simulator, id:CCAEF347-1C8D-410F-A308-872D0E39F745, OS:9.3, name:iPad Air }

{ platform:iOS Simulator, id:75A6C23E-9655-47BD-A52B-88BC5B015934, OS:9.3, name:iPad Air 2 }

{ platform:iOS Simulator, id:757D5B15-5ADB-4260-91CF-8B251592689A, OS:9.3, name:iPad Pro }

{ platform:iOS Simulator, id:A9354C19-60EA-4841-8E08-98C49A47006C, OS:9.3, name:iPad Retina }

{ platform:iOS Simulator, id:ED4B76B0-DDB1-4302-903C-FA339B53E7A7, OS:9.3, name:iPhone 4s }

{ platform:iOS Simulator, id:FDEF3288-29C1-4A75-ADF5-2E667DF134E8, OS:9.3, name:iPhone 5 }

{ platform:iOS Simulator, id:B8B73E69-C7F7-4DAA-94FF-399FB8C134D9, OS:9.3, name:iPhone 5s }

{ platform:iOS Simulator, id:5E3BC4DA-F4A0-42F1-8316-24BCF280EE31, OS:9.3, name:iPhone 6 }

{ platform:iOS Simulator, id:B09348B3-99F2-4951-A982-F9BFFB107BF8, OS:9.3, name:iPhone 6 Plus }

{ platform:iOS Simulator, id:DC91C1E9-75D1-4A69-A68A-91DD3F55748E, OS:9.3, name:iPhone 6s }

{ platform:iOS Simulator, id:7D5FD287-36F5-46CC-836E-66CAB300D82A, OS:9.3, name:iPhone 6s Plus }

Finished: SUCCESS

Plugins:

Static Analysis

Post-Build Publishing