Skip to content

Commit 1140130

Browse files
committed
[ci] Build iOS/Mac Mono sdks archive using Xcode 11
This was requested by the xamarin-macios team. (cherry picked from commit 6ad929c)
1 parent 10a24f3 commit 1140130

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

scripts/ci/pipeline/sdks-archive.groovy

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,57 @@
11
isPr = (env.ghprbPullId && !env.ghprbPullId.empty ? true : false)
22
monoBranch = (isPr ? "pr" : env.BRANCH_NAME)
33
jobName = env.JOB_NAME.split('/').first()
4-
xcode11 = (jobName == "archive-mono-xcode11" ? true : false)
5-
azureContainerName = (xcode11 ? "mono-sdks-xcode11" : "mono-sdks")
64

75
// compression is incompatible with JEP-210 right now
86
properties([/* compressBuildLog() */])
97

108
parallel (
119
"Android Darwin (Debug)": {
12-
if (xcode11) return
1310
throttle(['provisions-android-toolchain']) {
1411
node ("osx-devices") {
1512
archive ("android", "debug", "Darwin")
1613
}
1714
}
1815
},
1916
"Android Darwin (Release)": {
20-
if (xcode11) return
2117
throttle(['provisions-android-toolchain']) {
2218
node ("osx-devices") {
2319
archive ("android", "release", "Darwin")
2420
}
2521
}
2622
},
2723
"Android Windows (Release)": {
28-
if (xcode11) return
2924
throttle(['provisions-android-toolchain']) {
3025
node ("w64") {
3126
archive ("android", "release", "Windows")
3227
}
3328
}
3429
},
3530
"Android Linux (Debug)": {
36-
if (xcode11) return
3731
throttle(['provisions-android-toolchain']) {
3832
node ("debian-10-amd64-exclusive") {
3933
archive ("android", "debug", "Linux", "debian-10-amd64multiarchi386-preview", "g++-mingw-w64 gcc-mingw-w64 lib32stdc++6 lib32z1 libz-mingw-w64-dev linux-libc-dev:i386 zlib1g-dev zlib1g-dev:i386 zulu-8 rsync python3-pip", "/mnt/scratch")
4034
}
4135
}
4236
},
4337
"Android Linux (Release)": {
44-
if (xcode11) return
4538
throttle(['provisions-android-toolchain']) {
4639
node ("debian-10-amd64-exclusive") {
4740
archive ("android", "release", "Linux", "debian-10-amd64multiarchi386-preview", "g++-mingw-w64 gcc-mingw-w64 lib32stdc++6 lib32z1 libz-mingw-w64-dev linux-libc-dev:i386 zlib1g-dev zlib1g-dev:i386 zulu-8 rsync python3-pip", "/mnt/scratch")
4841
}
4942
}
5043
},
51-
"iOS": {
44+
"iOS (Xcode 11)": {
5245
throttle(['provisions-ios-toolchain']) {
53-
node (xcode11 ? "xcode11" : "osx-devices") {
54-
archive ("ios", "release", "Darwin")
46+
node ("xcode11") {
47+
archive ("ios", "release", "Darwin", "", "", "", "xcode11")
5548
}
5649
}
5750
},
58-
"Mac": {
51+
"Mac (Xcode 11)": {
5952
throttle(['provisions-mac-toolchain']) {
60-
node (xcode11 ? "xcode11" : "osx-devices") {
61-
archive ("mac", "release", "Darwin")
53+
node ("xcode11") {
54+
archive ("mac", "release", "Darwin", "", "", "", "xcode11")
6255
}
6356
}
6457
},
@@ -68,7 +61,6 @@ parallel (
6861
// tool on Linux. Since it isn't consumed by anyone from the 2019-06 branch,
6962
// let's just disable it.
7063

71-
// if (xcode11) return
7264
// throttle(['provisions-wasm-toolchain']) {
7365
// node ("ubuntu-1804-amd64") {
7466
// archive ("wasm", "release", "Linux", "ubuntu-1804-amd64-preview", "npm dotnet-sdk-2.1 nuget openjdk-8-jre python3-pip")
@@ -77,10 +69,14 @@ parallel (
7769
}
7870
)
7971

80-
def archive (product, configuration, platform, chrootname = "", chrootadditionalpackages = "", chrootBindMounts = "") {
72+
def archive (product, configuration, platform, chrootname = "", chrootadditionalpackages = "", chrootBindMounts = "", xcodeVersion = "") {
8173
def packageFileName = null
8274
def packageFileSha1 = null
8375
def commitHash = null
76+
def commitContext = (xcodeVersion == "" ? "Archive-${product}-${configuration}-${platform}" : "Archive-${product}-${configuration}-${platform}-${xcodeVersion}")
77+
def azureArtifactUrl = null
78+
def azureContainerName = "mono-sdks"
79+
def azureVirtualPath = null
8480
def utils = null
8581

8682
ws ("workspace/${jobName}/${monoBranch}/${product}/${configuration}") {
@@ -108,22 +104,22 @@ def archive (product, configuration, platform, chrootname = "", chrootadditional
108104
}
109105
try {
110106
stage('Build') {
111-
utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}${xcode11 ? '-xcode11' : ''}", env.BUILD_URL, 'PENDING', 'Building...')
107+
utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, commitContext, env.BUILD_URL, 'PENDING', 'Building...')
112108

113109
// build the Archive
114110
timeout (time: 300, unit: 'MINUTES') {
115111
if (platform == "Darwin") {
116112
def brewpackages = "autoconf automake ccache cmake coreutils gdk-pixbuf gettext glib gnu-sed gnu-tar intltool ios-deploy jpeg libffi libidn2 libpng libtiff libtool libunistring ninja openssl p7zip pcre pkg-config scons wget xz mingw-w64 make xamarin/xamarin-android-windeps/mingw-zlib"
117113
sh "brew tap xamarin/xamarin-android-windeps"
118114
sh "brew install ${brewpackages} || brew upgrade ${brewpackages}"
119-
sh "CI_TAGS=sdks-${product},no-tests,${configuration}${xcode11 ? ',xcode11' : ''} scripts/ci/run-jenkins.sh"
115+
sh "CI_TAGS=sdks-${product},no-tests,${configuration},${xcodeVersion} scripts/ci/run-jenkins.sh"
120116
} else if (platform == "Linux") {
121117
chroot chrootName: chrootname,
122118
command: "CI_TAGS=sdks-${product},no-tests,${configuration} ANDROID_TOOLCHAIN_DIR=/mnt/scratch/android-toolchain ANDROID_TOOLCHAIN_CACHE_DIR=/mnt/scratch/android-archives scripts/ci/run-jenkins.sh",
123119
bindMounts: chrootBindMounts,
124120
additionalPackages: "xvfb xauth mono-devel git python wget bc build-essential libtool autoconf automake gettext iputils-ping cmake lsof libkrb5-dev curl p7zip-full ninja-build zip unzip gcc-multilib g++-multilib mingw-w64 binutils-mingw-w64 ${chrootadditionalpackages}"
125121
} else if (platform == "Windows") {
126-
sh "PATH=\"/usr/bin:/usr/local/bin:$PATH\" CI_TAGS=sdks-${product},win-amd64,no-tests,${configuration} scripts/ci/run-jenkins.sh"
122+
sh "PATH=\"/usr/bin:/usr/local/bin:$PATH\" CI_TAGS=sdks-${product},win-amd64,no-tests,${configuration},${xcodeVersion} scripts/ci/run-jenkins.sh"
127123
} else {
128124
throw new Exception("Unknown platform \"${platform}\"")
129125
}
@@ -134,12 +130,21 @@ def archive (product, configuration, platform, chrootname = "", chrootadditional
134130
// compute SHA1 of the Archive
135131
packageFileSha1 = sha1 (packageFileName)
136132
writeFile (file: "${packageFileName}.sha1", text: "${packageFileSha1}")
133+
134+
// include xcode version in virtual path if necessary
135+
if (xcodeVersion == "") {
136+
azureVirtualPath = ""
137+
azureArtifactUrl = "https://xamjenkinsartifact.azureedge.net/${azureContainerName}/${packageFileName}"
138+
} else {
139+
azureVirtualPath = "${xcodeVersion}-" + readFile ("xcode_version.txt")
140+
azureArtifactUrl = "https://xamjenkinsartifact.azureedge.net/${azureContainerName}/${azureVirtualPath}/${packageFileName}"
141+
}
137142
}
138143
stage('Upload Archive to Azure') {
139144
azureUpload(storageCredentialId: "fbd29020e8166fbede5518e038544343",
140145
storageType: "blobstorage",
141146
containerName: azureContainerName,
142-
virtualPath: "",
147+
virtualPath: azureVirtualPath,
143148
filesPath: "${packageFileName},${packageFileName}.sha1",
144149
allowAnonymousAccess: true,
145150
pubAccessible: true,
@@ -149,10 +154,10 @@ def archive (product, configuration, platform, chrootname = "", chrootadditional
149154

150155
sh 'git clean -xdff'
151156

152-
utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}${xcode11 ? '-xcode11' : ''}", "https://xamjenkinsartifact.azureedge.net/${azureContainerName}/${packageFileName}", 'SUCCESS', packageFileName)
157+
utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, commitContext, azureArtifactUrl, 'SUCCESS', packageFileName)
153158
}
154159
catch (Exception e) {
155-
utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}${xcode11 ? '-xcode11' : ''}", env.BUILD_URL, 'FAILURE', "Build failed.")
160+
utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, commitContext, env.BUILD_URL, 'FAILURE', "Build failed.")
156161
throw e
157162
}
158163
}

scripts/ci/run-jenkins.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fi
132132

133133
if [[ ${CI_TAGS} == *'sdks-ios'* ]];
134134
then
135-
# configuration on our bots: https://github.com/mono/mono/pull/11691#issuecomment-439178459
135+
# configuration on our bots
136136
if [[ ${CI_TAGS} == *'xcode11'* ]]; then
137137
export XCODE_DIR=/Applications/Xcode11.app/Contents/Developer
138138
export XCODE32_DIR=/Applications/Xcode94.app/Contents/Developer
@@ -151,6 +151,9 @@ if [[ ${CI_TAGS} == *'sdks-ios'* ]];
151151
export WATCHOS64_32_VERSION=5.1
152152
fi
153153

154+
# retrieve selected Xcode version
155+
/usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' ${XCODE_DIR}/../version.plist > xcode_version.txt
156+
154157
# make sure we embed the correct path into the PDBs
155158
export MONOTOUCH_MCS_FLAGS=-pathmap:${MONO_REPO_ROOT}/=/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/
156159

@@ -194,7 +197,7 @@ fi
194197

195198
if [[ ${CI_TAGS} == *'sdks-mac'* ]];
196199
then
197-
# configuration on our bots: https://github.com/mono/mono/pull/11691#issuecomment-439178459
200+
# configuration on our bots
198201
if [[ ${CI_TAGS} == *'xcode11'* ]]; then
199202
export XCODE_DIR=/Applications/Xcode11.app/Contents/Developer
200203
export XCODE32_DIR=/Applications/Xcode94.app/Contents/Developer
@@ -205,6 +208,9 @@ then
205208
export MACOS_VERSION=10.14
206209
fi
207210

211+
# retrieve selected Xcode version
212+
/usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' ${XCODE_DIR}/../version.plist > xcode_version.txt
213+
208214
# make sure we embed the correct path into the PDBs
209215
export XAMMAC_MCS_FLAGS=-pathmap:${MONO_REPO_ROOT}/=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/
210216

0 commit comments

Comments
 (0)