Refactor the build scripts

- Bifurcate Package and Publish targets to enable signing.
- Move publish from bash/ps into c#.
- Create multiple targets to create MSIs and Bundles.
This commit is contained in:
Sridhar Periyasamy 2016-03-07 12:20:50 -08:00
parent 781678de92
commit d4a3190bfc
25 changed files with 754 additions and 577 deletions

View file

@ -141,6 +141,3 @@ execute_build
DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb")
execute_test
# Publish
$REPOROOT/scripts/publish/publish.sh $DEBIAN_FILE

View file

@ -1,38 +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.
#
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
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
if [ ! -d "$STAGE2_DIR" ]; then
error "missing stage2 output in $STAGE2_DIR" 1>&2
exit
fi
PACKAGE_DIR=$REPOROOT/artifacts/packages/dnvm
[ -d "$PACKAGE_DIR" ] || mkdir -p $PACKAGE_DIR
PACKAGE_SHORT_NAME=dotnet-${OSNAME}-x64.${DOTNET_CLI_VERSION}
PACKAGE_NAME=$PACKAGE_DIR/${PACKAGE_SHORT_NAME}.tar.gz
cd $STAGE2_DIR
header "Packaging $PACKAGE_SHORT_NAME"
# Tar up the stage2 artifacts
# We need both "*" and ".version" to ensure we pick up that file
tar -czf $PACKAGE_NAME * .version
info "Packaged stage2 from '$STAGE2_DIR' to '$PACKAGE_NAME'"
$REPOROOT/scripts/publish/publish.sh $PACKAGE_NAME

View file

@ -1,25 +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
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
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
if [[ "$OSNAME" == "ubuntu" ]]; then
# Create Debian package
$REPOROOT/scripts/package/package-debian.sh
elif [[ "$OSNAME" == "osx" ]]; then
# Create OSX PKG
$REPOROOT/packaging/osx/package-osx.sh
fi

View file

@ -1,44 +0,0 @@
#
# 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.
#
. "$PSScriptRoot\..\common\_common.ps1"
if(!(Test-Path $PackageDir)) {
mkdir $PackageDir | Out-Null
}
if(![string]::IsNullOrEmpty($env:DOTNET_CLI_VERSION)) {
$PackageVersion = $env:DOTNET_CLI_VERSION
} else {
$Timestamp = [DateTime]::Now.ToString("yyyyMMddHHmmss")
$PackageVersion = "0.0.1-dev-t$Timestamp"
}
# Stamp the output with the commit metadata and version number
$Commit = git rev-parse HEAD
$VersionContent = @"
$Commit
$PackageVersion
"@
$VersionContent | Out-File -Encoding UTF8 "$Stage2Dir\.version"
$PackageName = Join-Path $PackageDir "dotnet-win-$env:ARCHITECTURE.$PackageVersion.zip"
if (Test-Path $PackageName)
{
del $PackageName
}
Add-Type -Assembly System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($Stage2Dir, $PackageName, "Optimal", $false)
Write-Host "Packaged stage2 to $PackageName"
$PublishScript = Join-Path $PSScriptRoot "..\publish\publish.ps1"
& $PublishScript -file $PackageName
exit $LastExitCode

View file

@ -1,6 +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.
powershell -NoProfile -NoLogo -Command "%~dp0package.ps1 %*; exit $LastExitCode;"

View file

@ -1,24 +0,0 @@
#
# 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.
#
. "$PSScriptRoot\..\common\_common.ps1"
$RepoRoot = Convert-Path "$PSScriptRoot\..\.."
header "Generating zip package"
_ "$RepoRoot\scripts\package\package-zip.ps1"
header "Generating dotnet MSI"
_ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
header "Generating NuGet packages"
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$env:VersionSuffix")
header "Generating version badge"
$VersionBadge = "$RepoRoot\resources\images\version_badge.svg"
$BadgeDestination = "$RepoRoot\artifacts\version_badge.svg"
(get-content $VersionBadge).replace("ver_number", "$env:DOTNET_CLI_VERSION") | set-content $BadgeDestination
& "$RepoRoot\scripts\publish\publish.ps1" -file $BadgeDestination

View file

@ -1,40 +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.
#
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
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
export REPOROOT="$(cd -P "$DIR/../.." && pwd)"
set -e
source "$DIR/../common/_common.sh"
if [ -z "$DOTNET_CLI_VERSION" ]; then
TIMESTAMP=$(date "+%Y%m%d%H%M%S")
DOTNET_CLI_VERSION=0.0.1-dev-t$TIMESTAMP
fi
VERSION_BADGE="$REPOROOT/resources/images/version_badge.svg"
BADGE_DESTINATION="$REPOROOT/artifacts/version_badge.svg"
header "Generating tarball"
$DIR/package-dnvm.sh
header "Generating Native Installer"
$DIR/package-native.sh
header "Generating version badge"
sed "s/ver_number/$DOTNET_CLI_VERSION/g" $VERSION_BADGE > $BADGE_DESTINATION
header "Publishing version badge"
$DIR/../publish/publish.sh $BADGE_DESTINATION