1 // Copyright (c) .NET Foundation and contributors. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
4 // Import the utility functionality.
6 import jobs.generation.Utilities;
7 import jobs.generation.ArchivalSettings;
9 def project = GithubProject
10 def branch = GithubBranchName
13 def platformList = ['Linux:x64:Release', 'Linux:arm:Release', 'Linux:arm64:Release', 'OSX:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT:arm:Debug', 'Tizen:armel:Release']
15 def static getBuildJobName(def configuration, def os, def architecture) {
16 return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase()
19 platformList.each { platform ->
21 def (os, architecture, configuration) = platform.tokenize(':')
23 // Calculate the job name
24 def jobName = getBuildJobName(configuration, os, architecture)
25 def buildCommand = '';
26 def osForGHTrigger = os
27 def version = "latest-or-auto"
28 def dockerRepository = "microsoft/dotnet-buildtools-prereqs"
29 def dockerContainer = ''
30 def dockerWorkingDirectory = "/src/core-setup"
31 def dockerCommand = ''
32 def crossbuildargs = ''
33 def buildArgs = "-ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}"
35 if (os != 'Windows_NT' && configuration == 'Release') {
36 buildArgs += " -strip-symbols"
39 // Calculate build command
40 if (os == 'Windows_NT') {
41 buildCommand = ".\\build.cmd ${buildArgs}"
42 if ((architecture == 'arm' || architecture == 'arm64')) {
43 buildCommand += " -SkipTests=true"
46 else if (os == 'Tizen') {
47 dockerRepository = "gbalykov/dotnet-buildtools-prereqs"
48 dockerContainer = "ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-4.0m2"
50 dockerCommand = "docker run -e ROOTFS_DIR=/crossrootfs/${architecture}.tizen.build --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}"
51 buildArgs += " -SkipTests=true -DisableCrossgen=true -PortableBuild=false -CrossBuild=true -- /p:OverridePackageSource=https:%2F%2Ftizen.myget.org/F/dotnet-core/api/v3/index.json /p:OutputRid=tizen.4.0.0-${architecture}"
52 buildCommand = "${dockerCommand} ./build.sh ${buildArgs}"
54 else if (os == "Linux") {
56 // Prep for Portable Linux builds take place on Ubuntu 14.04
57 if (architecture == 'arm' || architecture == 'armel' || architecture == 'arm64') {
58 if (architecture == 'arm64') {
59 dockerContainer = "ubuntu-16.04-cross-arm64-a3ae44b-20180316023254"
62 dockerContainer = "ubuntu-14.04-cross-e435274-20180323032140"
64 dockerCommand = "docker run -e ROOTFS_DIR=/crossrootfs/${architecture} --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}"
65 buildArgs += " -SkipTests=true -CrossBuild=true"
67 if (architecture == 'armel') {
68 buildArgs += " -DisableCrossgen=true"
71 buildCommand = "${dockerCommand} ./build.sh ${buildArgs}"
73 osForGHTrigger = "Linux"
77 // Jenkins non-Ubuntu CI machines don't have docker
78 buildCommand = "./build.sh ${buildArgs}"
80 // Trigger a portable Linux build that runs on RHEL7.2
81 osForGHTrigger = "Linux"
86 // Jenkins non-Ubuntu CI machines don't have docker
87 buildCommand = "./build.sh ${buildArgs}"
91 def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
94 if (os == 'Windows_NT' || os == 'Windows_2016') {
96 batchFile(buildCommand)
105 Utilities.setMachineAffinity(newJob, os, version)
106 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
108 if (!(architecture == 'arm' || architecture == 'armel' || architecture == 'arm64')) {
109 Utilities.addMSTestResults(newJob, '**/*-testResults.trx')
112 Utilities.addGithubPRTriggerForBranch(newJob, branch, "${osForGHTrigger} ${architecture} ${configuration} Build")
114 ArchivalSettings settings = new ArchivalSettings();
115 def archiveString = ["tar.gz", "zip", "deb", "msi", "pkg", "exe", "nupkg"].collect { "Bin/*/packages/*.${it},Bin/*/corehost/*.${it}" }.join(",")
116 settings.addFiles(archiveString)
117 settings.setArchiveOnSuccess()
118 settings.setFailIfNothingArchived()
120 Utilities.addArchival(newJob, settings)
123 // **************************
124 // Define ARM64 building.
125 // **************************
126 //['Windows_NT'].each { os ->
127 // ['Release'].each { configurationGroup ->
128 // def newJobName = "${configurationGroup.toLowerCase()}_${os.toLowerCase()}_arm64"
129 // def arm64Users = ['ianhays', 'kyulee1', 'gkhanna79', 'weshaggard', 'stephentoub', 'rahku', 'ramarag']
130 // def newJob = job(Utilities.getFullJobName(project, newJobName, /* isPR */ false)) {
132 // // build the world, but don't run the tests
133 // batchFile("build.cmd -ConfigurationGroup ${configurationGroup} -Architecure x64 -TargetArch arm64 -ToolsetDir C:\\ats2 -Framework netcoreapp1.1")
137 // // Kick off the test run
139 // archiveArtifacts {
140 // pattern("artifacts/win10-arm64/packages/*.zip")
141 // pattern("artifacts/win10-arm64/corehost/*.nupkg")
142 // onlyIfSuccessful(true)
148 // // Set up standard options.
149 // Utilities.standardJobSetup(newJob, project, /* isPR */ false, "*/${branch}")
151 // // Set a daily trigger
152 // Utilities.addPeriodicTrigger(newJob, '@daily')
154 // // Set up a PR trigger that is only triggerable by certain members
155 // Utilities.addPrivateGithubPRTriggerForBranch(newJob, branch, "Windows_NT ARM64 ${configurationGroup} Build", "(?i).*test\\W+ARM64\\W+${os}\\W+${configurationGroup}", null, arm64Users)
157 // // Set up a per-push trigger
158 // Utilities.addGithubPushTrigger(newJob)
162 // Make the call to generate the help job
163 Utilities.createHelperJob(this, project, branch,
164 "Welcome to the ${project} Repository", // This is prepended to the help message
165 "Have a nice day!") // This is appended to the help message. You might put known issues here.