| [a63ad80] | 1 | #!groovy | 
|---|
|  | 2 |  | 
|---|
| [7a230fd] | 3 | import groovy.transform.Field | 
|---|
|  | 4 |  | 
|---|
| [29f4fe62] | 5 | //=========================================================================================================== | 
|---|
| [9beae23] | 6 | // Main loop of the compilation | 
|---|
| [29f4fe62] | 7 | //=========================================================================================================== | 
|---|
| [56a9ce6] | 8 |  | 
|---|
| [d3b95f1] | 9 | // Globals | 
|---|
| [e018546] | 10 | BuildDir  = null | 
|---|
|  | 11 | SrcDir    = null | 
|---|
| [d3b95f1] | 12 | Settings  = null | 
|---|
|  | 13 | Tools     = null | 
|---|
| [4f9e706] | 14 |  | 
|---|
| [d3b95f1] | 15 | // Local variables | 
|---|
|  | 16 | def err = null | 
|---|
|  | 17 | def log_needed = false | 
|---|
| [5b8413b4] | 18 |  | 
|---|
| [d3b95f1] | 19 | currentBuild.result = "SUCCESS" | 
|---|
| [4f9e706] | 20 |  | 
|---|
| [d3b95f1] | 21 | try { | 
|---|
| [47138ee] | 22 | node { | 
|---|
|  | 23 | //Wrap build to add timestamp to command line | 
|---|
|  | 24 | wrap([$class: 'TimestamperBuildWrapper']) { | 
|---|
| [85142648] | 25 | Settings = prepare_build() | 
|---|
| [d3b95f1] | 26 | } | 
|---|
| [47138ee] | 27 | } | 
|---|
| [952ee7a] | 28 |  | 
|---|
| [47138ee] | 29 | node(Settings.Architecture.node) { | 
|---|
|  | 30 | //Wrap build to add timestamp to command line | 
|---|
|  | 31 | wrap([$class: 'TimestamperBuildWrapper']) { | 
|---|
| [d3b95f1] | 32 | BuildDir  = pwd tmp: true | 
|---|
|  | 33 | SrcDir    = pwd tmp: false | 
|---|
|  | 34 | currentBuild.description = "${currentBuild.description} on ${env.NODE_NAME}" | 
|---|
| [7aebc62] | 35 |  | 
|---|
| [d3b95f1] | 36 | Tools.Clean() | 
|---|
| [fde808df] | 37 |  | 
|---|
| [d3b95f1] | 38 | Tools.Checkout() | 
|---|
| [95fdb0a] | 39 |  | 
|---|
| [d3b95f1] | 40 | build() | 
|---|
| [95fdb0a] | 41 |  | 
|---|
| [d3b95f1] | 42 | test() | 
|---|
| [95fdb0a] | 43 |  | 
|---|
| [d3b95f1] | 44 | benchmark() | 
|---|
| [7359098] | 45 |  | 
|---|
| [d3b95f1] | 46 | build_doc() | 
|---|
| [9beae23] | 47 |  | 
|---|
| [d3b95f1] | 48 | publish() | 
|---|
| [9beae23] | 49 | } | 
|---|
| [738cf8f] | 50 | } | 
|---|
| [d3b95f1] | 51 | } | 
|---|
| [738cf8f] | 52 |  | 
|---|
| [d3b95f1] | 53 | //If an exception is caught we need to change the status and remember to | 
|---|
|  | 54 | //attach the build log to the email | 
|---|
|  | 55 | catch (Exception caughtError) { | 
|---|
|  | 56 | // Store the result of the build log | 
|---|
|  | 57 | currentBuild.result = "FAILURE" | 
|---|
| [9dd31e7] | 58 |  | 
|---|
| [d3b95f1] | 59 | // An error has occured, the build log is relevent | 
|---|
|  | 60 | log_needed = true | 
|---|
| [9beae23] | 61 |  | 
|---|
| [d3b95f1] | 62 | // rethrow error later | 
|---|
|  | 63 | err = caughtError | 
|---|
| [852ae0ea] | 64 |  | 
|---|
| [d3b95f1] | 65 | // print the error so it shows in the log | 
|---|
|  | 66 | echo err.toString() | 
|---|
|  | 67 | } | 
|---|
| [738cf8f] | 68 |  | 
|---|
| [d3b95f1] | 69 | finally { | 
|---|
|  | 70 | //Send email with final results if this is not a full build | 
|---|
|  | 71 | email(log_needed) | 
|---|
| [9beae23] | 72 |  | 
|---|
| [d3b95f1] | 73 | echo 'Build Completed' | 
|---|
| [734891d] | 74 |  | 
|---|
| [d3b95f1] | 75 | /* Must re-throw exception to propagate error */ | 
|---|
|  | 76 | if (err) { | 
|---|
|  | 77 | throw err | 
|---|
| [738cf8f] | 78 | } | 
|---|
|  | 79 | } | 
|---|
| [29f4fe62] | 80 | //=========================================================================================================== | 
|---|
| [9beae23] | 81 | // Main compilation routines | 
|---|
| [29f4fe62] | 82 | //=========================================================================================================== | 
|---|
| [95fdb0a] | 83 | def build() { | 
|---|
| [e507c11] | 84 | debug = true | 
|---|
|  | 85 | release = Settings.RunAllTests || Settings.RunBenchmark | 
|---|
| [91aa5ab] | 86 | Tools.BuildStage('Build : configure', true) { | 
|---|
| [dcf1979] | 87 | // Configure must be run inside the tree | 
|---|
|  | 88 | dir (SrcDir) { | 
|---|
|  | 89 | // Generate the necessary build files | 
|---|
|  | 90 | sh './autogen.sh' | 
|---|
|  | 91 | } | 
|---|
|  | 92 |  | 
|---|
| [50f2cfc] | 93 | // Build outside of the src tree to ease cleaning | 
|---|
| [5b8413b4] | 94 | dir (BuildDir) { | 
|---|
| [8e58264] | 95 | //Configure the compilation (Output is not relevant) | 
|---|
| [50f2cfc] | 96 | //Use the current directory as the installation target so nothing escapes the sandbox | 
|---|
|  | 97 | //Also specify the compiler by hand | 
|---|
| [3fc5f010] | 98 | targets="" | 
|---|
| [d4510ea] | 99 | if( Settings.RunAllTests || Settings.RunBenchmark ) { | 
|---|
| [6bde81d] | 100 | targets="--with-target-hosts='host:debug,host:nodebug'" | 
|---|
| [3fc5f010] | 101 | } else { | 
|---|
| [6bde81d] | 102 | targets="--with-target-hosts='host:debug'" | 
|---|
| [3fc5f010] | 103 | } | 
|---|
|  | 104 |  | 
|---|
| [6b00c53] | 105 | sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} AR=gcc-ar RANLIB=gcc-ranlib ${targets} --quiet --prefix=${BuildDir}" | 
|---|
| [f253e4a] | 106 |  | 
|---|
|  | 107 | // Configure libcfa | 
|---|
| [0b4ddb71] | 108 | sh 'make -j $(nproc) --no-print-directory configure-libcfa' | 
|---|
| [e507c11] | 109 | } | 
|---|
|  | 110 | } | 
|---|
|  | 111 |  | 
|---|
| [91aa5ab] | 112 | Tools.BuildStage('Build : cfa-cpp', true) { | 
|---|
| [e507c11] | 113 | // Build outside of the src tree to ease cleaning | 
|---|
|  | 114 | dir (BuildDir) { | 
|---|
|  | 115 | // Build driver | 
|---|
| [0b4ddb71] | 116 | sh 'make -j $(nproc) --no-print-directory -C driver' | 
|---|
| [e507c11] | 117 |  | 
|---|
|  | 118 | // Build translator | 
|---|
| [0b4ddb71] | 119 | sh 'make -j $(nproc) --no-print-directory -C src' | 
|---|
| [e507c11] | 120 | } | 
|---|
|  | 121 | } | 
|---|
| [1752d0e] | 122 |  | 
|---|
| [91aa5ab] | 123 | Tools.BuildStage('Build : libcfa(debug)', debug) { | 
|---|
| [e507c11] | 124 | // Build outside of the src tree to ease cleaning | 
|---|
|  | 125 | dir (BuildDir) { | 
|---|
| [14d5461] | 126 | sh "make -j \$(nproc) --no-print-directory -C libcfa/${Settings.Architecture.name}-debug" | 
|---|
| [e507c11] | 127 | } | 
|---|
|  | 128 | } | 
|---|
|  | 129 |  | 
|---|
| [91aa5ab] | 130 | Tools.BuildStage('Build : libcfa(nodebug)', release) { | 
|---|
| [e507c11] | 131 | // Build outside of the src tree to ease cleaning | 
|---|
|  | 132 | dir (BuildDir) { | 
|---|
| [14d5461] | 133 | sh "make -j \$(nproc) --no-print-directory -C libcfa/${Settings.Architecture.name}-nodebug" | 
|---|
| [50f2cfc] | 134 | } | 
|---|
| [620dd2b] | 135 | } | 
|---|
| [aa96fba] | 136 |  | 
|---|
| [91aa5ab] | 137 | Tools.BuildStage('Build : install', true) { | 
|---|
| [aa96fba] | 138 | // Build outside of the src tree to ease cleaning | 
|---|
|  | 139 | dir (BuildDir) { | 
|---|
| [14d5461] | 140 | sh 'make -j $(nproc) --no-print-directory install' | 
|---|
| [aa96fba] | 141 | } | 
|---|
|  | 142 | } | 
|---|
| [95fdb0a] | 143 | } | 
|---|
| [24eecab] | 144 |  | 
|---|
| [95fdb0a] | 145 | def test() { | 
|---|
| [4c1b9ea8] | 146 | try { | 
|---|
| [1baf6ed] | 147 | // Print potential limits before testing | 
|---|
|  | 148 | // in case jenkins messes with them | 
|---|
| [a33dcd5] | 149 | sh 'free -h' | 
|---|
| [1baf6ed] | 150 | sh 'ulimit -a' | 
|---|
|  | 151 |  | 
|---|
| [597e395] | 152 | jopt = '-j $(nproc)' | 
|---|
|  | 153 |  | 
|---|
| [9a90092] | 154 | Tools.BuildStage('Test: Debug', true) { | 
|---|
| [4c1b9ea8] | 155 | dir (BuildDir) { | 
|---|
| [3e93c00] | 156 | //Run the tests from the tests directory | 
|---|
| [5007618] | 157 | sh """make ${jopt} --no-print-directory -C tests timeout=600 global-timeout=14400 tests debug=yes archive-errors=${BuildDir}/tests/crashes/full-debug""" | 
|---|
| [3e93c00] | 158 | } | 
|---|
| [4c1b9ea8] | 159 | } | 
|---|
|  | 160 |  | 
|---|
| [597e395] | 161 | Tools.BuildStage('Test: Release', Settings.RunAllTests) { | 
|---|
| [4c1b9ea8] | 162 | dir (BuildDir) { | 
|---|
| [597e395] | 163 | //Run the tests from the tests directory | 
|---|
| [5007618] | 164 | sh """make ${jopt} --no-print-directory -C tests timeout=600 global-timeout=14400 tests debug=no archive-errors=${BuildDir}/tests/crashes/full-nodebug""" | 
|---|
| [143e6f3] | 165 | } | 
|---|
| [9beae23] | 166 | } | 
|---|
| [620dd2b] | 167 | } | 
|---|
| [4c1b9ea8] | 168 | catch (Exception err) { | 
|---|
|  | 169 | echo "Archiving core dumps" | 
|---|
| [c95fdc9] | 170 | dir (BuildDir) { | 
|---|
| [cc9ec56] | 171 | def exists = fileExists 'tests/crashes' | 
|---|
|  | 172 | if( exists ) { | 
|---|
| [cece53c] | 173 | sh """${SrcDir}/tools/jenkins/archive-gen.sh""" | 
|---|
|  | 174 | archiveArtifacts artifacts: "tests/crashes/**/*,lib/**/lib*.so*,setup.sh", fingerprint: true | 
|---|
|  | 175 | } | 
|---|
| [c95fdc9] | 176 | } | 
|---|
| [4c1b9ea8] | 177 | throw err | 
|---|
|  | 178 | } | 
|---|
| [95fdb0a] | 179 | } | 
|---|
|  | 180 |  | 
|---|
|  | 181 | def benchmark() { | 
|---|
| [91aa5ab] | 182 | Tools.BuildStage('Benchmark', Settings.RunBenchmark) { | 
|---|
| [5b8413b4] | 183 | dir (BuildDir) { | 
|---|
| [0dc3ac3] | 184 | //Append bench results | 
|---|
| [c6f1f3e] | 185 | sh "make --no-print-directory -C benchmark jenkins arch=${Settings.Architecture.name}" | 
|---|
| [0dc3ac3] | 186 | } | 
|---|
| [620dd2b] | 187 | } | 
|---|
| [9beae23] | 188 | } | 
|---|
| [efd60d67] | 189 |  | 
|---|
| [95fdb0a] | 190 | def build_doc() { | 
|---|
| [91aa5ab] | 191 | Tools.BuildStage('Documentation', Settings.BuildDocumentation) { | 
|---|
| [9beae23] | 192 | dir ('doc/user') { | 
|---|
|  | 193 | make_doc() | 
|---|
|  | 194 | } | 
|---|
|  | 195 |  | 
|---|
|  | 196 | dir ('doc/refrat') { | 
|---|
|  | 197 | make_doc() | 
|---|
|  | 198 | } | 
|---|
| [620dd2b] | 199 | } | 
|---|
| [9beae23] | 200 | } | 
|---|
|  | 201 |  | 
|---|
| [95fdb0a] | 202 | def publish() { | 
|---|
| [91aa5ab] | 203 | Tools.BuildStage('Publish', true) { | 
|---|
| [95fdb0a] | 204 |  | 
|---|
| [1b3eef8] | 205 | if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' } | 
|---|
| [620dd2b] | 206 | } | 
|---|
| [95fdb0a] | 207 | } | 
|---|
|  | 208 |  | 
|---|
| [29f4fe62] | 209 | //=========================================================================================================== | 
|---|
|  | 210 | //Routine responsible of sending the email notification once the build is completed | 
|---|
|  | 211 | //=========================================================================================================== | 
|---|
| [a336d46] | 212 | //Standard build email notification | 
|---|
| [13c98a4] | 213 | def email(boolean log) { | 
|---|
| [bd50205] | 214 | node { | 
|---|
|  | 215 | //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line | 
|---|
|  | 216 | //Configurations for email format | 
|---|
|  | 217 | echo 'Notifying users of result' | 
|---|
|  | 218 |  | 
|---|
|  | 219 | def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() | 
|---|
|  | 220 | def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}" | 
|---|
|  | 221 | def email_body = """<p>This is an automated email from the Jenkins build machine. It was | 
|---|
| [1781e97] | 222 | generated because of a git hooks/post-receive script following | 
|---|
|  | 223 | a ref change which was pushed to the C\u2200 repository.</p> | 
|---|
| [9824500] | 224 |  | 
|---|
| [1781e97] | 225 | <p>- Status --------------------------------------------------------------</p> | 
|---|
| [9824500] | 226 |  | 
|---|
| [1781e97] | 227 | <p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p> | 
|---|
|  | 228 | <p>Check console output at ${env.BUILD_URL} to view the results.</p> | 
|---|
|  | 229 | """ + Tools.GitLogMessage() | 
|---|
| [bd50205] | 230 |  | 
|---|
| [7c36bc9] | 231 | def email_to = "cforall@lists.uwaterloo.ca" | 
|---|
| [bd50205] | 232 |  | 
|---|
|  | 233 | if( Settings && !Settings.Silent ) { | 
|---|
|  | 234 | //send email notification | 
|---|
|  | 235 | emailext body: email_body, subject: email_subject, to: email_to, attachLog: log | 
|---|
|  | 236 | } else { | 
|---|
|  | 237 | echo "Would send email to: ${email_to}" | 
|---|
|  | 238 | echo "With title: ${email_subject}" | 
|---|
|  | 239 | echo "Content: \n${email_body}" | 
|---|
|  | 240 | } | 
|---|
| [094a42c] | 241 | } | 
|---|
| [e8a22a7] | 242 | } | 
|---|
| [5b8413b4] | 243 |  | 
|---|
|  | 244 | //=========================================================================================================== | 
|---|
|  | 245 | // Helper classes/variables/routines | 
|---|
|  | 246 | //=========================================================================================================== | 
|---|
|  | 247 | //Description of a compiler (Must be serializable since pipelines are persistent) | 
|---|
|  | 248 | class CC_Desc implements Serializable { | 
|---|
| [93fe3154] | 249 | public String name | 
|---|
|  | 250 | public String CXX | 
|---|
| [6ebc13f] | 251 | public String CC | 
|---|
| [bf22bc6] | 252 | public String lto | 
|---|
| [93fe3154] | 253 |  | 
|---|
| [bf22bc6] | 254 | CC_Desc(String name, String CXX, String CC, String lto) { | 
|---|
| [93fe3154] | 255 | this.name = name | 
|---|
|  | 256 | this.CXX = CXX | 
|---|
| [bf22bc6] | 257 | this.CC  = CC | 
|---|
|  | 258 | this.lto = lto | 
|---|
| [5b8413b4] | 259 | } | 
|---|
|  | 260 | } | 
|---|
|  | 261 |  | 
|---|
|  | 262 | //Description of an architecture (Must be serializable since pipelines are persistent) | 
|---|
|  | 263 | class Arch_Desc implements Serializable { | 
|---|
|  | 264 | public String name | 
|---|
|  | 265 | public String flags | 
|---|
| [5307c33] | 266 | public String node | 
|---|
| [5b8413b4] | 267 |  | 
|---|
| [5307c33] | 268 | Arch_Desc(String name, String flags, String node) { | 
|---|
| [5b8413b4] | 269 | this.name  = name | 
|---|
|  | 270 | this.flags = flags | 
|---|
| [5307c33] | 271 | this.node  = node | 
|---|
| [5b8413b4] | 272 | } | 
|---|
|  | 273 | } | 
|---|
|  | 274 |  | 
|---|
|  | 275 | class BuildSettings implements Serializable { | 
|---|
|  | 276 | public final CC_Desc Compiler | 
|---|
|  | 277 | public final Arch_Desc Architecture | 
|---|
|  | 278 | public final Boolean RunAllTests | 
|---|
|  | 279 | public final Boolean RunBenchmark | 
|---|
|  | 280 | public final Boolean BuildDocumentation | 
|---|
|  | 281 | public final Boolean Publish | 
|---|
|  | 282 | public final Boolean Silent | 
|---|
|  | 283 | public final String DescLong | 
|---|
|  | 284 | public final String DescShort | 
|---|
|  | 285 |  | 
|---|
| [a336d46] | 286 | public String GitNewRef | 
|---|
|  | 287 | public String GitOldRef | 
|---|
|  | 288 |  | 
|---|
| [490cb3c] | 289 | BuildSettings(java.util.Collections$UnmodifiableMap param, String branch) { | 
|---|
| [5b8413b4] | 290 | switch( param.Compiler ) { | 
|---|
| [cc27558] | 291 | //                           builds  runtime    compiler   cfa-cpp (clang missing -no-integrated-cpp) | 
|---|
| [f36c916] | 292 | // case 'gcc-4.9': | 
|---|
|  | 293 | //      this.Compiler = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9', '-flto=auto') | 
|---|
|  | 294 | // break | 
|---|
|  | 295 | // case 'gcc-5': | 
|---|
|  | 296 | //      this.Compiler = new CC_Desc('gcc-5', 'g++-5', 'gcc-5', '-flto=auto') | 
|---|
|  | 297 | // break | 
|---|
|  | 298 | // case 'gcc-6': | 
|---|
|  | 299 | //      this.Compiler = new CC_Desc('gcc-6', 'g++-6', 'gcc-6', '-flto=auto') | 
|---|
|  | 300 | // break | 
|---|
| [da10157] | 301 | // case 'gcc-7': | 
|---|
|  | 302 | //      this.Compiler = new CC_Desc('gcc-7', 'g++-7', 'gcc-7', '-flto=auto') | 
|---|
|  | 303 | // break | 
|---|
|  | 304 | // case 'gcc-8': | 
|---|
|  | 305 | //      this.Compiler = new CC_Desc('gcc-8', 'g++-8', 'gcc-8', '-flto=auto') | 
|---|
|  | 306 | // break | 
|---|
| [099f5bd] | 307 | case 'gcc-9': | 
|---|
| [bf22bc6] | 308 | this.Compiler = new CC_Desc('gcc-9', 'g++-9', 'gcc-9', '-flto=auto') | 
|---|
| [099f5bd] | 309 | break | 
|---|
| [f36c916] | 310 | case 'gcc-10': | 
|---|
|  | 311 | this.Compiler = new CC_Desc('gcc-10', 'g++-10', 'gcc-10', '-flto=auto') | 
|---|
| [099f5bd] | 312 | break | 
|---|
| [f36c916] | 313 | case 'gcc-11': | 
|---|
|  | 314 | this.Compiler = new CC_Desc('gcc-11', 'g++-11', 'gcc-11', '-flto=auto') | 
|---|
|  | 315 | break | 
|---|
|  | 316 | case 'gcc-12': | 
|---|
|  | 317 | this.Compiler = new CC_Desc('gcc-12', 'g++-12', 'gcc-12', '-flto=auto') | 
|---|
| [099f5bd] | 318 | break | 
|---|
| [cc27558] | 319 | // Use only generic clang/gcc here because of unknown version numbers on different architectures. | 
|---|
| [5b8413b4] | 320 | case 'clang': | 
|---|
| [8e5dc27] | 321 | this.Compiler = new CC_Desc('clang', 'clang++', 'gcc-11', '-flto=thin -flto-jobs=0') | 
|---|
| [5b8413b4] | 322 | break | 
|---|
|  | 323 | default : | 
|---|
|  | 324 | error "Unhandled compiler : ${cc}" | 
|---|
|  | 325 | } | 
|---|
|  | 326 |  | 
|---|
|  | 327 | switch( param.Architecture ) { | 
|---|
|  | 328 | case 'x64': | 
|---|
| [a3e8281] | 329 | this.Architecture = new Arch_Desc('x64', '--host=x86_64', 'x64') | 
|---|
| [5b8413b4] | 330 | break | 
|---|
| [f466d6b] | 331 | //case 'x86': | 
|---|
|  | 332 | //      this.Architecture = new Arch_Desc('x86', '--host=i386', 'x86') | 
|---|
|  | 333 | //break | 
|---|
| [99a7163] | 334 | // case 'arm64': | 
|---|
|  | 335 | //      this.Architecture = new Arch_Desc('arm64', '--host=aarch64', 'arm64') | 
|---|
|  | 336 | // break | 
|---|
| [5b8413b4] | 337 | default : | 
|---|
|  | 338 | error "Unhandled architecture : ${arch}" | 
|---|
|  | 339 | } | 
|---|
|  | 340 |  | 
|---|
|  | 341 | this.RunAllTests        = param.RunAllTests | 
|---|
| [7a230fd] | 342 | this.RunBenchmark       = param.RunBenchmark | 
|---|
| [5b8413b4] | 343 | this.BuildDocumentation = param.BuildDocumentation | 
|---|
| [7a230fd] | 344 | this.Publish            = param.Publish | 
|---|
| [5b8413b4] | 345 | this.Silent             = param.Silent | 
|---|
|  | 346 |  | 
|---|
|  | 347 | def full = param.RunAllTests ? " (Full)" : "" | 
|---|
| [490cb3c] | 348 | this.DescShort = "${ this.Compiler.name }:${ this.Architecture.name }${full}" | 
|---|
| [5b8413b4] | 349 |  | 
|---|
| [93fe3154] | 350 | this.DescLong = """Compiler              : ${ this.Compiler.name } (${ this.Compiler.CXX }/${ this.Compiler.CC }) | 
|---|
| [5b8413b4] | 351 | Architecture            : ${ this.Architecture.name } | 
|---|
|  | 352 | Arc Flags               : ${ this.Architecture.flags } | 
|---|
|  | 353 | Run All Tests           : ${ this.RunAllTests.toString() } | 
|---|
|  | 354 | Run Benchmark           : ${ this.RunBenchmark.toString() } | 
|---|
|  | 355 | Build Documentation     : ${ this.BuildDocumentation.toString() } | 
|---|
|  | 356 | Publish                 : ${ this.Publish.toString() } | 
|---|
|  | 357 | Silent                  : ${ this.Silent.toString() } | 
|---|
|  | 358 | """ | 
|---|
| [a336d46] | 359 |  | 
|---|
|  | 360 | this.GitNewRef = '' | 
|---|
|  | 361 | this.GitOldRef = '' | 
|---|
| [5b8413b4] | 362 | } | 
|---|
|  | 363 | } | 
|---|
|  | 364 |  | 
|---|
|  | 365 | def prepare_build() { | 
|---|
|  | 366 | // prepare the properties | 
|---|
| [985b624] | 367 | properties ([                                                                           \ | 
|---|
|  | 368 | buildDiscarder(logRotator(                                                      \ | 
|---|
|  | 369 | artifactDaysToKeepStr: '',                                              \ | 
|---|
|  | 370 | artifactNumToKeepStr: '',                                               \ | 
|---|
|  | 371 | daysToKeepStr: '730',                                                   \ | 
|---|
|  | 372 | numToKeepStr: '1000'                                                    \ | 
|---|
|  | 373 | )),                                                                             \ | 
|---|
|  | 374 | [$class: 'ParametersDefinitionProperty',                                        \ | 
|---|
|  | 375 | parameterDefinitions: [                                                 \ | 
|---|
|  | 376 | [$class: 'ChoiceParameterDefinition',                           \ | 
|---|
|  | 377 | description: 'Which compiler to use',                   \ | 
|---|
|  | 378 | name: 'Compiler',                                       \ | 
|---|
| [8e5dc27] | 379 | choices: 'gcc-9\ngcc-10\ngcc-11\ngcc-12\ngcc-13\ngcc-14\nclang', \ | 
|---|
| [cc27558] | 380 | defaultValue: 'gcc',                                    \ | 
|---|
| [985b624] | 381 | ],                                                              \ | 
|---|
|  | 382 | [$class: 'ChoiceParameterDefinition',                           \ | 
|---|
|  | 383 | description: 'The target architecture',                 \ | 
|---|
|  | 384 | name: 'Architecture',                                   \ | 
|---|
| [2261bcc] | 385 | choices: 'x64\nx86\narm64',                             \ | 
|---|
| [985b624] | 386 | defaultValue: 'x64',                                    \ | 
|---|
|  | 387 | ],                                                              \ | 
|---|
|  | 388 | [$class: 'BooleanParameterDefinition',                          \ | 
|---|
| [597e395] | 389 | description: 'If false, the test suite is only ran in debug',   \ | 
|---|
| [985b624] | 390 | name: 'RunAllTests',                                    \ | 
|---|
|  | 391 | defaultValue: false,                                    \ | 
|---|
|  | 392 | ],                                                              \ | 
|---|
|  | 393 | [$class: 'BooleanParameterDefinition',                          \ | 
|---|
|  | 394 | description: 'If true, jenkins also runs benchmarks',   \ | 
|---|
|  | 395 | name: 'RunBenchmark',                                   \ | 
|---|
|  | 396 | defaultValue: false,                                    \ | 
|---|
|  | 397 | ],                                                              \ | 
|---|
|  | 398 | [$class: 'BooleanParameterDefinition',                          \ | 
|---|
|  | 399 | description: 'If true, jenkins also builds documentation', \ | 
|---|
|  | 400 | name: 'BuildDocumentation',                             \ | 
|---|
|  | 401 | defaultValue: true,                                     \ | 
|---|
|  | 402 | ],                                                              \ | 
|---|
|  | 403 | [$class: 'BooleanParameterDefinition',                          \ | 
|---|
|  | 404 | description: 'If true, jenkins also publishes results', \ | 
|---|
|  | 405 | name: 'Publish',                                        \ | 
|---|
|  | 406 | defaultValue: false,                                    \ | 
|---|
|  | 407 | ],                                                              \ | 
|---|
|  | 408 | [$class: 'BooleanParameterDefinition',                          \ | 
|---|
|  | 409 | description: 'If true, jenkins will not send emails',   \ | 
|---|
|  | 410 | name: 'Silent',                                         \ | 
|---|
|  | 411 | defaultValue: false,                                    \ | 
|---|
|  | 412 | ],                                                              \ | 
|---|
| [5b8413b4] | 413 | ], | 
|---|
|  | 414 | ]]) | 
|---|
| [f36c916] | 415 | // choices: 'gcc-4.9\ngcc-5\ngcc-6\ngcc-7\ngcc-8\ngcc-9\ngcc-10\ngcc-11\nclang', | 
|---|
| [985b624] | 416 | // defaultValue: 'gcc-8', | 
|---|
| [5b8413b4] | 417 |  | 
|---|
| [bd8dca2] | 418 | // It's unfortunate but it looks like we need to checkout the entire repo just to get | 
|---|
|  | 419 | // - the pretty git printer | 
|---|
|  | 420 | // - Jenkins.tools | 
|---|
| [4c55047] | 421 | checkout scm | 
|---|
| [2407853] | 422 |  | 
|---|
| [1483a16] | 423 | Tools = load "Jenkins/tools.groovy" | 
|---|
| [bd8dca2] | 424 |  | 
|---|
| [490cb3c] | 425 | final settings = new BuildSettings(params, env.BRANCH_NAME) | 
|---|
| [5b8413b4] | 426 |  | 
|---|
|  | 427 | currentBuild.description = settings.DescShort | 
|---|
|  | 428 | echo                       settings.DescLong | 
|---|
|  | 429 |  | 
|---|
|  | 430 | return settings | 
|---|
|  | 431 | } | 
|---|
|  | 432 |  | 
|---|
|  | 433 | def make_doc() { | 
|---|
|  | 434 | def err = null | 
|---|
|  | 435 | try { | 
|---|
|  | 436 | sh 'make clean > /dev/null' | 
|---|
|  | 437 | sh 'make > /dev/null 2>&1' | 
|---|
|  | 438 | } | 
|---|
|  | 439 | catch (Exception caughtError) { | 
|---|
|  | 440 | err = caughtError //rethrow error later | 
|---|
| [65f4a51] | 441 | sh 'cat build/*.log' | 
|---|
| [5b8413b4] | 442 | } | 
|---|
|  | 443 | finally { | 
|---|
|  | 444 | if (err) throw err // Must re-throw exception to propagate error | 
|---|
|  | 445 | } | 
|---|
| [a2a0065] | 446 | } | 
|---|