Index: ps/trunk/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile =================================================================== --- ps/trunk/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile (revision 27632) +++ ps/trunk/build/jenkins/pipelines/macos-all-bundles.Jenkinsfile (revision 27633) @@ -1,108 +1,109 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * 0 A.D. is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with 0 A.D. If not, see . */ pipeline { agent { label 'MacSlave' } // Archive the installer for public download; keep only the latest one. options { buildDiscarder(logRotator(artifactNumToKeepStr: '1')) } parameters { - string(name: 'BUNDLE_VERSION', defaultValue: '0.0.26dev', description: 'Bundle Version') - string(name: 'SVN_REV', defaultValue: 'HEAD', description: 'For instance 21000') + string(name: 'BUNDLE_VERSION', defaultValue: '0.0.27dev', description: 'Bundle Version') + string(name: 'ENGINE_VERSION', defaultValue: '0.0.27', description: 'Engine Version') 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).') booleanParam(name: 'WINDOWS_UNIX', defaultValue: true, description: 'Build windows and unix bundles.') + booleanParam(name: 'BUILD_SHADERS', defaultValue: true, description: 'Build the spir-v shaders (very slow).') } stages { stage ("Checkout") { options { retry(3) } steps { script { try { 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" } } } stage("Compile Mac Executable") { steps { sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" FULL_REBUILD=${params.FULL_REBUILD} source/tools/dist/build-osx-executable.sh" } } stage("Create archive data") { steps { - sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" ONLY_MOD=${params.ONLY_MOD} source/tools/dist/build-archives.sh" + sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" ONLY_MOD=${params.ONLY_MOD} BUILD_SHADERS=${params.BUILD_SHADERS} ENGINE_VERSION=${params.ENGINE_VERSION} source/tools/dist/build-archives.sh" } } stage("Create Mac Bundle") { steps { sh "python3 source/tools/dist/build-osx-bundle.py ${params.BUNDLE_VERSION}" } } stage("Create Windows installer & *nix files") { steps { script { - if(params.WINDOWS_UNIX) - { - // The files created by the mac compilation need to be deleted - 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" - try { - // Then run the core object. - sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" 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/" - } - } + if(params.WINDOWS_UNIX) + { + // The files created by the mac compilation need to be deleted + 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" + try { + // Then run the core object. + sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" 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/" + } + } } } } } post { success { archiveArtifacts '*.dmg,*.exe,*.tar.gz,*.tar.xz' } } } Index: ps/trunk/source/tools/dist/build-archives.sh =================================================================== --- ps/trunk/source/tools/dist/build-archives.sh (revision 27632) +++ ps/trunk/source/tools/dist/build-archives.sh (revision 27633) @@ -1,51 +1,88 @@ #!/bin/bash set -e die() { echo ERROR: $* exit 1 } # Build the mod .zip using the pyrogenesis executable. # Assumes it is being run from trunk/ echo "Building archives" echo "Filtering languages" # Included languages # CJK languages are excluded, as they are in mods. # Note: Needs to be edited manually at each release. # Keep in sync with the installer languages in 0ad.nsi. LANGS=("ast" "ca" "cs" "de" "el" "en_GB" "es" "eu" "fi" "fr" "gd" "hu" "id" "it" "nl" "pl" "pt_BR" "ru" "sk" "sv" "tr" "uk") REGEX=$(printf "\|%s" "${LANGS[@]}") REGEX=".*/\("${REGEX:2}"\)\.[-A-Za-z0-9_.]\+\.po" find binaries/ -name "*.po" | grep -v "$REGEX" | xargs rm -v || die "Error filtering languages." # Build archive(s) - don't archive the _test.* mods pushd binaries/data/mods > /dev/null archives="" ONLY_MOD="${ONLY_MOD:=false}" if [ "${ONLY_MOD}" = true ]; then archives="mod" else for modname in [a-zA-Z0-9]* do archives="${archives} ${modname}" done fi popd > /dev/null +BUILD_SHADERS="${BUILD_SHADERS:=true}" +if [ "${BUILD_SHADERS}" = true ]; then + PYTHON=${PYTHON:=$(command -v python3 || command -v python)} + GLSLC=${GLSLC:=$(command -v glslc)} + SPIRV_REFLECT=${SPIRV_REFLECT:=$(command -v spirv-reflect)} + + [ -n "${PYTHON}" ] || die "Error: python is not available. Install it before proceeding." + [ -n "${GLSLC}" ] || die "Error: glslc is not available. Install it with the Vulkan SDK before proceeding." + [ -n "${SPIRV_REFLECT}" ] || die "Error: spirv-reflect is not available. Install it with the Vulkan SDK before proceeding." + + pushd "source/tools/spirv" > /dev/null + + ENGINE_VERSION=${ENGINE_VERSION:="0.0.xx"} + rulesFile="rules.${ENGINE_VERSION}.json" + + if [ ! -e "$rulesFile" ] + then + # The rules.json file should be present in release tarballs, for + # some Linux CIs don't have access to the internet. + download="$(command -v wget || echo "curl -sLo ""${rulesFile}""")" + $download "https://releases.wildfiregames.com/spir-v/$rulesFile" + fi + + for modname in $archives + do + modLocation="../../../binaries/data/mods/${modname}" + if [ -e "${modLocation}/shaders/spirv/" ] + then + echo "Removing existing spirv shaders for '${modname}'..." + rm -rf "${modLocation}/shaders/spirv" + fi + echo "Building shader for '${modname}'..." + $PYTHON compile.py "$modLocation" "$rulesFile" "$modLocation" --dependency "../../../binaries/data/mods/mod/" + done + popd > /dev/null +fi + for modname in $archives do - echo "\nBuilding archive for '${modname}'\n" + echo "Building archive for '${modname}'..." ARCHIVEBUILD_INPUT="binaries/data/mods/${modname}" ARCHIVEBUILD_OUTPUT="archives/${modname}" mkdir -p "${ARCHIVEBUILD_OUTPUT}" (./binaries/system/pyrogenesis -mod=mod -archivebuild="${ARCHIVEBUILD_INPUT}" -archivebuild-output="${ARCHIVEBUILD_OUTPUT}/${modname}.zip") || die "Archive build for '${modname}' failed!" cp "${ARCHIVEBUILD_INPUT}/mod.json" "${ARCHIVEBUILD_OUTPUT}" &> /dev/null || true done