From cb4f7959f7aae55436779f5bd3e19a12ca105bd6 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Thu, 8 Sep 2016 15:05:25 +0200
Subject: [PATCH] [Jenkins] Win builds can run on nodes with win and conan
 label.

---
 scripts/jenkins/msvc.groovy   | 21 +++++++++++++++++----
 scripts/jenkins/msvc32.groovy | 20 ++++++++++++++++----
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/scripts/jenkins/msvc.groovy b/scripts/jenkins/msvc.groovy
index 682f4ded6c1..ec47da1b62b 100644
--- a/scripts/jenkins/msvc.groovy
+++ b/scripts/jenkins/msvc.groovy
@@ -1,13 +1,11 @@
-defaultDockerArgs = '-v /home/jenkins/.ccache:/usr/src/.ccache'
 defaultCMakeOptions = '-DCMAKE_BUILD_TYPE=Release -DOGS_LIB_BOOST=System -DOGS_LIB_VTK=System -DOGS_DOWNLOAD_ADDITIONAL_CONTENT=ON'
-env64 = ['ARCH=msvc2013-x64', 'CMAKE_LIBRARY_SEARCH_PATH=C:\\libs\\$ARCH', 'QTDIR=C:\\libs\\qt\\4.8\\$ARCH', 'Path=$Path;$QTDIR\\bin;$CMAKE_LIBRARY_SEARCH_PATH\\bin','CONAN_CMAKE_GENERATOR=Ninja']
 
-node('visserv3')
+node('win && conan')
 {
     stage 'Checkout (Win)'
     dir('ogs') { checkout scm }
 
-    withEnv(env64) {
+    withEnv(getEnv()) {
         stage 'Configure (Win)'
         configure 'build', '', 'Ninja',
             '-u -s build_type=Release -s compiler="Visual Studio" -s compiler.version=12 -s arch=x86_64'
@@ -36,6 +34,21 @@ node('visserv3')
 }
 
 // *** Helper functions ***
+def getEnv()
+{
+    if (env.NODE_NAME == 'visserv3')
+        qtdir = 'C:\\libs\\qt\\4.8\\msvc2013-x64'
+    if (env.NODE_NAME == 'win1')
+        qtdir = 'C:\\libs\\qt-4.8.7-x64-msvc2013\\qt-4.8.7-x64-msvc2013'
+
+    return [
+        "QTDIR=${qtdir}",
+        'Path=$Path;$QTDIR\\bin',
+        'CONAN_CMAKE_GENERATOR=Ninja'
+    ]
+}
+
+
 def configure(buildDir, cmakeOptions, generator, conan_args=null, keepBuildDir=false) {
     if (keepBuildDir == false)
         bat("""rd /S /Q ${buildDir}
diff --git a/scripts/jenkins/msvc32.groovy b/scripts/jenkins/msvc32.groovy
index f1f15cd3de4..acd93336a2d 100644
--- a/scripts/jenkins/msvc32.groovy
+++ b/scripts/jenkins/msvc32.groovy
@@ -1,14 +1,13 @@
 defaultCMakeOptions = '-DCMAKE_BUILD_TYPE=Release -DOGS_32_BIT=ON -DOGS_LIB_BOOST=System -DOGS_LIB_VTK=System -DOGS_DOWNLOAD_ADDITIONAL_CONTENT=ON'
-env32 = ['QTDIR=C:\\libs\\qt-4.8.7-x86-msvc2013\\qt-4.8.7-x86-msvc2013', 'Path=$Path;$QTDIR\\bin', 'CONAN_CMAKE_GENERATOR=Ninja']
 
-node('win1')
+node('win && conan')
 {
     stage 'Checkout (Win)'
     dir('ogs') { checkout scm }
 
     if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.contains('release') ) {
         stage 'Data Explorer 32-bit (Win)'
-        withEnv(env32) {
+        withEnv(getEnv()) {
             configure 'build-32', '-DOGS_BUILD_GUI=ON -DOGS_BUILD_UTILS=ON -DOGS_BUILD_TESTS=OFF', 'Ninja', '-u -s build_type=Release -s compiler="Visual Studio" -s compiler.version=12 -s arch=x86'
             build 'build-32', 'package'
         }
@@ -16,7 +15,20 @@ node('win1')
     }
 }
 
-// *** Helper functions ***
+def getEnv()
+{
+    if (env.NODE_NAME == 'visserv3')
+        qtdir = 'C:\\libs\\qt\\4.8\\msvc2013-x32'
+    if (env.NODE_NAME == 'win1')
+        qtdir = 'C:\\libs\\qt-4.8.7-x86-msvc2013\\qt-4.8.7-x86-msvc2013'
+
+    return [
+        "QTDIR=${qtdir}",
+        'Path=$Path;$QTDIR\\bin',
+        'CONAN_CMAKE_GENERATOR=Ninja'
+    ]
+}
+
 def configure(buildDir, cmakeOptions, generator, conan_args=null) {
     bat("""rd /S /Q ${buildDir}
            mkdir ${buildDir}""".stripIndent())
-- 
GitLab