Changeset 3e3f236 for Jenkins/Distribute


Ignore:
Timestamp:
Dec 10, 2020, 4:00:29 PM (5 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
97aca3df, b3a0df6
Parents:
6a45bd78 (diff), 297cf18 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/Distribute

    r6a45bd78 r3e3f236  
    1515        SrcDir    = pwd tmp: false
    1616        Settings  = null
     17        Version   = ''
    1718
    1819        // Local variables
     
    2223        currentBuild.result = "SUCCESS"
    2324
    24         try {
    25                 //Wrap build to add timestamp to command line
    26                 wrap([$class: 'TimestamperBuildWrapper']) {
     25        //Wrap build to add timestamp to command line
     26        wrap([$class: 'TimestamperBuildWrapper']) {
    2727
    28                         final commit = prepare_build()
     28                final commit, build
     29                (commit, build) = prepare_build()
    2930
    30                         node('x64') {
    31                                 BuildDir  = pwd tmp: true
    32                                 SrcDir    = pwd tmp: false
    33 
    34                                 Tools.Clean()
    35 
    36                                 Tools.Checkout( commit )
    37                         }
    38 
    39                         // Update the build directories when exiting the node
     31                node('x64') {
    4032                        BuildDir  = pwd tmp: true
    4133                        SrcDir    = pwd tmp: false
     34
     35                        Tools.Clean()
     36
     37                        Tools.Checkout( commit )
     38
     39                        Version = GetVersion( build )
     40
     41                        Configure()
     42
     43                        Package()
     44
     45                        Test()
     46
     47                        Archive()
    4248                }
     49
     50                // Update the build directories when exiting the node
     51                BuildDir  = pwd tmp: true
     52                SrcDir    = pwd tmp: false
    4353        }
    4454
    45         //If an exception is caught we need to change the status and remember to
    46         //attach the build log to the email
    47         // catch (Exception caughtError) {
    48                 // //rethrow error later
    49                 // err = caughtError
    50 
    51                 // echo err.toString()
    52 
    53                 // //An error has occured, the build log is relevent
    54                 // log_needed = true
    55 
    56                 // //Store the result of the build log
    57                 // currentBuild.result = "${StageName} FAILURE".trim()
    58         // }
    59 
    60         finally {
    61                 // //Send email with final results if this is not a full build
    62                 // email(log_needed)
    63 
    64                 // echo 'Distribution Completed'
    65 
    66                 // /* Must re-throw exception to propagate error */
    67                 // if (err) {
    68                 //      throw err
    69                 // }
    70         }
    7155}
    7256
     
    7458// Main compilation routines
    7559//===========================================================================================================
     60def GetVersion(build) {
     61        final pver = sh(
     62                returnStdout: true,
     63                script: "sed 's/AC_INIT(\\[cfa-cc\\],\\[\\(.*\\)\\],\\[cforall@plg.uwaterloo.ca\\])/\\1/;t;d' ${SrcDir}/configure.ac"
     64        ).trim()
    7665
     66        final version = "${pver}.${build}"
    7767
    78 //Compilation script is done here but environnement set-up and error handling is done in main loop
    79 // def checkout() {
    80 //      build_stage('Checkout', true) {
    81 //              //checkout the source code and clean the repo
    82 //              final scmVars = checkout scm
    83 //              Settings.GitNewRef = scmVars.GIT_COMMIT
    84 //              Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT
     68        echo "Package Version: ${pver}"
     69        echo "Build   Version: ${build}"
     70        echo "Long    Version: ${version}"
    8571
    86 //              echo GitLogMessage()
    87 //      }
    88 // }
     72        return version
     73}
     74
     75def Configure() {
     76        Tools.BuildStage('Configure', true) {
     77                // Configure must be run inside the tree
     78                dir (SrcDir) {
     79                        // Generate the necessary build files
     80                        sh './autogen.sh'
     81                }
     82
     83                // Build outside of the src tree to ease cleaning
     84                dir (BuildDir) {
     85                        // Configure the compilation (Output is not relevant)
     86                        // Use the current directory as the installation target so nothing escapes the sandbox
     87                        // Also specify the compiler by hand
     88                        sh "${SrcDir}/configure CXX=g++-9 CC=gcc-9 AR=gcc-ar RANLIB=gcc-ranlib --quiet"
     89
     90                        // Configure libcfa
     91                        sh 'make -j 8 --no-print-directory configure-libcfa'
     92                }
     93        }
     94}
     95
     96def Package() {
     97        Tools.BuildStage('Package', true) {
     98                dir (BuildDir) {
     99                        sh "make VERSION=${Version} dist"
     100                }
     101        }
     102}
     103
     104def Test() {
     105        Tools.BuildStage('Test', true) {
     106                dir (BuildDir) {
     107                        sh "make VERSION=${Version} distcheck -j 8"
     108                }
     109        }
     110}
     111
     112def Archive() {
     113        Tools.BuildStage('Archive', true) {
     114                dir (BuildDir) {
     115                        archiveArtifacts artifacts: "cfa-cc-*.tar.gz", fingerprint: true
     116                }
     117        }
     118}
     119
    89120
    90121//===========================================================================================================
     
    107138                                        defaultValue: '',                                                               \
    108139                                ],                                                                                              \
     140                                [$class: 'StringParameterDefinition',                                           \
     141                                        description: 'Build Number to put into the version',                    \
     142                                        name: 'Build',                                                                  \
     143                                        defaultValue: '0',                                                              \
     144                                ],                                                                                              \
    109145                        ],
    110146                ]])
     
    121157        echo "Distributing git commit ${ref}"
    122158
    123         return params.GitRef
     159        return [params.GitRef, params.Build]
    124160}
    125161
Note: See TracChangeset for help on using the changeset viewer.