From 128683be0ec7661a4bfaad50a83b1efb564aa5c4 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 17 Aug 2017 15:00:10 -0700 Subject: [PATCH 01/12] Pinning versions for 2.0.0 --- NuGet.config | 2 +- build/dependencies.props | 14 +++++++------- version.props | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/NuGet.config b/NuGet.config index 37f0d27..6a62aed 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,7 +2,7 @@ - + diff --git a/build/dependencies.props b/build/dependencies.props index fdda160..bf62853 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,12 +1,12 @@ - + - 2.0.0-* + 2.0.0 5.0.2 - 2.0.1-* + 2.0.1-rtm-15400 10.0.1 - 2.0.0-* - 2.0.0-* - 2.0.0-* - 4.8.0-* + 2.0.0 + 2.0.0 + 2.0.0 + 4.8.0 diff --git a/version.props b/version.props index eba6b16..e69e2c6 100644 --- a/version.props +++ b/version.props @@ -2,6 +2,5 @@ 2.0.0 - rtm From 051150475f53122b9a4d1ba65c8b1c3f2cc58a48 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 15 Sep 2017 18:00:22 -0700 Subject: [PATCH 02/12] Bump version to 2.0.1 --- build/common.props | 1 - version.props | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/common.props b/build/common.props index 34b8864..a557617 100644 --- a/build/common.props +++ b/build/common.props @@ -9,7 +9,6 @@ $(MSBuildThisFileDirectory)Key.snk true true - $(VersionSuffix)-$(BuildNumber) true diff --git a/version.props b/version.props index e69e2c6..b68865a 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,9 @@ - - 2.0.0 + 2.0.1 + rtm + $(VersionPrefix) + $(VersionPrefix)-$(VersionSuffix)-final + $(VersionSuffix)-$(BuildNumber) From 77cac3b6bea5f2f685b06fb49a7d98c337f12f23 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 18 Sep 2017 12:42:26 -0700 Subject: [PATCH 03/12] Update package feeds and dependencies for 2.0.1 (#1284) --- .gitignore | 3 ++ Directory.Build.targets | 4 +++ NuGet.config | 1 + build/dependencies.targets | 63 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 Directory.Build.targets create mode 100644 build/dependencies.targets diff --git a/.gitignore b/.gitignore index 100aa3b..614a304 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ nuget.exe .vs/ npm-debug.log /.build/ +global.json +*.g.targets +korebuild-lock.txt # The templates can't contain their own .gitignore files, because Yeoman has strange default handling for # files with that name (https://github.com/npm/npm/issues/1862). So, each template instead has a template_gitignore diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..d8f1db6 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/NuGet.config b/NuGet.config index 6a62aed..21510b3 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/build/dependencies.targets b/build/dependencies.targets new file mode 100644 index 0000000..38ce78d --- /dev/null +++ b/build/dependencies.targets @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 98385cbcb01705c9b3f235d83d08a24569a6773c Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 19 Sep 2017 13:46:49 -0700 Subject: [PATCH 04/12] Update bootstrappers --- build.cmd | 2 +- build.ps1 | 223 +++++++++++++++++++++++++++++++++++++------------ build.sh | 244 +++++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 379 insertions(+), 90 deletions(-) diff --git a/build.cmd b/build.cmd index 7d4894c..b6c8d24 100755 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" diff --git a/build.ps1 b/build.ps1 index 1785334..b7081bc 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,67 +1,186 @@ -$ErrorActionPreference = "Stop" +#!/usr/bin/env powershell +#requires -version 4 -function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) +<# +.SYNOPSIS +Build this repository + +.DESCRIPTION +Downloads korebuild if required. Then builds the repository. + +.PARAMETER Path +The folder to build. Defaults to the folder containing this script. + +.PARAMETER Channel +The channel of KoreBuild to download. Overrides the value from the config file. + +.PARAMETER DotNetHome +The directory where .NET Core tools will be stored. + +.PARAMETER ToolsSource +The base url where build tools can be downloaded. Overrides the value from the config file. + +.PARAMETER Update +Updates KoreBuild to the latest version even if a lock file is present. + +.PARAMETER ConfigFile +The path to the configuration file that stores values. Defaults to version.props. + +.PARAMETER MSBuildArgs +Arguments to be passed to MSBuild + +.NOTES +This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. +When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. + +The $ConfigFile is expected to be an JSON file. It is optional, and the configuration values in it are optional as well. Any options set +in the file are overridden by command line parameters. + +.EXAMPLE +Example config file: +```json { - while($true) - { - try - { - Invoke-WebRequest $url -OutFile $downloadLocation - break - } - catch - { - $exceptionMessage = $_.Exception.Message - Write-Host "Failed to download '$url': $exceptionMessage" - if ($retries -gt 0) { - $retries-- - Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" - Start-Sleep -Seconds 10 + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", + "channel": "dev", + "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" +} +``` +#> +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$Path = $PSScriptRoot, + [Alias('c')] + [string]$Channel, + [Alias('d')] + [string]$DotNetHome, + [Alias('s')] + [string]$ToolsSource, + [Alias('u')] + [switch]$Update, + [string]$ConfigFile = $null, + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$MSBuildArgs +) +Set-StrictMode -Version 2 +$ErrorActionPreference = 'Stop' + +# +# Functions +# + +function Get-KoreBuild { + + $lockFile = Join-Path $Path 'korebuild-lock.txt' + + if (!(Test-Path $lockFile) -or $Update) { + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile + } + + $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 + if (!$version) { + Write-Error "Failed to parse version from $lockFile. Expected a line that begins with 'version:'" + } + $version = $version.TrimStart('version:').Trim() + $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version) + + if (!(Test-Path $korebuildPath)) { + Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version" + New-Item -ItemType Directory -Path $korebuildPath | Out-Null + $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip" + + try { + $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" + Get-RemoteFile $remotePath $tmpfile + if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { + # Use built-in commands where possible as they are cross-plat compatible + Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath } - else - { - $exception = $_.Exception - throw $exception + else { + # Fallback to old approach for old installations of PowerShell + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath) } } + catch { + remove-item -Recurse -Force $korebuildPath -ErrorAction Ignore + throw + } + finally { + remove-item $tmpfile -ErrorAction Ignore + } + } + + return $korebuildPath +} + +function Join-Paths([string]$path, [string[]]$childPaths) { + $childPaths | ForEach-Object { $path = Join-Path $path $_ } + return $path +} + +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { + if ($RemotePath -notlike 'http*') { + Copy-Item $RemotePath $LocalPath + return + } + + $retries = 10 + while ($retries -gt 0) { + $retries -= 1 + try { + Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + return + } + catch { + Write-Verbose "Request failed. $retries retries remaining" + } + } + + Write-Error "Download failed: '$RemotePath'." +} + +# +# Main +# + +# Load configuration or set defaults + +$Path = Resolve-Path $Path +if (!$ConfigFile) { $ConfigFile = Join-Path $Path 'korebuild.json' } + +if (Test-Path $ConfigFile) { + try { + $config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json + if ($config) { + if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } + if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} + } + } catch { + Write-Warning "$ConfigFile could not be read. Its settings will be ignored." + Write-Warning $Error[0] } } -cd $PSScriptRoot - -$repoFolder = $PSScriptRoot -$env:REPO_FOLDER = $repoFolder - -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" -if ($env:KOREBUILD_ZIP) -{ - $koreBuildZip=$env:KOREBUILD_ZIP +if (!$DotNetHome) { + $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } ` + elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} ` + elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}` + else { Join-Path $PSScriptRoot '.dotnet'} } -$buildFolder = ".build" -$buildFile="$buildFolder\KoreBuild.ps1" +if (!$Channel) { $Channel = 'dev' } +if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } -if (!(Test-Path $buildFolder)) { - Write-Host "Downloading KoreBuild from $koreBuildZip" +# Execute - $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() - New-Item -Path "$tempFolder" -Type directory | Out-Null +$korebuildPath = Get-KoreBuild +Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') - $localZipFile="$tempFolder\korebuild.zip" - - DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) - - New-Item -Path "$buildFolder" -Type directory | Out-Null - copy-item "$tempFolder\**\build\*" $buildFolder -Recurse - - # Cleanup - if (Test-Path $tempFolder) { - Remove-Item -Recurse -Force $tempFolder - } +try { + Install-Tools $ToolsSource $DotNetHome + Invoke-RepositoryBuild $Path @MSBuildArgs +} +finally { + Remove-Module 'KoreBuild' -ErrorAction Ignore } - -&"$buildFile" @args diff --git a/build.sh b/build.sh index 5e27ed8..9e32358 100755 --- a/build.sh +++ b/build.sh @@ -1,46 +1,216 @@ #!/usr/bin/env bash -repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" -if [ ! -z $KOREBUILD_ZIP ]; then - koreBuildZip=$KOREBUILD_ZIP -fi +set -euo pipefail -buildFolder=".build" -buildFile="$buildFolder/KoreBuild.sh" +# +# variables +# -if test ! -d $buildFolder; then - echo "Downloading KoreBuild from $koreBuildZip" +RESET="\033[0m" +RED="\033[0;31m" +YELLOW="\033[0;33m" +MAGENTA="\033[0;95m" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +config_file="$DIR/korebuild.json" +verbose=false +update=false +repo_path="$DIR" +channel='' +tools_source='' - tempFolder="/tmp/KoreBuild-$(uuidgen)" - mkdir $tempFolder +# +# Functions +# +__usage() { + echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "" + echo "Arguments:" + echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." + echo "" + echo "Options:" + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo "" + echo "Description:" + echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." + echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - localZipFile="$tempFolder/korebuild.zip" - - retries=6 - until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) - do - echo "Failed to download '$koreBuildZip'" - if [ "$retries" -le 0 ]; then - exit 1 - fi - retries=$((retries - 1)) - echo "Waiting 10 seconds before retrying. Retries left: $retries" - sleep 10s - done - - unzip -q -d $tempFolder $localZipFile - - mkdir $buildFolder - cp -r $tempFolder/**/build/** $buildFolder - - chmod +x $buildFile - - # Cleanup - if test -d $tempFolder; then - rm -rf $tempFolder + if [[ "${1:-}" != '--no-exit' ]]; then + exit 2 fi +} + +get_korebuild() { + local lock_file="$repo_path/korebuild-lock.txt" + if [ ! -f $lock_file ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + fi + local version="$(grep 'version:*' -m 1 $lock_file)" + if [[ "$version" == '' ]]; then + __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" + return 1 + fi + version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" + + { + if [ ! -d "$korebuild_path" ]; then + mkdir -p "$korebuild_path" + local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" + tmpfile="$(mktemp)" + echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" + if __get_remote_file $remote_path $tmpfile; then + unzip -q -d "$korebuild_path" $tmpfile + fi + rm $tmpfile || true + fi + + source "$korebuild_path/KoreBuild.sh" + } || { + if [ -d "$korebuild_path" ]; then + echo "Cleaning up after failed installation" + rm -rf "$korebuild_path" || true + fi + return 1 + } +} + +__error() { + echo -e "${RED}error: $*${RESET}" 1>&2 +} + +__warn() { + echo -e "${YELLOW}warning: $*${RESET}" +} + +__machine_has() { + hash "$1" > /dev/null 2>&1 + return $? +} + +__get_remote_file() { + local remote_path=$1 + local local_path=$2 + + if [[ "$remote_path" != 'http'* ]]; then + cp $remote_path $local_path + return 0 + fi + + failed=false + if __machine_has curl ; then + curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true + elif __machine_has wget; then + wget --tries 10 -O $local_path $remote_path || failed=true + else + failed=true + fi + + if [ "$failed" = true ]; then + __error "Download failed: $remote_path" 1>&2 + return 1 + fi +} + +# +# main +# + +while [[ $# > 0 ]]; do + case $1 in + -\?|-h|--help) + __usage --no-exit + exit 0 + ;; + -c|--channel|-Channel) + shift + channel=${1:-} + [ -z "$channel" ] && __usage + ;; + --config-file|-ConfigFile) + shift + config_file="${1:-}" + [ -z "$config_file" ] && __usage + if [ ! -f "$config_file" ]; then + __error "Invalid value for --config-file. $config_file does not exist." + exit 1 + fi + ;; + -d|--dotnet-home|-DotNetHome) + shift + DOTNET_HOME=${1:-} + [ -z "$DOTNET_HOME" ] && __usage + ;; + --path|-Path) + shift + repo_path="${1:-}" + [ -z "$repo_path" ] && __usage + ;; + -s|--tools-source|-ToolsSource) + shift + tools_source="${1:-}" + [ -z "$tools_source" ] && __usage + ;; + -u|--update|-Update) + update=true + ;; + --verbose|-Verbose) + verbose=true + ;; + --) + shift + break + ;; + *) + break + ;; + esac + shift +done + +if ! __machine_has unzip; then + __error 'Missing required command: unzip' + exit 1 fi -$buildFile -r $repoFolder "$@" +if ! __machine_has curl && ! __machine_has wget; then + __error 'Missing required command. Either wget or curl is required.' + exit 1 +fi + +[ -z "${config_file:-}" ] && config_file="$repo_path/korebuild.json" +if [ -f "$config_file" ]; then + if __machine_has jq ; then + if jq '.' "$config_file" >/dev/null ; then + config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")" + config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + elif __machine_has python ; then + if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then + config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")" + config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + else + __warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.' + fi + + [ ! -z "${config_channel:-}" ] && channel="$config_channel" + [ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source" +fi + +[ -z "$channel" ] && channel='dev' +[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' + +get_korebuild +install_tools "$tools_source" "$DOTNET_HOME" +invoke_repository_build "$repo_path" $@ From 0c058894c2cee6dc1dcf560e0abafbadd474fba3 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 19 Sep 2017 13:53:08 -0700 Subject: [PATCH 05/12] Update bootstrappers --- korebuild.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 korebuild.json diff --git a/korebuild.json b/korebuild.json new file mode 100644 index 0000000..6bbc5ee --- /dev/null +++ b/korebuild.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/rel/2.0.2/tools/korebuild.schema.json", + "channel": "rel/2.0.2" +} From e0ab3ddccaeb61de4eba64dd73a09c70318108d7 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 20 Sep 2017 13:40:18 -0700 Subject: [PATCH 06/12] Update the list of packages patching in 2.0.x --- build/dependencies.targets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build/dependencies.targets b/build/dependencies.targets index 38ce78d..13a0992 100644 --- a/build/dependencies.targets +++ b/build/dependencies.targets @@ -1,8 +1,22 @@  + + + + + + + + + + + + + + @@ -50,6 +64,7 @@ + From dc5e980efabdec2d50e3f68a8dda223a2f1245a7 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 20 Sep 2017 17:23:18 -0700 Subject: [PATCH 07/12] Update build scripts, tools, and dependencies for 2.0.x --- build.sh | 40 ++++++++++++---------- build/dependencies.targets | 69 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index 9e32358..5138fc4 100755 --- a/build.sh +++ b/build.sh @@ -23,7 +23,7 @@ tools_source='' # Functions # __usage() { - echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]" echo "" echo "Arguments:" echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." @@ -47,16 +47,17 @@ __usage() { } get_korebuild() { + local version local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f $lock_file ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + if [ ! -f "$lock_file" ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" fi - local version="$(grep 'version:*' -m 1 $lock_file)" + version="$(grep 'version:*' -m 1 "$lock_file")" if [[ "$version" == '' ]]; then __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" return 1 fi - version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" { @@ -65,10 +66,10 @@ get_korebuild() { local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" tmpfile="$(mktemp)" echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file $remote_path $tmpfile; then - unzip -q -d "$korebuild_path" $tmpfile + if __get_remote_file "$remote_path" "$tmpfile"; then + unzip -q -d "$korebuild_path" "$tmpfile" fi - rm $tmpfile || true + rm "$tmpfile" || true fi source "$korebuild_path/KoreBuild.sh" @@ -99,19 +100,22 @@ __get_remote_file() { local local_path=$2 if [[ "$remote_path" != 'http'* ]]; then - cp $remote_path $local_path + cp "$remote_path" "$local_path" return 0 fi - failed=false - if __machine_has curl ; then - curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true - elif __machine_has wget; then - wget --tries 10 -O $local_path $remote_path || failed=true + local failed=false + if __machine_has wget; then + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true else failed=true fi + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + fi + if [ "$failed" = true ]; then __error "Download failed: $remote_path" 1>&2 return 1 @@ -122,7 +126,7 @@ __get_remote_file() { # main # -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do case $1 in -\?|-h|--help) __usage --no-exit @@ -130,7 +134,7 @@ while [[ $# > 0 ]]; do ;; -c|--channel|-Channel) shift - channel=${1:-} + channel="${1:-}" [ -z "$channel" ] && __usage ;; --config-file|-ConfigFile) @@ -144,7 +148,7 @@ while [[ $# > 0 ]]; do ;; -d|--dotnet-home|-DotNetHome) shift - DOTNET_HOME=${1:-} + DOTNET_HOME="${1:-}" [ -z "$DOTNET_HOME" ] && __usage ;; --path|-Path) @@ -213,4 +217,4 @@ fi get_korebuild install_tools "$tools_source" "$DOTNET_HOME" -invoke_repository_build "$repo_path" $@ +invoke_repository_build "$repo_path" "$@" diff --git a/build/dependencies.targets b/build/dependencies.targets index 13a0992..71e2a8c 100644 --- a/build/dependencies.targets +++ b/build/dependencies.targets @@ -4,8 +4,12 @@ + + + + @@ -15,13 +19,36 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -33,6 +60,8 @@ + + @@ -44,12 +73,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -62,9 +123,15 @@ + + + + + + @@ -74,5 +141,7 @@ + + \ No newline at end of file From 63e0af2ee8d3e9facd09c7816b7dd6836221d8b6 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 29 Sep 2017 17:02:10 -0700 Subject: [PATCH 08/12] Import dependencies.props last to ensure TargetFramework is set first --- Directory.Build.targets | 1 + build/common.props | 1 - build/dependencies.props | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index d8f1db6..5d5f288 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,4 +1,5 @@ + diff --git a/build/common.props b/build/common.props index a557617..9929eab 100644 --- a/build/common.props +++ b/build/common.props @@ -1,5 +1,4 @@ - diff --git a/build/dependencies.props b/build/dependencies.props index bf62853..9357b01 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -9,4 +9,6 @@ 2.0.0 4.8.0 + + From 9f05a3d34b3522781e31c79f48e1aa0d6f2273c8 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 2 Oct 2017 14:12:55 -0700 Subject: [PATCH 09/12] Use MSBuild to set NuGet feeds instead of NuGet.config --- Directory.Build.targets | 1 + NuGet.config | 5 +---- build/sources.props | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 build/sources.props diff --git a/Directory.Build.targets b/Directory.Build.targets index 5d5f288..7bf9e76 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,4 +1,5 @@ + diff --git a/NuGet.config b/NuGet.config index 21510b3..e32bddf 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,9 +2,6 @@ - - - - + diff --git a/build/sources.props b/build/sources.props new file mode 100644 index 0000000..ff68f68 --- /dev/null +++ b/build/sources.props @@ -0,0 +1,14 @@ + + + + + $(DotNetRestoreSources) + + $(RestoreSources); + https://dotnet.myget.org/F/aspnet-2-0-2-october2017-patch/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; + https://api.nuget.org/v3/index.json; + + + From 86e94d7812d0c8790ebcb32a6ae6935b85648d9c Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 9 Oct 2017 11:10:58 -0700 Subject: [PATCH 10/12] Update how PackageReference versions are set Changes: - Remove floating versions - Disable myget feeds during a Universe build - Use package-specific MSBuild variables. Pattern = `packageId.Pascalize() + "PackageVersion"`, with a few exceptions. --- Directory.Build.targets | 4 +- build/common.props | 5 +- build/dependencies.props | 23 ++- build/dependencies.targets | 147 ------------------ build/sources.props | 5 +- samples/misc/LatencyTest/LatencyTest.csproj | 2 +- .../NodeServicesExamples.csproj | 16 +- samples/misc/Webpack/Webpack.csproj | 16 +- ...oft.AspNetCore.NodeServices.Sockets.csproj | 2 +- .../Microsoft.AspNetCore.NodeServices.csproj | 6 +- .../Microsoft.AspNetCore.SpaServices.csproj | 4 +- 11 files changed, 44 insertions(+), 186 deletions(-) delete mode 100644 build/dependencies.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index 7bf9e76..246f7ac 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,4 @@ - + - - diff --git a/build/common.props b/build/common.props index 9929eab..32a20bd 100644 --- a/build/common.props +++ b/build/common.props @@ -12,10 +12,7 @@ - + - - - diff --git a/build/dependencies.props b/build/dependencies.props index 9357b01..7cd34f5 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,13 +1,20 @@  - 2.0.0 - 5.0.2 - 2.0.1-rtm-15400 - 10.0.1 - 2.0.0 - 2.0.0 - 2.0.0 - 4.8.0 + 2.0.2-beta-15522 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.0 + 2.0.0 + 2.0.0 + 10.0.1 + 4.8.0 diff --git a/build/dependencies.targets b/build/dependencies.targets deleted file mode 100644 index 71e2a8c..0000000 --- a/build/dependencies.targets +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/sources.props b/build/sources.props index ff68f68..804940f 100644 --- a/build/sources.props +++ b/build/sources.props @@ -3,11 +3,14 @@ $(DotNetRestoreSources) - + $(RestoreSources); https://dotnet.myget.org/F/aspnet-2-0-2-october2017-patch/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; + + + $(RestoreSources); https://api.nuget.org/v3/index.json; diff --git a/samples/misc/LatencyTest/LatencyTest.csproj b/samples/misc/LatencyTest/LatencyTest.csproj index 43d5f17..b0b234e 100644 --- a/samples/misc/LatencyTest/LatencyTest.csproj +++ b/samples/misc/LatencyTest/LatencyTest.csproj @@ -14,7 +14,7 @@ - + diff --git a/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj b/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj index eedacab..88dc0f8 100644 --- a/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj +++ b/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj @@ -1,4 +1,4 @@ - + @@ -13,13 +13,13 @@ - - - - - - - + + + + + + + diff --git a/samples/misc/Webpack/Webpack.csproj b/samples/misc/Webpack/Webpack.csproj index eedacab..88dc0f8 100644 --- a/samples/misc/Webpack/Webpack.csproj +++ b/samples/misc/Webpack/Webpack.csproj @@ -1,4 +1,4 @@ - + @@ -13,13 +13,13 @@ - - - - - - - + + + + + + + diff --git a/src/Microsoft.AspNetCore.NodeServices.Sockets/Microsoft.AspNetCore.NodeServices.Sockets.csproj b/src/Microsoft.AspNetCore.NodeServices.Sockets/Microsoft.AspNetCore.NodeServices.Sockets.csproj index 1e3e542..41900b2 100644 --- a/src/Microsoft.AspNetCore.NodeServices.Sockets/Microsoft.AspNetCore.NodeServices.Sockets.csproj +++ b/src/Microsoft.AspNetCore.NodeServices.Sockets/Microsoft.AspNetCore.NodeServices.Sockets.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj b/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj index 7f7822e..86018db 100644 --- a/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj +++ b/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/Microsoft.AspNetCore.SpaServices/Microsoft.AspNetCore.SpaServices.csproj b/src/Microsoft.AspNetCore.SpaServices/Microsoft.AspNetCore.SpaServices.csproj index 730c944..c0eabf9 100644 --- a/src/Microsoft.AspNetCore.SpaServices/Microsoft.AspNetCore.SpaServices.csproj +++ b/src/Microsoft.AspNetCore.SpaServices/Microsoft.AspNetCore.SpaServices.csproj @@ -14,8 +14,8 @@ - - + + From 64389a9bbeda7378c80b4c302700ddcb78d4f0aa Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 13 Oct 2017 12:59:05 -0700 Subject: [PATCH 11/12] Update build tools to 2.0.2-rc1-15526 and dependencies to 2.0.1-rtm-105 --- .gitignore | 1 - build.ps1 | 4 ++-- build.sh | 2 +- build/dependencies.props | 20 ++++++++++---------- korebuild-lock.txt | 2 ++ 5 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 korebuild-lock.txt diff --git a/.gitignore b/.gitignore index 614a304..d405668 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ npm-debug.log /.build/ global.json *.g.targets -korebuild-lock.txt # The templates can't contain their own .gitignore files, because Yeoman has strange default handling for # files with that name (https://github.com/npm/npm/issues/1862). So, each template instead has a template_gitignore diff --git a/build.ps1 b/build.ps1 index b7081bc..f2be7cb 100644 --- a/build.ps1 +++ b/build.ps1 @@ -103,11 +103,11 @@ function Get-KoreBuild { } } catch { - remove-item -Recurse -Force $korebuildPath -ErrorAction Ignore + Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore throw } finally { - remove-item $tmpfile -ErrorAction Ignore + Remove-Item $tmpfile -ErrorAction Ignore } } diff --git a/build.sh b/build.sh index 5138fc4..14d84a8 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,7 @@ RED="\033[0;31m" YELLOW="\033[0;33m" MAGENTA="\033[0;95m" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" config_file="$DIR/korebuild.json" verbose=false update=false diff --git a/build/dependencies.props b/build/dependencies.props index 7cd34f5..2b1037e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,15 +1,15 @@  - 2.0.2-beta-15522 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 + 2.0.2-rc1-15526 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 2.0.0 2.0.0 2.0.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt new file mode 100644 index 0000000..632c589 --- /dev/null +++ b/korebuild-lock.txt @@ -0,0 +1,2 @@ +version:2.0.2-rc1-15526 +commithash:436afc3dc08f5e278431db807866cc5f032f4d7b From d5a664e4817a395cbafec942387162b5afeba7bf Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 6 Dec 2017 16:20:14 -0800 Subject: [PATCH 12/12] Bump version to 2.0.2 --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index b68865a..aeff39f 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@ - 2.0.1 + 2.0.2 rtm $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final