Update build tools to 2.0.3-rtm-10005

This commit is contained in:
Nate McMaster 2017-12-08 00:05:32 -08:00
parent 88e66f2b21
commit 49c952a035
11 changed files with 201 additions and 11 deletions

View File

@ -23,6 +23,9 @@ The base url where build tools can be downloaded. Overrides the value from the c
.PARAMETER Update .PARAMETER Update
Updates KoreBuild to the latest version even if a lock file is present. Updates KoreBuild to the latest version even if a lock file is present.
.PARAMETER Reinstall
Re-installs KoreBuild
.PARAMETER ConfigFile .PARAMETER ConfigFile
The path to the configuration file that stores values. Defaults to version.props. The path to the configuration file that stores values. Defaults to version.props.
@ -57,6 +60,7 @@ param(
[string]$ToolsSource, [string]$ToolsSource,
[Alias('u')] [Alias('u')]
[switch]$Update, [switch]$Update,
[switch]$Reinstall,
[string]$ConfigFile = $null, [string]$ConfigFile = $null,
[Parameter(ValueFromRemainingArguments = $true)] [Parameter(ValueFromRemainingArguments = $true)]
[string[]]$MSBuildArgs [string[]]$MSBuildArgs
@ -84,6 +88,10 @@ function Get-KoreBuild {
$version = $version.TrimStart('version:').Trim() $version = $version.TrimStart('version:').Trim()
$korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version) $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version)
if ($Reinstall -and (Test-Path $korebuildPath)) {
Remove-Item -Force -Recurse $korebuildPath
}
if (!(Test-Path $korebuildPath)) { if (!(Test-Path $korebuildPath)) {
Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version" Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version"
New-Item -ItemType Directory -Path $korebuildPath | Out-Null New-Item -ItemType Directory -Path $korebuildPath | Out-Null
@ -103,11 +111,11 @@ function Get-KoreBuild {
} }
} }
catch { catch {
remove-item -Recurse -Force $korebuildPath -ErrorAction Ignore Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore
throw throw
} }
finally { finally {
remove-item $tmpfile -ErrorAction Ignore Remove-Item $tmpfile -ErrorAction Ignore
} }
} }

View File

@ -15,6 +15,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
config_file="$DIR/korebuild.json" config_file="$DIR/korebuild.json"
verbose=false verbose=false
update=false update=false
reinstall=false
repo_path="$DIR" repo_path="$DIR"
channel='' channel=''
tools_source='' tools_source=''
@ -36,6 +37,7 @@ __usage() {
echo " --path <PATH> The directory to build. Defaults to the directory containing the script." echo " --path <PATH> The directory to build. Defaults to the directory containing the script."
echo " -s|--tools-source <URL> The base url where build tools can be downloaded. Overrides the value from the config file." echo " -s|--tools-source <URL> 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 " -u|--update Update to the latest KoreBuild even if the lock file is present."
echo " --reinstall Reinstall KoreBuild."
echo "" echo ""
echo "Description:" 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 " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be."
@ -60,6 +62,10 @@ get_korebuild() {
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" local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version"
if [ "$reinstall" = true ] && [ -d "$korebuild_path" ]; then
rm -rf "$korebuild_path"
fi
{ {
if [ ! -d "$korebuild_path" ]; then if [ ! -d "$korebuild_path" ]; then
mkdir -p "$korebuild_path" mkdir -p "$korebuild_path"
@ -164,6 +170,9 @@ while [[ $# -gt 0 ]]; do
-u|--update|-Update) -u|--update|-Update)
update=true update=true
;; ;;
--reinstall|-[Rr]einstall)
reinstall=true
;;
--verbose|-Verbose) --verbose|-Verbose)
verbose=true verbose=true
;; ;;

View File

@ -43,10 +43,11 @@
<!-- If there are duplicate properties, the properties which are defined later in the order would override the earlier ones --> <!-- If there are duplicate properties, the properties which are defined later in the order would override the earlier ones -->
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath)</RepositoryBuildArguments> <RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath)</RepositoryBuildArguments> <RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:BuildNumber=$(BuildNumber) /p:Configuration=$(Configuration)</RepositoryBuildArguments> <RepositoryBuildArguments>$(RepositoryBuildArguments) /p:BuildNumber=$(BuildNumber)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:Configuration=$(Configuration)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /noconsolelogger '/l:RepoTasks.FlowLogger,$(MSBuildThisFileDirectory)tasks\bin\publish\RepoTasks.dll;Summary;FlowId=$(RepositoryToBuild)'</RepositoryBuildArguments> <RepositoryBuildArguments>$(RepositoryBuildArguments) /noconsolelogger '/l:RepoTasks.FlowLogger,$(MSBuildThisFileDirectory)tasks\bin\publish\RepoTasks.dll;Summary;FlowId=$(RepositoryToBuild)'</RepositoryBuildArguments>
<BuildArguments>$(_RepositoryBuildTargets) $(RepositoryBuildArguments)</BuildArguments> <BuildArguments>/t:CleanArtifacts $(_RepositoryBuildTargets) $(RepositoryBuildArguments)</BuildArguments>
<RepositoryArtifactsRoot>$(BuildRepositoryRoot)artifacts</RepositoryArtifactsRoot> <RepositoryArtifactsRoot>$(BuildRepositoryRoot)artifacts</RepositoryArtifactsRoot>
<RepositoryArtifactsBuildDirectory>$(RepositoryArtifactsRoot)\build\</RepositoryArtifactsBuildDirectory> <RepositoryArtifactsBuildDirectory>$(RepositoryArtifactsRoot)\build\</RepositoryArtifactsBuildDirectory>
<RepositoryArtifactsMSBuildDirectory>$(RepositoryArtifactsRoot)\msbuild\</RepositoryArtifactsMSBuildDirectory> <RepositoryArtifactsMSBuildDirectory>$(RepositoryArtifactsRoot)\msbuild\</RepositoryArtifactsMSBuildDirectory>

