From 124b35409706cc8847d2bdb01ecd8a98ecba1b55 Mon Sep 17 00:00:00 2001 From: rarified Date: Wed, 13 May 2020 14:19:49 -0600 Subject: [PATCH] Add Jenkinsfile for Pipeline builds. --- Jenkinsfile | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..9fbe69c7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,209 @@ +def Targets = ['Internal', 'External'] +def ToolSets = ['VS2003', 'VS2010' ] +def BaseDir = "MOULOpenSourceClientPlugin" +def PlasmaDir = "${BaseDir}\\Plasma20" + +def SCMBranches = [ + CWE: '*/master', + LOCALDATA: '*/rarified/vs-multitool' +] + +def ToolSetParams = [ + VS2003: [ + INIT: "C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat", + SLN: "${PlasmaDir}\\MsDevProjects\\Plasma\\Apps\\AllClient\\AllClient-ou.sln", + ARTIFACTDIR: "MsDevProjects", + ARTIFACTPATH: "${PlasmaDir}\\MsDevProjects", + SDKPATH: "${BaseDir}\\StaticSDKs", + CL: [ + Internal: "/DBUILD_TYPE=BUILD_TYPE_DEV /DNET_LOGGING=1 /DMINKATA_BUILD_NUMBER=${BUILD_NUMBER}", + External: "/DPLASMA_EXTERNAL_RELEASE /DBUILD_TYPE=BUILD_TYPE_LIVE /DMINKATA_BUILD_NUMBER=${BUILD_NUMBER}" + ], + CONF: [ + Internal: "Release", + External: "Release" + ] + ], + VS2010: [ + INIT: "C:\\Program Files\\Microsoft Visual Studio 10.0\\vc\\vcvarsall.bat", + SLN: "${PlasmaDir}\\MSVC10Projects\\Plasma\\Apps\\AllClient\\AllClient.sln", + ARTIFACTDIR: "MSVC10Projects", + ARTIFACTPATH: "${PlasmaDir}\\MSVC10Projects", + SDKPATH: "${BaseDir}\\StaticSDKs", + CL: [ + Internal: "/DBUILD_TYPE=BUILD_TYPE_DEV /DNET_LOGGING=1 /DMINKATA_BUILD_NUMBER=${BUILD_NUMBER}", + External: "/DPLASMA_EXTERNAL_RELEASE /DBUILD_TYPE=BUILD_TYPE_LIVE /DMINKATA_BUILD_NUMBER=${BUILD_NUMBER}" + ], + CONF: [ + Internal: "Release_Internal", + External: "Release" + ] + ] +] + +pipeline { + options { + timestamps() + } + + agent { node { label 'master' } } + + stages { + + // Assemble workspace on master node + stage('SCM') { + steps { + + // Main checkout + checkout scm: [$class: 'GitSCM', branches: [[name: SCMBranches['CWE']]], + extensions: [[$class: 'WipeWorkspace']], + userRemoteConfigs: [[credentialsId: '505fdcbf-cd4c-488b-95d9-2bf2cc346ced', + url: 'https://foundry.openuru.org/gitblit/r/CWE-ou-minkata']]] + + // Localdata checkout + checkout changelog: false, + poll: false, + scm: [$class: 'GitSCM', branches: [[name: SCMBranches['LOCALDATA']]], + extensions: [[$class: 'WipeWorkspace'], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'LocalData'], + [$class: 'CleanBeforeCheckout', deleteUntrackedNestedRepositories: true], + [$class: 'IgnoreNotifyCommit']], + userRemoteConfigs: [[credentialsId: '505fdcbf-cd4c-488b-95d9-2bf2cc346ced', + url: 'https://foundry.openuru.org/gitblit/r/Foundry/LocalData-CWE-ou']]] + + // Merge Localdata to correct place in main tree + sh label: 'Copy Repository StaticSDKs to VS2003 specific SDK directory for merge', + script: "cd ${BaseDir}; /opt/gnu/bin/cp -rp StaticSDKs StaticSDKs-VS2003" + sh label: 'Copy Repository StaticSDKs to VS2010 specific SDK directory for merge', + script: "cd ${BaseDir}; /opt/gnu/bin/mv StaticSDKs StaticSDKs-VS2010" + sh label: 'Merge LocalData', + script: "/opt/gnu/bin/cp -rlf LocalData/* ${BaseDir}/." + } + } + + // Patch for Minkata + stage ('Patch') { + steps { + sh script: '/opt/gnu/bin/patch -p1 --ignore-whitespace --remove-empty-files --verbose < LocalData/Minkata/minkata-local-000.patch.dos' + } + } + + // Stash workspace for copy to slave node(s) + stage ('Stash Initialized Workspace') { + steps { + stash name: 'CWE-ou Sources', + includes: "LICENSE.txt,*.bat,${BaseDir}/**", + excludes: '**/DX9.0c*/Developer*/**,**/DX9.0c*/Documentation/**,**/DX9.0c*/Samples/**,**/DX9.0c*/Utilities/**' + } + } + + // Compile on Windows node + stage ('Compile') { + matrix { + agent { node { label 'win2k3' } } + axes { + axis { + name 'ToolSet' + values 'VS2003', 'VS2010' + } + axis { + name 'BuildType' + values 'Internal', 'External' + } + } + + stages { + // set up workspace on slave + stage ('Unstash Workspace') { + steps { + withEnv([ + "ARTIFACTPATH=${ToolSetParams[ToolSet]['ARTIFACTPATH']}", + "BUILDSDKPATH=${BaseDir}\\StaticSDKs" + ]) { + bat script: "if exist %ARTIFACTPATH% rd /s/q %ARTIFACTPATH%" + unstash name: 'CWE-ou Sources' + bat script: "if exist %BUILDSDKPATH% rd /s/q %BUILDSDKPATH%" + } + } + } + + stage ('Customize for ToolSet') { + steps { + withEnv([ + "PATCHFILE_VS2010=${BaseDir}\\Minkata\\minkata-local-001.patch" + ]) { + bat script: "ren ${BaseDir}\\StaticSDKs-${ToolSet} StaticSDKs" + bat script: 'if %ToolSet%==VS2010 if exist "%PATCHFILE_VS2010%" "%PATCH_EXE%" -p1 --ignore-whitespace --binary --verbose < "%PATCHFILE_VS2010%"' + } + } + } + + stage ('Compile {ToolSet}x{BuildType}') { + steps { + logParser useProjectRule: false, + projectRulePath: 'cwe-log.rules', + parsingRulesPath: 'cwe-log.rules', + showGraphs: true + withEnv([ + "CL=${ToolSetParams[ToolSet]['CL'][BuildType]}", + "CONF=${ToolSetParams[ToolSet]['CONF'][BuildType]}", + "INIT=${ToolSetParams[ToolSet]['INIT']}", + "SLN=${ToolSetParams[ToolSet]['SLN']}", + ]) { + + bat script: ''' + call "%INIT%" + REM Prevent runaway VS2010 builds + set NUMBER_OF_PROCESSORS=2 + set + REM SET CL=%CL% /d1reportallclasslayout + devenv.com %SLN% /build %CONF% + ''' + } + } + } + // Stash cell-specific artifacts to merge for archival + stage ('Stash Artifacts') { + steps { + withEnv([ + "ARTIFACTPATH=${ToolSetParams[ToolSet]['ARTIFACTPATH']}", + "SDKPATH=${ToolSetParams[ToolSet]['SDKPATH']}" + ]) { + bat script: "if exist %ARTIFACTPATH%-${ToolSet}-${BuildType} rd /s/q %ARTIFACTPATH%-${ToolSet}-${BuildType}" + bat script: "move %ARTIFACTPATH% %ARTIFACTPATH%-${ToolSet}-${BuildType}" + stash name: "CWE-ou Artifacts ${ToolSet}-${BuildType}", + includes: "${ARTIFACTPATH}-${ToolSet}-${BuildType}/Plasma/**,${SDKPATH}/StaticSDKs/**" + } + } + } + + } + } + } + + stage('Unstash Build Artifacts') { + steps { + script { + for (buildtype in Targets) { + for (toolset in ToolSets) { + unstash name: "CWE-ou Artifacts ${toolset}-${buildtype}" + } + } + } + } + } + stage('Archive Artifacts') { + steps { + dir (BaseDir) { + archiveArtifacts artifacts: "Plasma20/MsDevProjects*/**/Release*/*,"+ + "Plasma20/MSVC10Projects*/**/Release*/*,"+ + "StaticSDKs*/**/*.dll", + fingerprint: true, + followSymlinks: false + } + } + } + } +} + +