Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r6a531ab r91aa5ab  
    3030                                SrcDir    = pwd tmp: false
    3131
    32                                 Tools.Clean()
    33 
    34                                 Tools.Checkout()
     32                                clean()
     33
     34                                checkout()
    3535
    3636                                build()
     
    8181// Main compilation routines
    8282//===========================================================================================================
     83def clean() {
     84        Tools.BuildStage('Cleanup', true) {
     85                // clean the build by wipping the build directory
     86                dir(BuildDir) {
     87                        deleteDir()
     88                }
     89        }
     90}
     91
     92//Compilation script is done here but environnement set-up and error handling is done in main loop
     93def checkout() {
     94        Tools.BuildStage('Checkout', true) {
     95                //checkout the source code and clean the repo
     96                final scmVars = checkout scm
     97                Settings.GitNewRef = scmVars.GIT_COMMIT
     98                Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT
     99
     100                echo GitLogMessage()
     101        }
     102}
     103
    83104def build() {
    84105        debug = true
     
    215236//Routine responsible of sending the email notification once the build is completed
    216237//===========================================================================================================
     238@NonCPS
     239def SplitLines(String text) {
     240        def list = []
     241
     242        text.eachLine {
     243                list += it
     244        }
     245
     246        return list
     247}
     248
     249def GitLogMessage() {
     250        if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n"
     251
     252        def oldRef = Settings.GitOldRef
     253        def newRef = Settings.GitNewRef
     254
     255        def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim()
     256        def revList = SplitLines( revText )
     257
     258        def gitUpdate = ""
     259        revList.each { rev ->
     260                def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
     261                gitUpdate = gitUpdate + "       via  ${rev} (${type})"
     262        }
     263
     264        def rev = oldRef
     265        def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
     266        gitUpdate = gitUpdate + "      from  ${rev} (${type})"
     267
     268        def gitLog    = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim()
     269
     270        def gitDiff   = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim()
     271        gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">')
     272        gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">')
     273        gitDiff = gitDiff.replace('[m', '</span>')
     274
     275        return """
     276<pre>
     277The branch ${env.BRANCH_NAME} has been updated.
     278${gitUpdate}
     279</pre>
     280
     281<p>Check console output at ${env.BUILD_URL} to view the results.</p>
     282
     283<p>- Status --------------------------------------------------------------</p>
     284
     285<p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p>
     286
     287<p>- Log -----------------------------------------------------------------</p>
     288
     289<pre>
     290${gitLog}
     291</pre>
     292
     293<p>-----------------------------------------------------------------------</p>
     294<pre>
     295Summary of changes:
     296${gitDiff}
     297</pre>
     298"""
     299}
     300
    217301//Standard build email notification
    218302def email(boolean log) {
     
    226310generated because of a git hooks/post-receive script following
    227311a ref change which was pushed to the C\u2200 repository.</p>
    228 """ + Tools.GitLogMessage()
     312""" + GitLogMessage()
    229313
    230314        def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
     
    336420                this.DescShort = "${ this.Compiler.name }:${ this.Architecture.name }${full}"
    337421
    338                 final ast = this.NewAST ? "New AST" : "Old AST"
    339422                this.DescLong = """Compiler              : ${ this.Compiler.name } (${ this.Compiler.CXX }/${ this.Compiler.CC })
    340 AST Version             : ${ ast.toString() }
    341423Architecture            : ${ this.Architecture.name }
    342424Arc Flags               : ${ this.Architecture.flags }
     
    391473                                        description: 'If true, build compiler using new AST',           \
    392474                                        name: 'NewAST',                                                                         \
    393                                         defaultValue: true,                                                             \
     475                                        defaultValue: false,                                                            \
    394476                                ],                                                                                              \
    395477                                [$class: 'BooleanParameterDefinition',                                                  \
     
    397479                                        name: 'RunAllTests',                                                            \
    398480                                        defaultValue: false,                                                            \
    399                                 ],                                                                                              \
     481                                ],
    400482                                [$class: 'BooleanParameterDefinition',                                                  \
    401483                                        description: 'If true, jenkins also runs benchmarks',           \
Note: See TracChangeset for help on using the changeset viewer.