View File

@ -11,6 +11,7 @@
DotNetRestoreSourcesPropsPath=$(GeneratedRestoreSourcesPropsPath); DotNetRestoreSourcesPropsPath=$(GeneratedRestoreSourcesPropsPath);
BuildNumber=$(BuildNumber); BuildNumber=$(BuildNumber);
Configuration=$(Configuration); Configuration=$(Configuration);
SkipBillOfMaterials=true;
</TemplateProjCommmonProperties> </TemplateProjCommmonProperties>
<TemplateProjProperties> <TemplateProjProperties>
$(TemplateProjCommmonProperties); $(TemplateProjCommmonProperties);
@ -26,7 +27,7 @@
<!-- Produce regular, timestamped templates for pre-release builds --> <!-- Produce regular, timestamped templates for pre-release builds -->
<MSBuild Projects="$(MSBuildProjectFullPath)" <MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Restore;Compile;Package" Targets="CleanArtifacts;Restore;Compile;Package"
Properties="$(TemplateProjProperties)" /> Properties="$(TemplateProjProperties)" />
<ItemGroup> <ItemGroup>
@ -55,7 +56,7 @@
<!-- Rebuild the templates without restoring. (The non-timestamped packages don't exist yet.) --> <!-- Rebuild the templates without restoring. (The non-timestamped packages don't exist yet.) -->
<MSBuild Projects="$(MSBuildProjectFullPath)" <MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Prepare;Compile;Package" Targets="CleanArtifacts;Prepare;Compile;Package"
Properties="$(TemplateProjNoTimestampProperties);NoRestore=true" /> Properties="$(TemplateProjNoTimestampProperties);NoRestore=true" />
<ItemGroup> <ItemGroup>

View File

@ -89,7 +89,7 @@
<!-- ASP.NET Core Tools feed --> <!-- ASP.NET Core Tools feed -->
<PropertyGroup> <PropertyGroup>
<AspNetCoreToolsFeed>https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json</AspNetCoreToolsFeed> <AspNetCoreToolsFeed>https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json</AspNetCoreToolsFeed>
<InternalAspNetCoreSdkPackageVersion>2.0.2-rc1-16007</InternalAspNetCoreSdkPackageVersion> <InternalAspNetCoreSdkPackageVersion>$(KoreBuildVersion)</InternalAspNetCoreSdkPackageVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -2,6 +2,8 @@
<PropertyGroup> <PropertyGroup>
<!-- This repo does not have solutions to build --> <!-- This repo does not have solutions to build -->
<DisableDefaultTargets>true</DisableDefaultTargets> <DisableDefaultTargets>true</DisableDefaultTargets>
<!-- Skip BOM generation -->
<SkipBillOfMaterials>true</SkipBillOfMaterials>
</PropertyGroup> </PropertyGroup>
<Import Project="artifacts.props" /> <Import Project="artifacts.props" />

View File

@ -106,6 +106,13 @@
<Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" /> <Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" />
</MSBuild> </MSBuild>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetArtifactInfo"
Properties="RepositoryRoot=$(TemplatingProjectRoot);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" />
</MSBuild>
<MSBuild Projects="$(MSBuildProjectFullPath)" <MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="ResolveSolutions" Targets="ResolveSolutions"
Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)" Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"

View File

@ -1,2 +1,2 @@
version:2.0.2-rc1-16007 version:2.0.3-rtm-10005
commithash:bccf097cd0fceb185b7bf6aa8981191304cea9a7 commithash:767fa0dcd1cca6b0a722b7b6a3919f698fbd1325

View File

@ -1,4 +1,4 @@
{ {
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/rel/2.0.2/tools/korebuild.schema.json", "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.0.0/tools/korebuild.schema.json",
"channel": "rel/2.0.2" "channel": "release/2.0.0"
} }

View File

@ -0,0 +1,66 @@
<#
.SYNOPSIS
Updates the version.props file in repos to a newer patch version
.PARAMETER Repos
A list of the repositories that should be patched
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string[]]$Repos,
)
$ErrorActionPreference = 'Stop'
function SaveXml($xml, [string]$path) {
Write-Verbose "Saving to $path"
$ErrorActionPreference = 'stop'
$settings = New-Object System.XML.XmlWriterSettings
$settings.OmitXmlDeclaration = $true
$settings.Encoding = New-Object System.Text.UTF8Encoding( $true )
$writer = [System.XML.XMLTextWriter]::Create($path, $settings)
$xml.Save($writer)
$writer.Close()
}
function LoadXml([string]$path) {
Write-Verbose "Reading to $path"
$ErrorActionPreference = 'stop'
$obj = new-object xml
$obj.PreserveWhitespace = $true
$obj.Load($path)
return $obj
}
function BumpPatch([System.Xml.XmlNode]$node) {
if (-not $node) {
return
}
[version] $version = $node.InnerText
$node.InnerText = "{0}.{1}.{2}" -f $version.Major, $version.Minor, ($version.Build + 1)
}
foreach ($repo in $Repos) {
$path = "$PSScriptRoot/../modules/$repo/version.props"
if (-not (Test-Path $path)) {
Write-Warning "$path does not exist"
continue
}
$path = Resolve-Path $path
Write-Verbose "$path"
[xml] $xml = LoadXml $path
$suffix = $xml.SelectSingleNode('/Project/PropertyGroup/VersionSuffix')
if (-not $suffix) {
write-error "$path does not have VersionSuffix"
}
$versionPrefix = $xml.SelectSingleNode('/Project/PropertyGroup/VersionPrefix')
$epxVersionPrefix = $xml.SelectSingleNode('/Project/PropertyGroup/ExperimentalProjectVersionPrefix')
BumpPatch $epxVersionPrefix
BumpPatch $versionPrefix
SaveXml $xml $path
}

View File

@ -0,0 +1,96 @@
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Updates the build tools version and generates a commit message with the list of changes
.PARAMETER RepoRoot
The directory containing the repo
.PARAMETER GitAuthorName
The author name to use in the commit message. (Optional)
.PARAMETER GitAuthorEmail
The author email to use in the commit message. (Optional)
.PARAMETER GitCommitArgs
Additional arguments to pass into git-commit
.PARAMETER NoCommit
Make changes without executing git-commit
.PARAMETER Force
Specified this to make a commit with any changes
#>
[cmdletbinding(SupportsShouldProcess = $true)]
param(
[string]$RepoRoot,
[string]$GitAuthorName = $null,
[string]$GitAuthorEmail = $null,
[string[]]$GitCommitArgs = @(),
[switch]$NoCommit,
[switch]$Force
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2
if (-not $RepoRoot) {
$RepoRoot = Resolve-Path "$PSScriptRoot\.."
}
Import-Module "$PSScriptRoot/common.psm1" -Scope Local -Force
function Get-KoreBuildVersion {
$lockFile = "$RepoRoot/korebuild-lock.txt"
if (!(Test-Path $lockFile)) {
return ''
}
$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()
return $version
}
Push-Location $RepoRoot
try {
Assert-Git
$oldVersion = Get-KoreBuildVersion
# Executes a command that no-ops. The only thing we really need is the updated version of korebuild-lock.txt
& "$RepoRoot/build.ps1" -Update '-t:Noop' | Out-Null
$newVersion = Get-KoreBuildVersion
if ($oldVersion -eq $newVersion) {
Write-Host -ForegroundColor Magenta 'No changes to build tools'
exit 0
}
Invoke-Block { git add "$RepoRoot/korebuild-lock.txt" }
Invoke-Block { git add "$RepoRoot/build/dependencies.props" }
$shortMessage = "Updating BuildTools from $oldVersion to $newVersion"
# add this to the commit message to make it possible to filter commit triggers based on message
$message = "$shortMessage`n`n[auto-updated: buildtools]"
if (-not $NoCommit -and ($Force -or ($PSCmdlet.ShouldContinue($shortMessage, 'Create a new commit with these changes?')))) {
$gitConfigArgs = @()
if ($GitAuthorName) {
$gitConfigArgs += '-c', "user.name=$GitAuthorName"
}
if ($GitAuthorEmail) {
$gitConfigArgs += '-c', "user.email=$GitAuthorEmail"
}
Invoke-Block { git @gitConfigArgs commit -m $message @GitCommitArgs }
}
else {
# If composing this script with others, return the message that would have been used
return @{
message = $message
}
}
}
finally {
Pop-Location
}