Merge pull request #1436 from dotnet/anurse/restore-no-package

restore the NoPackage switch for VSO signing build
This commit is contained in:
Andrew Stanton-Nurse 2016-02-16 12:24:54 -08:00
commit eb607fec08
6 changed files with 72 additions and 95 deletions

View file

@ -16,6 +16,40 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
while [[ $# > 0 ]]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-c|--configuration)
export CONFIGURATION=$2
shift
;;
--nopackage)
export DOTNET_BUILD_SKIP_PACKAGING=1
;;
--docker)
export BUILD_IN_DOCKER=1
export DOCKER_IMAGENAME=$2
shift
;;
--help)
echo "Usage: $0 [--configuration <CONFIGURATION>] [--nopackage] [--docker <IMAGENAME>] [--help] <TARGETS...>"
echo ""
echo "Options:"
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
echo " --nopackage Skip packaging targets"
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
echo " --help Display this help message"
echo " <TARGETS...> The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
exit 0
;;
*)
break
;;
esac
shift
done
# Check if we need to build in docker
if [ ! -z "$BUILD_IN_DOCKER" ]; then
$DIR/scripts/dockerbuild.sh "$@"

View file

@ -26,10 +26,14 @@ def static getBuildJobName(def configuration, def os) {
// Calculate the build command
if (os == 'Windows_NT') {
buildCommand = ".\\scripts\\ci_build.cmd ${lowerConfiguration}"
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} Default"
}
else if (os == 'Ubuntu') {
buildCommand = "./build.sh --configuration ${lowerConfiguration} --docker ubuntu Default"
}
else {
buildCommand = "./scripts/ci_build.sh ${lowerConfiguration}"
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh --configuration ${lowerConfiguration} Default"
}
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
@ -57,4 +61,4 @@ def static getBuildJobName(def configuration, def os) {
}
}
}
}
}

View file

@ -1,12 +0,0 @@
@echo off
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
set CI_BUILD=1
set CONFIGURATION=%1
set VERBOSE=1
CALL %~dp0..\build.cmd %2
exit /b %errorlevel%

View file

@ -1,79 +0,0 @@
#!/usr/bin/env bash
#
# 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 -e
export CI_BUILD=1
export NO_COLOR=1
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
while [[ $# > 0 ]]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
"release" | "--release")
export CONFIGURATION=Release
;;
"debug" | "--debug")
export CONFIGURATION=Debug
;;
"offline" | "--offline")
export OFFLINE=true
;;
"nopackage" | "--nopackage")
export NOPACKAGE=true
;;
"--buildindocker-ubuntu")
export BUILD_IN_DOCKER=1
export DOCKER_IMAGENAME=ubuntu
;;
"--buildindocker-centos")
export BUILD_IN_DOCKER=1
export DOCKER_IMAGENAME=centos
;;
*)
break
;;
esac
shift
done
# Tell install scripts to skip pre-req check since the CI has the pre-reqs but not ldconfig it seems
# Also, install to a directory under the repo root since we don't have permission to work elsewhere
export DOTNET_INSTALL_SKIP_PREREQS=1
# Some things depend on HOME and it may not be set. We should fix those things, but until then, we just patch a value in
if [ -z "$HOME" ]; then
export HOME=$SCRIPT_DIR/../artifacts/home
[ ! -d "$HOME" ] || rm -Rf $HOME
mkdir -p $HOME
fi
# Set Docker Container name to be unique
container_name=""
#Jenkins
[ ! -z "$BUILD_TAG" ] && container_name="$BUILD_TAG"
#VSO
[ ! -z "$BUILD_BUILDID" ] && container_name="$BUILD_BUILDID"
export DOTNET_BUILD_CONTAINER_NAME="$container_name"
## CentOS-based CI machines don't have docker, ditto OSX. So only build in docker if we're on Ubuntu
#if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
#export BUILD_IN_DOCKER=1
#fi
VERBOSE=1 $SCRIPT_DIR/../build.sh "$@"

View file

@ -14,6 +14,12 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(PrepareTargets.Init))]
public static BuildTargetResult Publish(BuildTargetContext c)
{
if (string.Equals(Environment.GetEnvironmentVariable("DOTNET_BUILD_SKIP_PACKAGING"), "1", StringComparison.Ordinal))
{
c.Info("Skipping packaging because DOTNET_BUILD_SKIP_PACKAGING is set");
return c.Success();
}
// NOTE(anurse): Currently, this just invokes the remaining build scripts as-is. We should port those to C# as well, but
// I want to get the merged in.

View file

@ -4,10 +4,33 @@
#
param(
[string]$Configuration="Debug")
[string]$Configuration="Debug",
[switch]$NoPackage,
[switch]$Help)
if($Help)
{
Write-Host "Usage: .\build.cmd [-Configuration <CONFIGURATION>] [-NoPackage] [-Help] <TARGETS...>"
Write-Host ""
Write-Host "Options:"
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
Write-Host " -NoPackage Skip packaging targets"
Write-Host " -Help Display this help message"
Write-Host " <TARGETS...> The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
exit 0
}
$env:CONFIGURATION = $Configuration;
if($NoPackage)
{
$env:DOTNET_BUILD_SKIP_PACKAGING=1
}
else
{
$env:DOTNET_BUILD_SKIP_PACKAGING=0
}
# Load Branch Info
cat "$PSScriptRoot\..\branchinfo.txt" | ForEach-Object {
if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) {
@ -50,6 +73,7 @@ if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
# Run the builder
Write-Host "Invoking Build Scripts..."
Write-Host " Configuration: $env:CONFIGURATION"
$env:DOTNET_HOME="$env:DOTNET_INSTALL_DIR\cli"
& "$PSScriptRoot\dotnet-cli-build\bin\dotnet-cli-build.exe" @args
if($LASTEXITCODE -ne 0) { throw "Build failed" }