2015-10-08 16:07:36 -07:00
// Import the utility functionality.
import jobs.generation.Utilities ;
import jobs.generation.InternalUtilities ;
def project = 'dotnet/cli'
2015-10-21 11:24:23 -07:00
def osList = [ 'Ubuntu' , 'OSX' , 'Windows_NT' ]
2015-10-08 16:07:36 -07:00
2015-10-21 11:24:23 -07:00
def machineLabelMap = [ 'Ubuntu' : 'ubuntu' ,
'OSX' : 'mac' ,
'Windows_NT' : 'windows' ]
def static getBuildJobName ( def configuration , def os ) {
return configuration . toLowerCase ( ) + '_' + os . toLowerCase ( )
2015-10-08 16:07:36 -07:00
}
2015-10-21 11:24:23 -07:00
[ 'Debug' , 'Release' ] . each { configuration - >
osList . each { os - >
// Calculate names
def lowerConfiguration = configuration . toLowerCase ( )
2015-10-08 16:07:36 -07:00
2015-10-21 11:24:23 -07:00
// Calculate job name
def jobName = getBuildJobName ( configuration , os )
def buildCommand = '' ;
// Calculate the build command
if ( os = = 'Windows_NT' ) {
2015-10-21 12:27:02 -07:00
buildCommand = ".\\scripts\\ci_build.cmd ${lowerConfiguration}"
2015-10-21 11:24:23 -07:00
}
else {
buildCommand = "./scripts/ci_build.sh ${lowerConfiguration}"
}
// Create the new job
2015-10-21 12:39:14 -07:00
def newCommitJob = job ( InternalUtilities . getFullJobName ( project , jobName , false ) ) {
2015-10-21 11:24:23 -07:00
// Set the label.
label ( machineLabelMap [ os ] )
steps {
if ( os = = 'Windows_NT' ) {
// Batch
batchFile ( buildCommand )
}
else {
// Shell
shell ( buildCommand )
}
}
}
2015-10-08 16:07:36 -07:00
2015-10-21 11:24:23 -07:00
InternalUtilities . addPrivatePermissions ( newCommitJob )
InternalUtilities . addPrivateScm ( newCommitJob , project )
Utilities . addStandardOptions ( newCommitJob )
Utilities . addStandardNonPRParameters ( newCommitJob )
Utilities . addGithubPushTrigger ( newCommitJob )
2015-10-21 12:39:14 -07:00
def newPRJob = job ( InternalUtilities . getFullJobName ( project , jobName , true ) ) {
2015-10-21 11:24:23 -07:00
// Set the label.
label ( machineLabelMap [ os ] )
steps {
if ( os = = 'Windows_NT' ) {
// Batch
batchFile ( buildCommand )
}
else {
// Shell
shell ( buildCommand )
}
}
}
InternalUtilities . addPrivatePermissions ( newPRJob )
InternalUtilities . addPrivatePRTestSCM ( newPRJob , project )
Utilities . addStandardOptions ( newPRJob )
Utilities . addStandardPRParameters ( newPRJob , project )
Utilities . addGithubPRTrigger ( newPRJob , "${os} ${configuration} Build" )
}
}