diff --git a/build.sh b/build.sh index 416b8459..1f8e693d 100755 --- a/build.sh +++ b/build.sh @@ -3,51 +3,8 @@ # Copyright (c) .NET Foundation and contributors. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. # - -# Set OFFLINE environment variable to build offline - set -e -initHostDistroRid() -{ - if [ "$__HostOS" == "Linux" ]; then - if [ ! -e /etc/os-release ]; then - echo "WARNING: Can not determine runtime id for current distro." - __HostDistroRid="" - else - source /etc/os-release - __HostDistroRid="$ID.$VERSION_ID-$__HostArch" - fi - fi -} - -initTargetDistroRid() -{ - if [ $__CrossBuild == 1 ]; then - if [ "$__BuildOS" == "Linux" ]; then - if [ ! -e $ROOTFS_DIR/etc/os-release ]; then - echo "WARNING: Can not determine runtime id for current distro." - export __DistroRid="" - else - source $ROOTFS_DIR/etc/os-release - export __DistroRid="$ID.$VERSION_ID-$__BuildArch" - fi - fi - else - export __DistroRid="$__HostDistroRid" - fi - - # Portable builds target the base RID - if [ $__PortableBuild == 1 ]; then - if [ "$__BuildOS" == "Linux" ]; then - export __DistroRid="linux-$__BuildArch" - elif [ "$__BuildOS" == "OSX" ]; then - export __DistroRid="osx-$__BuildArch" - fi - fi -} - - SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" @@ -64,179 +21,4 @@ if [ -z "$HOME" ] || [ ! -d "$HOME" ]; then mkdir -p $HOME fi - -# Use uname to determine what the CPU is. - -CPUName=$(uname -p) - -# Some Linux platforms report unknown for platform, but the arch for machine. - -if [ "$CPUName" == "unknown" ]; then - - CPUName=$(uname -m) - -fi - - - -case $CPUName in - i686) - echo "Unsupported CPU $CPUName detected, build might not succeed!" - __BuildArch=x86 - __HostArch=x86 - ;; - - x86_64) - __BuildArch=x64 - __HostArch=x64 - ;; - - armv7l) - echo "Unsupported CPU $CPUName detected, build might not succeed!" - __BuildArch=arm - __HostArch=arm - ;; - - aarch64) - __BuildArch=arm64 - __HostArch=arm64 - ;; - - *) - echo "Unknown CPU $CPUName detected, configuring as if for x64" - __BuildArch=x64 - __HostArch=x64 - ;; -esac - -# Use uname to determine what the OS is. -OSName=$(uname -s) -case $OSName in - Linux) - __BuildOS=Linux - __HostOS=Linux - ;; - - Darwin) - __BuildOS=OSX - __HostOS=OSX - ;; - - FreeBSD) - __BuildOS=FreeBSD - __HostOS=FreeBSD - ;; - - OpenBSD) - __BuildOS=OpenBSD - __HostOS=OpenBSD - ;; - - NetBSD) - __BuildOS=NetBSD - __HostOS=NetBSD - ;; - - SunOS) - __BuildOS=SunOS - __HostOS=SunOS - ;; - - *) - echo "Unsupported OS $OSName detected, configuring as if for Linux" - __BuildOS=Linux - __HostOS=Linux - ;; -esac - -__BuildType=Debug -__BuildArch=x64 -__SkipTests=false -__DisableCrossgen=false -__VerboseBuild=0 -__CrossBuild=0 -__PortableBuild=0 - -while :; do - if [ $# -le 0 ]; then - break - fi - - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -\?|-h|--help) - usage - exit 1 - ;; - - x86) - __BuildArch=x86 - ;; - - x64) - __BuildArch=x64 - ;; - - arm) - __BuildArch=arm - ;; - - armel) - __BuildArch=armel - ;; - - arm64) - __BuildArch=arm64 - ;; - - debug) - __BuildType=Debug - ;; - - release) - __BuildType=Release - ;; - - cross) - __CrossBuild=1 - ;; - - -portable) - __PortableBuild=1 - ;; - - verbose) - __VerboseBuild=1 - ;; - - skiptests) - __SkipTests=true - ;; - disablecrossgen) - __DisableCrossgen=true - ;; - esac - - shift -done - -# init the host distro name -initHostDistroRid - -# init the target distro name -initTargetDistroRid - -__RunArgs="-TargetArchitecture=$__BuildArch -ConfigurationGroup=$__BuildType -OSGroup=$__HostOS -DistroRid=$__DistroRid -SkipTests=$__SkipTests -DisableCrossgen=$__DisableCrossgen" - -if [ $__PortableBuild == 1 ]; then - __RunArgs="$__RunArgs -PortableBuild=True" -fi - -# Configure environment if we are doing a verbose build -if [ $__VerboseBuild == 1 ]; then - export VERBOSE=1 - __RunArgs="$__RunArgs -verbose" -fi - -echo "$__RunArgs" -$DIR/run.sh build $__RunArgs \ No newline at end of file +$DIR/run.sh build "$@" diff --git a/buildpipeline/Core-Setup-Linux-BT.json b/buildpipeline/Core-Setup-Linux-BT.json index b705ff6a..545eed30 100644 --- a/buildpipeline/Core-Setup-Linux-BT.json +++ b/buildpipeline/Core-Setup-Linux-BT.json @@ -287,7 +287,7 @@ "allowOverride": true }, "PB_BuildArguments": { - "value": "--skip-prereqs --configuration $(BuildConfiguration) $(PB_AdditionalBuildArguments)", + "value": "-ConfigurationGroup=$(BuildConfiguration) $(PB_AdditionalBuildArguments)", "allowOverride": true }, "CONNECTION_STRING": { @@ -455,4 +455,4 @@ "state": "wellFormed", "revision": 418097676 } -} \ No newline at end of file +} diff --git a/buildpipeline/Core-Setup-OSX-BT.json b/buildpipeline/Core-Setup-OSX-BT.json index e5521940..a7be705a 100644 --- a/buildpipeline/Core-Setup-OSX-BT.json +++ b/buildpipeline/Core-Setup-OSX-BT.json @@ -194,7 +194,7 @@ "allowOverride": true }, "PB_BuildArguments": { - "value": "--skip-prereqs --configuration $(BuildConfiguration) $(PB_PortableBuildArg)", + "value": "-ConfigurationGroup=$(BuildConfiguration) $(PB_PortableBuildArg)", "allowOverride": true }, "CONNECTION_STRING": { @@ -243,7 +243,7 @@ "value": "x64" }, "PB_PortableBuildArg": { - "value": "-portable" + "value": "-PortableBuild=true" }, "PB_PortableBuild": { "value": "true" @@ -311,4 +311,4 @@ "state": "wellFormed", "revision": 418097676 } -} \ No newline at end of file +} diff --git a/buildpipeline/pipeline.json b/buildpipeline/pipeline.json index 93ed732a..1940eb8a 100644 --- a/buildpipeline/pipeline.json +++ b/buildpipeline/pipeline.json @@ -82,7 +82,7 @@ "Parameters": { "PB_DistroRid": "rhel.7.2-x64", "PB_DockerTag": "rhel7_prereqs_2", - "PB_AdditionalBuildArguments":"-portable", + "PB_AdditionalBuildArguments":"-PortableBuild=true", "PB_PortableBuild": "true" }, "ReportingParameters": { @@ -98,7 +98,7 @@ "PB_DistroRid": "ubuntu.14.04-arm", "PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239", "PB_TargetArchitecture": "arm", - "PB_AdditionalBuildArguments":"arm cross disablecrossgen -portable skiptests", + "PB_AdditionalBuildArguments":"-TargetArchitecture=arm -DistroRid=linux-arm -DisableCrossgen=true -PortableBuild=true -SkipTests=true", "PB_CrossBuildArgs": "-e ROOTFS_DIR ", "PB_PortableBuild": "true" }, @@ -112,7 +112,7 @@ { "Name": "Core-Setup-OSX-BT", "Parameters": { - "PB_PortableBuildArg": "-portable", + "PB_PortableBuildArg": "-PortableBuild=true", "PB_PortableBuild": "true" }, "ReportingParameters": { @@ -209,4 +209,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/config.json b/config.json index 7805ebe4..87255ec4 100644 --- a/config.json +++ b/config.json @@ -4,7 +4,7 @@ "description": "OS Group for result binaries.", "valueType": "property", "values": ["Windows_NT", "Linux", "OSX", "FreeBSD", "NetBSD"], - "defaultValue": "Windows_NT" + "defaultValue": "${OSName}" }, "RestoreDuringBuild": { "description": "Enables/Disables the restoration of packages.", @@ -34,7 +34,7 @@ "description": "Specifies the distro rid for Unix OS.", "valueType": "property", "values": [], - "defaultValue": "${OSRid}" + "defaultValue": "${OSRid}-${CPUArch}" }, "TargetArchitecture":{ "description": "Build for the specified architecture (x64, x86 (supported only on Windows), arm, or arm64, default: x64)", diff --git a/netci.groovy b/netci.groovy index 464ab6b8..232e06f3 100644 --- a/netci.groovy +++ b/netci.groovy @@ -29,8 +29,6 @@ platformList.each { platform -> def dockerContainer = '' def dockerWorkingDirectory = "/src/core-setup" def dockerCommand = '' - def portableArgs = '' - // Calculate build command if (os == 'Windows_NT') { buildCommand = ".\\build.cmd -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}" @@ -46,18 +44,17 @@ platformList.each { platform -> else if (os == 'Ubuntu16.04') { dockerContainer = "ubuntu-16.04-cross-ef0ac75-20175511035548" } - portableArgs = " -portable cross skiptests disablecrossgen" dockerCommand = "docker run --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}" - buildCommand = "${dockerCommand} ./build.sh ${configuration} ${architecture}${portableArgs}" + buildCommand = "${dockerCommand} ./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture} -PortableBuild=true -DistroRid=linux-${architecture} -SkipTests=true -DisableCrossgen=true" } else if (os == "Ubuntu") { dockerContainer = "ubuntu-14.04-debpkg-e5cf912-20175003025046" dockerCommand = "docker run --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}" - buildCommand = "${dockerCommand} ./build.sh ${configuration} ${architecture}${portableArgs}" + buildCommand = "${dockerCommand} ./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}" } else if (os == "PortableLinux") { // Jenkins non-Ubuntu CI machines don't have docker - buildCommand = "./build.sh ${configuration} ${architecture} -portable" + buildCommand = "./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture} -PortableBuild=true" // Trigger a portable Linux build that runs on RHEL7.2 osForGHTrigger = "PortableLinux" @@ -65,7 +62,7 @@ platformList.each { platform -> } else { // Jenkins non-Ubuntu CI machines don't have docker - buildCommand = "./build.sh ${configuration} ${architecture}" + buildCommand = "./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}" } def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {