From aee71d727995b4332d02f8e820ad3ad5ab04713c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Tue, 12 Jun 2018 10:55:10 +0200 Subject: [PATCH] NXDRIVE-1232: Split the macOS installer build to support macOS 10.11 --- docs/changes.md | 1 + docs/deployment.md | 1 + tools/jenkins/packages.groovy | 16 +++++++++++++++- tools/osx/deploy_jenkins_slave.sh | 29 ++++++++++++++++++++++------- tools/posix/deploy_jenkins_slave.sh | 14 +++++++++++++- 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/docs/changes.md b/docs/changes.md index 7054c7824c..fd38d5b62a 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -8,6 +8,7 @@ Release date: `2018-06-xx` ### Packaging / Build - [NXDRIVE-1226](https://jira.nuxeo.com/browse/NXDRIVE-1226): Deprecate macOS 10.10 (Yosemite) - [NXDRIVE-1229](https://jira.nuxeo.com/browse/NXDRIVE-1229): Do not install Drive in %APPDATA% but %LOCALAPPDATA% folder on Windows +- [NXDRIVE-1232](https://jira.nuxeo.com/browse/NXDRIVE-1232): Split the macOS installer build to support macOS 10.11 # 3.1.0 diff --git a/docs/deployment.md b/docs/deployment.md index 1491c37990..dabe7b5c20 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -17,6 +17,7 @@ Where `$OSI` is one of: `linux`, `osx`. Possible `ARG`: --build: freeze the client into self-hosted binary package + --build-ext: build the FinderSync extension (macOS only) --start: start Nuxeo Drive --tests: launch the tests suite diff --git a/tools/jenkins/packages.groovy b/tools/jenkins/packages.groovy index f9e82714c5..f8efd3de73 100644 --- a/tools/jenkins/packages.groovy +++ b/tools/jenkins/packages.groovy @@ -80,6 +80,20 @@ for (x in slaves) { } } + stage(osi + ' Extension') { + // Trigger the Drive extensions job to build extensions and have artifacts + if (osi == 'macOS') { + build job: 'Drive-extensions', parameters: [ + [$class: 'StringParameterValue', + name: 'BRANCH_NAME', + value: params.BRANCH_NAME]] + + dir('sources') { + step([$class: 'CopyArtifact', filter: 'extension.zip', projectName: 'Drive-extensions']) + } + } + } + stage(osi + ' Build') { dir('sources') { dir('build') { @@ -100,7 +114,7 @@ for (x in slaves) { } else if (osi == 'macOS') { def env_vars = [ 'SIGNING_ID=NUXEO CORP', - 'LOGIN_KEYCHAIN_PATH=/Users/jenkins/Library/Keychains/login.keychain-db', + "LOGIN_KEYCHAIN_PATH=${env.HOME}/Library/Keychains/login.keychain", ] withEnv(env_vars) { withCredentials([string(credentialsId: 'MOBILE_LOGIN_KEYCHAIN_PASSWORD', diff --git a/tools/osx/deploy_jenkins_slave.sh b/tools/osx/deploy_jenkins_slave.sh index 706e50d21f..be99e4b953 100755 --- a/tools/osx/deploy_jenkins_slave.sh +++ b/tools/osx/deploy_jenkins_slave.sh @@ -19,10 +19,29 @@ prepare_signing() { echo ">>> [sign] Unlocking the Nuxeo keychain" security unlock-keychain -p "${LOGIN_KEYCHAIN_PASSWORD}" "${LOGIN_KEYCHAIN_PATH}" - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${LOGIN_KEYCHAIN_PASSWORD}" "${LOGIN_KEYCHAIN_PATH}" + # set-key-partition-list was added in Sierra (macOS 10.12) + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${LOGIN_KEYCHAIN_PASSWORD}" "${LOGIN_KEYCHAIN_PATH}" || true security set-keychain-settings "${LOGIN_KEYCHAIN_PATH}" } +build_extension() { + # Create the FinderSync extension, if not already done + local extension_path="${WORKSPACE_DRIVE}/tools/osx/drive" + + if test -f "${WORKSPACE_DRIVE}/extension.zip"; then + # The extension has been unstashed from a specific job, just decompress it + echo ">>> [package] Decompressing the FinderSync extension" + unzip -o -d "${WORKSPACE_DRIVE}" "${WORKSPACE_DRIVE}/extension.zip" + rm -fv "${WORKSPACE_DRIVE}/extension.zip" + return + fi + + echo ">>> [package] Building the FinderSync extension" + xcodebuild -project "${extension_path}/drive.xcodeproj" -target "NuxeoFinderSync" -configuration Release build + mv -fv "${extension_path}/build/Release/NuxeoFinderSync.appex" "${WORKSPACE_DRIVE}/NuxeoFinderSync.appex" + rm -rf "${extension_path}/build" +} + create_package() { # Create the final DMG local app_name="Nuxeo Drive" @@ -40,13 +59,10 @@ create_package() { echo ">>> [package] Updating Info.plist" sed "s/\$version/${app_version}/" "${plist}" > "${pkg_path}/Contents/Info.plist" - echo ">>> [package] Building the FinderSync extension" - xcodebuild -project "${extension_path}/drive.xcodeproj" -target "NuxeoFinderSync" -configuration Release build - + build_extension echo ">>> [package] Adding the extension to the package" mkdir "${pkg_path}/Contents/PlugIns" - cp -a "${extension_path}/build/Release/NuxeoFinderSync.appex" "${pkg_path}/Contents/PlugIns/." - rm -rf "${extension_path}/build" + mv -fv "${WORKSPACE_DRIVE}/NuxeoFinderSync.appex" "${pkg_path}/Contents/PlugIns/." echo ">>> [package] Creating the DMG file" rm -fv ${output_dir}/*.dmg @@ -94,7 +110,6 @@ create_package() { # Clean tmp directories rm -rf "${src_folder_tmp}" "${dmg_tmp}" - if [ "${SIGNING_ID:=unset}" != "unset" ]; then codesign -vs "${SIGNING_ID}" "dist/nuxeo-drive-${app_version}.dmg" fi diff --git a/tools/posix/deploy_jenkins_slave.sh b/tools/posix/deploy_jenkins_slave.sh index ebe6de5e71..89bdc80a22 100755 --- a/tools/posix/deploy_jenkins_slave.sh +++ b/tools/posix/deploy_jenkins_slave.sh @@ -5,6 +5,7 @@ # # Possible ARG: # --build: build the package +# --build-ext: build the FinderSync extension (macOS only) # --start: start Nuxeo Drive # --tests: launch the tests suite # @@ -299,8 +300,19 @@ main() { # Adjust PATH for Mac [ "${OSI}" = "osx" ] && export PATH="$PATH:/usr/local/bin" - # Launch operations check_vars + + # The FinderSync extension build does not require extra setup + if [ $# -eq 1 ]; then + case "$1" in + "--build-ext") + build_extension + exit 0 + ;; + esac + fi + + # Launch operations install_pyenv install_python "${PYTHON_DRIVE_VERSION}" verify_python "${PYTHON_DRIVE_VERSION}"