diff --git a/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile b/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile index 13a5352e17..4f65f197a6 100644 --- a/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile +++ b/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -24,9 +24,11 @@ pipeline { } parameters { - string(name: 'BUNDLE_VERSION', defaultValue: '0.0.24dev', description: 'Bundle Version') + string(name: 'BUNDLE_VERSION', defaultValue: '0.0.26dev', description: 'Bundle Version') string(name: 'SVN_REV', defaultValue: 'HEAD', description: 'For instance 21000') booleanParam(name: 'ONLY_MOD', defaultValue: true, description: 'Only archive the mod mod.') + booleanParam(name: 'DO_GZIP', defaultValue: true, description: 'Create .gz unix tarballs as well as .xz') + booleanParam(name: 'FULL_REBUILD', defaultValue: true, description: 'Do a full rebuild (safer for release, slower).') } stages { @@ -37,45 +39,59 @@ pipeline { steps { script { try { - svn "https://svn.wildfiregames.com/public/ps/trunk@${params.SVN_REV}" + sh "svn co https://svn.wildfiregames.com/public/ps/trunk@${params.SVN_REV} ." } catch(e) { sh "svn cleanup" sleep 300 throw e } + sh "svn cleanup" + // Delete unknown files everywhere except libraries/ + sh "svn st --no-ignore . --depth immediates | cut -c 9- | xargs rm -rfv" + sh "svn st --no-ignore {binaries/,build/,source/} | cut -c 9- | xargs rm -rfv" + if (params.FULL_REBUILD) { + // Also delete libraries/ + sh "svn st --no-ignore | cut -c 9- | xargs rm -rfv" + } + sh "svn revert . -R" } - sh "svn cleanup" - sh "svn revert . -R" - sh "svn st --no-ignore | cut -c 9- | xargs rm -rfv" } } stage("Compile Mac Executable") { steps { - sh "source/tools/dist/build-osx-executable.sh" + sh "FULL_REBUILD=${params.FULL_REBUILD} source/tools/dist/build-osx-executable.sh" } } stage("Create archive data") { steps { - sh "ONLY_MOD=${ONLY_MOD} source/tools/dist/build-archives.sh" + sh "ONLY_MOD=${params.ONLY_MOD} source/tools/dist/build-archives.sh" } } stage("Create Mac Bundle") { steps { - sh "python3 source/tools/dist/build-osx-bundle.py ${BUNDLE_VERSION}" + sh "python3 source/tools/dist/build-osx-bundle.py ${params.BUNDLE_VERSION}" } } stage("Create Windows installer & *nix files") { steps { // The files created by the mac compilation need to be deleted - sh "svn st binaries/ --no-ignore | cut -c 9- | xargs rm -rf" - sh "svn st build/ --no-ignore | cut -c 9- | xargs rm -rf" - sh "svn st libraries/ --no-ignore | cut -c 9- | xargs rm -rf" + sh "svn st {binaries/,build/} --no-ignore | cut -c 9- | xargs rm -rfv" + // Hide the libraries folder. + sh "mv libraries/ temp_libraries/" + sh "svn revert libraries/ -R" // The generated tests use hardcoded paths so they must be deleted as well. sh 'python3 -c \"import glob; print(\\\" \\\".join(glob.glob(\\\"source/**/tests/**.cpp\\\", recursive=True)));\" | xargs rm -v' sh "svn revert build/ -R" - - // Then run the core object. - sh "BUNDLE_VERSION=${BUNDLE_VERSION} source/tools/dist/build-unix-win32.sh" + script { + try { + // Then run the core object. + sh "BUNDLE_VERSION=${params.BUNDLE_VERSION} DO_GZIP=${params.DO_GZIP} source/tools/dist/build-unix-win32.sh" + } finally { + // Un-hide the libraries. + sh "rm -rfv libraries/" + sh "mv temp_libraries/ libraries/" + } + } } } } diff --git a/source/tools/dist/build-osx-executable.sh b/source/tools/dist/build-osx-executable.sh index d045a87947..13a170c44b 100755 --- a/source/tools/dist/build-osx-executable.sh +++ b/source/tools/dist/build-osx-executable.sh @@ -24,8 +24,8 @@ if [ "`uname -s`" != "Darwin" ]; then fi # Check SDK exists -if [ ! -d "$SYSROOT" ]; then - die "$SYSROOT does not exist! You probably need to install Xcode" +if [ ! -d "${SYSROOT}" ]; then + die "${SYSROOT} does not exist! You probably need to install Xcode" fi # Assume this is called from trunk/ @@ -36,21 +36,32 @@ cd "build/workspaces/" JOBS=${JOBS:="-j5"} -# TODO: Do we really want to regenerate everything? (consider if one task fails) +# Toggle whether this is a full rebuild, including libraries (takes much longer). +FULL_REBUILD=${FULL_REBUILD:=false} -./clean-workspaces.sh +if $FULL_REBUILD = true; then + CLEAN_WORKSPACE_ARGS="" + BUILD_LIBS_ARGS="--force-rebuild" +else + CLEAN_WORKSPACE_ARGS="--preserve-libs" + BUILD_LIBS_ARGS="" +fi + +./clean-workspaces.sh "${CLEAN_WORKSPACE_ARGS}" # Build libraries against SDK echo "\nBuilding libraries\n" pushd ../../libraries/osx > /dev/null -./build-osx-libs.sh $JOBS --force-rebuild || die "Libraries build script failed" +SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \ + ./build-osx-libs.sh $JOBS "${BUILD_LIBS_ARGS}" || die "Libraries build script failed" popd > /dev/null # Update workspaces echo "\nGenerating workspaces\n" # Pass OS X options through to Premake -(SYSROOT="$SYSROOT" MIN_OSX_VERSION="$MIN_OSX_VERSION" ./update-workspaces.sh --sysroot="$SYSROOT" --macosx-version-min="$MIN_OSX_VERSION") || die "update-workspaces.sh failed!" +(SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \ + ./update-workspaces.sh --sysroot="${SYSROOT}" --macosx-version-min="${MIN_OSX_VERSION}") || die "update-workspaces.sh failed!" pushd gcc > /dev/null echo "\nBuilding game\n" diff --git a/source/tools/dist/build-unix-win32.sh b/source/tools/dist/build-unix-win32.sh index 58211d6e57..48388adf73 100755 --- a/source/tools/dist/build-unix-win32.sh +++ b/source/tools/dist/build-unix-win32.sh @@ -29,8 +29,11 @@ tar cf $PREFIX-unix-data.tar \ # Compress xz -kv ${XZOPTS} $PREFIX-unix-build.tar xz -kv ${XZOPTS} $PREFIX-unix-data.tar -7z a ${GZIP7ZOPTS} $PREFIX-unix-build.tar.gz $PREFIX-unix-build.tar -7z a ${GZIP7ZOPTS} $PREFIX-unix-data.tar.gz $PREFIX-unix-data.tar +DO_GZIP=${DO_GZIP:=true} +if $DO_GZIP = true; then + 7z a ${GZIP7ZOPTS} $PREFIX-unix-build.tar.gz $PREFIX-unix-build.tar + 7z a ${GZIP7ZOPTS} $PREFIX-unix-data.tar.gz $PREFIX-unix-data.tar +fi # Create Windows installer # This needs nsisbi for files > 2GB @@ -42,7 +45,12 @@ makensis -V4 -nocd \ source/tools/dist/0ad.nsi # Fix permissions -chmod -f 644 ${PREFIX}-{unix-{build,data}.tar.{xz,gz},win32.exe} +chmod -f 644 ${PREFIX}-{unix-{build,data}.tar.xz,win32.exe} # Print digests for copying into wiki page -shasum -a 1 ${PREFIX}-{unix-{build,data}.tar.{xz,gz},win32.exe} +shasum -a 1 ${PREFIX}-{unix-{build,data}.tar.xz,win32.exe} + +if $DO_GZIP = true; then + chmod -f 644 ${PREFIX}-unix-{build,data}.tar.gz + shasum -a 1 ${PREFIX}-unix-{build,data}.tar.gz +fi