Merge pull request #266 from nguerrera/vs-tools-nupkg
Generate nupkg of .NET Core SDK for internal build consumption
This commit is contained in:
commit
142fefca40
12 changed files with 95 additions and 93 deletions
16
eng/Signing.props
Normal file
16
eng/Signing.props
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<Project>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- Do not sign non-shipping packages -->
|
||||||
|
<ItemsToSign Remove="$(ArtifactsNonShippingPackagesDir)**\*.nupkg" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<!--
|
||||||
|
Signing of shipping artifacts (layout, msi, bundle) are handled separately.
|
||||||
|
It is therefore expected that above removal can yield an empty set.
|
||||||
|
-->
|
||||||
|
<AllowEmptySignList>true</AllowEmptySignList>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -27,12 +27,12 @@ IF /I "%Architecture:~0,3%"=="ARM" (
|
||||||
ECHO ##vso[task.setvariable variable=TestParameter]
|
ECHO ##vso[task.setvariable variable=TestParameter]
|
||||||
ECHO ##vso[task.setvariable variable=RunTests]false
|
ECHO ##vso[task.setvariable variable=RunTests]false
|
||||||
|
|
||||||
ECHO ##vso[task.setvariable variable=AdditionalBuildParameters]/p:SignCoreSdk=true /p:DotNetSignType=%SignType%
|
|
||||||
|
|
||||||
) ELSE (
|
) ELSE (
|
||||||
ECHO NOT ARM
|
ECHO NOT ARM
|
||||||
ECHO ##vso[task.setvariable variable=TestParameter]-test
|
ECHO ##vso[task.setvariable variable=TestParameter]-test
|
||||||
ECHO ##vso[task.setvariable variable=RunTests]true
|
ECHO ##vso[task.setvariable variable=RunTests]true
|
||||||
|
|
||||||
ECHO ##vso[task.setvariable variable=AdditionalBuildParameters]-sign /p:SignCoreSdk=true /p:DotNetSignType=%SignType%
|
)
|
||||||
)
|
|
||||||
|
ECHO ##vso[task.setvariable variable=AdditionalBuildParameters]-sign /p:DotNetSignType=%SignType%
|
||||||
|
|
|
@ -7,15 +7,27 @@
|
||||||
param(
|
param(
|
||||||
[string]$Configuration="Debug",
|
[string]$Configuration="Debug",
|
||||||
[string]$Architecture="x64",
|
[string]$Architecture="x64",
|
||||||
|
[switch]$Sign=$false,
|
||||||
|
[bool]$WarnAsError=$true,
|
||||||
[Parameter(ValueFromRemainingArguments=$true)][String[]]$ExtraParameters
|
[Parameter(ValueFromRemainingArguments=$true)][String[]]$ExtraParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
$RepoRoot = "$PSScriptRoot"
|
$RepoRoot = "$PSScriptRoot"
|
||||||
|
|
||||||
$ArchitectureParam="/p:Architecture=$Architecture"
|
$Parameters = "/p:Architecture=$Architecture"
|
||||||
$ConfigurationParam="-configuration $Configuration"
|
$Parameters = "$Parameters -configuration $Configuration"
|
||||||
|
|
||||||
|
if ($Sign) {
|
||||||
|
$Parameters = "$Parameters -sign /p:SignCoreSdk=true"
|
||||||
|
|
||||||
|
# Workaround https://github.com/dotnet/arcade/issues/1776
|
||||||
|
$WarnAsError = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
$Parameters = "$Parameters -WarnAsError `$$WarnAsError"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$ExpressionToInvoke = "$RepoRoot\eng\common\build.ps1 -restore -build $ConfigurationParam $ArchitectureParam $ExtraParameters"
|
$ExpressionToInvoke = "$RepoRoot\eng\common\build.ps1 -restore -build $Parameters $ExtraParameters"
|
||||||
Write-Host "Invoking expression: $ExpressionToInvoke"
|
Write-Host "Invoking expression: $ExpressionToInvoke"
|
||||||
Invoke-Expression $ExpressionToInvoke
|
Invoke-Expression $ExpressionToInvoke
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,13 @@
|
||||||
<SdkGenerateNupkgPowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatenupkg.ps1</SdkGenerateNupkgPowershellScript>
|
<SdkGenerateNupkgPowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatenupkg.ps1</SdkGenerateNupkgPowershellScript>
|
||||||
|
|
||||||
<SdkInstallerNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.$(Architecture).nuspec</SdkInstallerNuspecFile>
|
<SdkInstallerNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.$(Architecture).nuspec</SdkInstallerNuspecFile>
|
||||||
<SdkInstallerNupkgFile>$(ArtifactsShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg</SdkInstallerNupkgFile>
|
<SdkInstallerNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg</SdkInstallerNupkgFile>
|
||||||
|
<VSToolsNuspecFile>$(MSBuildThisFileDirectory)/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.$(Architecture).nuspec</VSToolsNuspecFile>
|
||||||
|
<VSToolsNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Tools.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg</VSToolsNupkgFile>
|
||||||
|
|
||||||
<!--<SdkMSBuildExtensionsNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec</SdkMSBuildExtensionsNuspecFile>
|
<!--<SdkMSBuildExtensionsNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec</SdkMSBuildExtensionsNuspecFile>
|
||||||
<SdkMSBuildExtensionsNupkgFile>$(ArtifactsShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.$(FullNugetVersion).nupkg</SdkMSBuildExtensionsNupkgFile>
|
<SdkMSBuildExtensionsNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.$(FullNugetVersion).nupkg</SdkMSBuildExtensionsNupkgFile>
|
||||||
<SdkMSBuildExtensionsSwrFile>$(ArtifactsShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr</SdkMSBuildExtensionsSwrFile>-->
|
<SdkMSBuildExtensionsSwrFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr</SdkMSBuildExtensionsSwrFile>-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -160,6 +162,21 @@
|
||||||
'$(SdkInstallerNupkgFile)'" />
|
'$(SdkInstallerNupkgFile)'" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="GenerateVSToolsNupkg"
|
||||||
|
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs;GenerateSdkBundle"
|
||||||
|
Condition=" '$(OS)' == 'Windows_NT' and '$(Architecture)' == 'x86'"
|
||||||
|
Inputs="$(RedistLayoutPath)/**/*;
|
||||||
|
$(VSToolsNuspecFile);
|
||||||
|
$(SdkGenerateNupkgPowershellScript)"
|
||||||
|
Outputs="$(VSToolsNupkgFile)">
|
||||||
|
|
||||||
|
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateNupkgPowershellScript) ^
|
||||||
|
'$(RedistLayoutPath.TrimEnd('\'))' ^
|
||||||
|
'$(FullNugetVersion)' ^
|
||||||
|
'$(VSToolsNuspecFile)' ^
|
||||||
|
'$(VSToolsNupkgFile)'" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="GenerateSdkMSBuildExtensionsNupkg"
|
<Target Name="GenerateSdkMSBuildExtensionsNupkg"
|
||||||
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs;GenerateSdkBundle"
|
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs;GenerateSdkBundle"
|
||||||
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "
|
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "
|
||||||
|
@ -191,6 +208,7 @@
|
||||||
GenerateSdkBundle;
|
GenerateSdkBundle;
|
||||||
SignSdkBundle;
|
SignSdkBundle;
|
||||||
GenerateSdkNupkg;
|
GenerateSdkNupkg;
|
||||||
|
GenerateVSToolsNupkg;
|
||||||
GenerateSdkMSBuildExtensionsNupkg"
|
GenerateSdkMSBuildExtensionsNupkg"
|
||||||
Condition=" '$(OS)' == 'Windows_NT' and !$(Architecture.StartsWith('arm'))" />
|
Condition=" '$(OS)' == 'Windows_NT' and !$(Architecture.StartsWith('arm'))" />
|
||||||
|
|
||||||
|
|
5
src/redist/targets/packaging/windows/clisdk/Init.cmd
Normal file
5
src/redist/targets/packaging/windows/clisdk/Init.cmd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
set DOTNET_MULTILELVEL_LOOKUP=0
|
||||||
|
set PATH=%~dp0;%PATH%
|
|
@ -13,6 +13,6 @@
|
||||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="[DOTNET_BUNDLE]\**\*" />
|
<file src="$DOTNET_BUNDLE$\**\*" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
|
@ -13,6 +13,6 @@
|
||||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="[DOTNET_BUNDLE]" />
|
<file src="$DOTNET_BUNDLE$" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
|
@ -13,6 +13,6 @@
|
||||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="[DOTNET_BUNDLE]" />
|
<file src="$DOTNET_BUNDLE$" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>VS.Tools.Net.Core.SDK.x86</id>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<title>VS.Tools.Net.Core.SDK.x86</title>
|
||||||
|
<authors>Microsoft</authors>
|
||||||
|
<owners>Microsoft</owners>
|
||||||
|
<licenseUrl>https://www.microsoft.com/net/dotnet_library_license.htm</licenseUrl>
|
||||||
|
<projectUrl>https://github.com/dotnet/cli</projectUrl>
|
||||||
|
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||||
|
<description>.Net Core SDK (x86) as a .nupkg for internal VS build consumption</description>
|
||||||
|
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="$DOTNET_BUNDLE$\**\*" />
|
||||||
|
<file src="Init.cmd" />
|
||||||
|
</files>
|
||||||
|
</package>
|
|
@ -1,26 +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\_utility.ps1
|
|
||||||
|
|
||||||
# Copy things from environment variables that were sent by the build scripts
|
|
||||||
$Rid = $env:Rid
|
|
||||||
$Tfm = $env:Tfm
|
|
||||||
$OutputDir = $env:OutputDir
|
|
||||||
$Stage1Dir = $env:Stage1Dir
|
|
||||||
$Stage1CompilationDir = $env:Stage1CompilationDir
|
|
||||||
$Stage2Dir = $env:Stage2Dir
|
|
||||||
$Stage2CompilationDir = $env:Stage2CompilationDir
|
|
||||||
$PackageDir = $env:PackageDir
|
|
||||||
$TestBinRoot = $env:TestBinRoot
|
|
||||||
$TestPackageDir = $env:TestPackageDir
|
|
||||||
|
|
||||||
$env:Channel = "$env:RELEASE_SUFFIX"
|
|
||||||
|
|
||||||
# Set reasonable defaults for unset variables
|
|
||||||
setEnvIfDefault "DOTNET_INSTALL_DIR" "$RepoRoot\.dotnet_stage0\win7-x64"
|
|
||||||
setEnvIfDefault "DOTNET_CLI_VERSION" "0.1.0.0"
|
|
||||||
setPathAndHomeIfDefault "$Stage2Dir"
|
|
||||||
setVarIfDefault "CONFIGURATION" "Debug"
|
|
|
@ -126,6 +126,6 @@ if(!(Test-Path $DotnetBundleOutput))
|
||||||
Exit -1
|
Exit -1
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output -ForegroundColor Green "Successfully created dotnet bundle - $DotnetBundleOutput"
|
Write-Output "Successfully created dotnet bundle - $DotnetBundleOutput"
|
||||||
|
|
||||||
exit $LastExitCode
|
exit $LastExitCode
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
# 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.
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
# This script is used to generate a nuget package with the windows installer bundle.
|
|
||||||
# The generated nupkg file is used to deliver the CLI payload to Visual Studio.
|
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)][string]$SdkBundlePath,
|
[Parameter(Mandatory=$true)][string]$SdkBundlePath,
|
||||||
[Parameter(Mandatory=$true)][string]$NugetVersion,
|
[Parameter(Mandatory=$true)][string]$NugetVersion,
|
||||||
|
@ -11,64 +8,25 @@ param(
|
||||||
[Parameter(Mandatory=$true)][string]$NupkgFile
|
[Parameter(Mandatory=$true)][string]$NupkgFile
|
||||||
)
|
)
|
||||||
|
|
||||||
. "$PSScriptRoot\_common.ps1"
|
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\..\..\..\.."
|
||||||
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.."
|
$NuGetDir = Join-Path $RepoRoot "artifacts\Tools\nuget"
|
||||||
$NuGetDir = Join-Path $RepoRoot ".nuget"
|
|
||||||
$NuGetExe = Join-Path $NuGetDir "nuget.exe"
|
$NuGetExe = Join-Path $NuGetDir "nuget.exe"
|
||||||
$OutputDirectory = [System.IO.Path]::GetDirectoryName($NupkgFile)
|
$OutputDirectory = [System.IO.Path]::GetDirectoryName($NupkgFile)
|
||||||
|
$SdkBundlePath = [System.IO.Path]::GetFullPath($SdkBundlePath)
|
||||||
|
|
||||||
function DownloadNugetExe
|
if (-not (Test-Path $NuGetDir)) {
|
||||||
{
|
New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null
|
||||||
if (-not (Test-Path $NuGetDir))
|
|
||||||
{
|
|
||||||
New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Test-Path $NuGetExe)) {
|
|
||||||
Write-Output 'Downloading nuget.exe to ' + $NuGetExe
|
|
||||||
wget https://dist.nuget.org/win-x86-commandline/v4.7.0/nuget.exe -OutFile $NuGetExe
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function GenerateNupkg
|
if (-not (Test-Path $NuGetExe)) {
|
||||||
{
|
# Using 3.5.0 to workaround https://github.com/NuGet/Home/issues/5016
|
||||||
if (-not (Test-Path $NuspecFile))
|
Write-Output "Downloading nuget.exe to $NuGetExe"
|
||||||
{
|
wget https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe -OutFile $NuGetExe
|
||||||
Write-Output 'Error nuspec not found - $NuspecFile'
|
|
||||||
}
|
|
||||||
|
|
||||||
$SdkBundlePath = [System.IO.Path]::GetFullPath($SdkBundlePath)
|
|
||||||
$NuspecFileName = [System.IO.Path]::GetFileName($NuspecFile)
|
|
||||||
$TempNuspecFile = [System.IO.Path]::Combine($OutputDirectory, $NuspecFileName)
|
|
||||||
(Get-Content $NuspecFile) -replace '\[DOTNET_BUNDLE\]', $SdkBundlePath | Set-Content $TempNuspecFile
|
|
||||||
& $NuGetExe pack $TempNuspecFile -Version $NugetVersion -OutputDirectory $OutputDirectory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Test-Path $NupkgFile) {
|
||||||
if(!(Test-Path $SdkBundlePath))
|
|
||||||
{
|
|
||||||
throw "$SdkBundlePath not found"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output "Creating nupkg for Sdk installer"
|
|
||||||
|
|
||||||
DownloadNugetExe
|
|
||||||
|
|
||||||
if(Test-Path $NupkgFile)
|
|
||||||
{
|
|
||||||
Remove-Item -Force $NupkgFile
|
Remove-Item -Force $NupkgFile
|
||||||
}
|
}
|
||||||
|
|
||||||
if(-Not (GenerateNupkg))
|
& $NuGetExe pack $NuspecFile -Version $NugetVersion -OutputDirectory $OutputDirectory -NoPackageAnalysis -Properties DOTNET_BUNDLE=$SdkBundlePath
|
||||||
{
|
Exit $LastExitCode
|
||||||
Exit -1
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(Test-Path $NupkgFile))
|
|
||||||
{
|
|
||||||
throw "$NupkgFile not generated"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output -ForegroundColor Green "Successfully created installer nupkg - $NupkgFile"
|
|
||||||
|
|
||||||
exit $LastExitCode
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue