Generate nupkg of .NET Core SDK for internal build consumption
Also clean up a bunch of issues with the generatenupkg script: * Output from nuget pack was getting lost * Non-existent file was imported * Literal '-ForegroundColor Green' was printed to the screen (didn't actually change the color) * nuget.exe was being put inside the src/ tree, moved to artifacts/Tools/nuget * Temporary nuspec was created unnecessarily, now use -Properties instead of search and replace * Downgraded to nuget 3.5.0 to workaround a perf issue in nuget 4.x pack
This commit is contained in:
parent
e0a91a6d5e
commit
d2491511e5
9 changed files with 58 additions and 84 deletions
|
@ -21,6 +21,8 @@
|
|||
|
||||
<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>
|
||||
<VSToolsNuspecFile>$(MSBuildThisFileDirectory)/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.$(Architecture).nuspec</VSToolsNuspecFile>
|
||||
<VSToolsNupkgFile>$(ArtifactsShippingPackagesDir)VS.Tools.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg</VSToolsNupkgFile>
|
||||
|
||||
<!--<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>
|
||||
|
@ -160,6 +162,21 @@
|
|||
'$(SdkInstallerNupkgFile)'" />
|
||||
</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"
|
||||
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs;GenerateSdkBundle"
|
||||
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "
|
||||
|
@ -191,6 +208,7 @@
|
|||
GenerateSdkBundle;
|
||||
SignSdkBundle;
|
||||
GenerateSdkNupkg;
|
||||
GenerateVSToolsNupkg;
|
||||
GenerateSdkMSBuildExtensionsNupkg"
|
||||
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>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="[DOTNET_BUNDLE]\**\*" />
|
||||
<file src="$DOTNET_BUNDLE$\**\*" />
|
||||
</files>
|
||||
</package>
|
|
@ -13,6 +13,6 @@
|
|||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="[DOTNET_BUNDLE]" />
|
||||
<file src="$DOTNET_BUNDLE$" />
|
||||
</files>
|
||||
</package>
|
|
@ -13,6 +13,6 @@
|
|||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="[DOTNET_BUNDLE]" />
|
||||
<file src="$DOTNET_BUNDLE$" />
|
||||
</files>
|
||||
</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
|
||||
}
|
||||
|
||||
Write-Output -ForegroundColor Green "Successfully created dotnet bundle - $DotnetBundleOutput"
|
||||
Write-Output "Successfully created dotnet bundle - $DotnetBundleOutput"
|
||||
|
||||
exit $LastExitCode
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# 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.
|
||||
|
||||
# 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(
|
||||
[Parameter(Mandatory=$true)][string]$SdkBundlePath,
|
||||
[Parameter(Mandatory=$true)][string]$NugetVersion,
|
||||
|
@ -11,64 +8,25 @@ param(
|
|||
[Parameter(Mandatory=$true)][string]$NupkgFile
|
||||
)
|
||||
|
||||
. "$PSScriptRoot\_common.ps1"
|
||||
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.."
|
||||
$NuGetDir = Join-Path $RepoRoot ".nuget"
|
||||
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\..\..\..\.."
|
||||
$NuGetDir = Join-Path $RepoRoot "artifacts\Tools\nuget"
|
||||
$NuGetExe = Join-Path $NuGetDir "nuget.exe"
|
||||
$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 $NuGetExe)) {
|
||||
Write-Output 'Downloading nuget.exe to ' + $NuGetExe
|
||||
wget https://dist.nuget.org/win-x86-commandline/v4.7.0/nuget.exe -OutFile $NuGetExe
|
||||
}
|
||||
if (-not (Test-Path $NuGetDir)) {
|
||||
New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null
|
||||
}
|
||||
|
||||
function GenerateNupkg
|
||||
{
|
||||
if (-not (Test-Path $NuspecFile))
|
||||
{
|
||||
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 (-not (Test-Path $NuGetExe)) {
|
||||
# Using 3.5.0 to workaround https://github.com/NuGet/Home/issues/5016
|
||||
Write-Output "Downloading nuget.exe to $NuGetExe"
|
||||
wget https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe -OutFile $NuGetExe
|
||||
}
|
||||
|
||||
|
||||
if(!(Test-Path $SdkBundlePath))
|
||||
{
|
||||
throw "$SdkBundlePath not found"
|
||||
}
|
||||
|
||||
Write-Output "Creating nupkg for Sdk installer"
|
||||
|
||||
DownloadNugetExe
|
||||
|
||||
if(Test-Path $NupkgFile)
|
||||
{
|
||||
if (Test-Path $NupkgFile) {
|
||||
Remove-Item -Force $NupkgFile
|
||||
}
|
||||
|
||||
if(-Not (GenerateNupkg))
|
||||
{
|
||||
Exit -1
|
||||
}
|
||||
|
||||
if(!(Test-Path $NupkgFile))
|
||||
{
|
||||
throw "$NupkgFile not generated"
|
||||
}
|
||||
|
||||
Write-Output -ForegroundColor Green "Successfully created installer nupkg - $NupkgFile"
|
||||
|
||||
exit $LastExitCode
|
||||
& $NuGetExe pack $NuspecFile -Version $NugetVersion -OutputDirectory $OutputDirectory -NoPackageAnalysis -Properties DOTNET_BUNDLE=$SdkBundlePath
|
||||
Exit $LastExitCode
|
||||
|
|
Loading…
Add table
Reference in a new issue