Changeset 6a531ab


Ignore:
Timestamp:
Dec 4, 2020, 12:52:04 PM (10 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
143cbf1
Parents:
8271891
Message:

Quick build now uses new AST.
Moved some more common code to tools.groovy.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/tools.groovy

    r8271891 r6a531ab  
    6161}
    6262
    63 def GitLogMessage(String oldRef, String newRef) {
     63PrevGitOldRef = ''
     64PrevGitNewRef = ''
     65def GitLogMessage(String oldRef = '', String newRef = '') {
     66        if (!PrevGitOldRef || !oldRef) return "\nERROR retrieveing git information!\n"
     67        PrevGitOldRef = oldRef
     68
     69        if (!PrevGitNewRef || !newRef) return "\nERROR retrieveing git information!\n"
     70        PrevGitNewRef = newRef
     71
    6472        def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim()
    6573        def revList = SplitLines( revText )
  • Jenkinsfile

    r8271891 r6a531ab  
    3030                                SrcDir    = pwd tmp: false
    3131
    32                                 clean()
    33 
    34                                 checkout()
     32                                Tools.Clean()
     33
     34                                Tools.Checkout()
    3535
    3636                                build()
     
    8181// Main compilation routines
    8282//===========================================================================================================
    83 def 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
    93 def 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 
    10483def build() {
    10584        debug = true
     
    236215//Routine responsible of sending the email notification once the build is completed
    237216//===========================================================================================================
    238 @NonCPS
    239 def SplitLines(String text) {
    240         def list = []
    241 
    242         text.eachLine {
    243                 list += it
    244         }
    245 
    246         return list
    247 }
    248 
    249 def 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>
    277 The 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>
    295 Summary of changes:
    296 ${gitDiff}
    297 </pre>
    298 """
    299 }
    300 
    301217//Standard build email notification
    302218def email(boolean log) {
     
    310226generated because of a git hooks/post-receive script following
    311227a ref change which was pushed to the C\u2200 repository.</p>
    312 """ + GitLogMessage()
     228""" + Tools.GitLogMessage()
    313229
    314230        def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
     
    475391                                        description: 'If true, build compiler using new AST',           \
    476392                                        name: 'NewAST',                                                                         \
    477                                         defaultValue: false,                                                            \
     393                                        defaultValue: true,                                                             \
    478394                                ],                                                                                              \
    479395                                [$class: 'BooleanParameterDefinition',                                                  \
Note: See TracChangeset for help on using the changeset viewer.