dotnet-installer/packaging/nuget/package.ps1

37 lines
1.3 KiB
PowerShell
Raw Normal View History

# 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.
param(
[Parameter(Mandatory=$true)][string]$toolsDir,
[string]$versionSuffix = ""
)
# unify trailing backslash
$toolsDir = $toolsDir.TrimEnd('\')
$versionArg = ""
if ($versionSuffix -ne "") {
2016-01-24 00:56:22 +00:00
$versionArg = "--version-suffix"
}
$RepoRoot = Convert-Path "$PSScriptRoot\..\.."
. "$RepoRoot\scripts\common\_common.ps1"
. "$RepoRoot\scripts\package\projectsToPack.ps1"
2015-12-01 22:41:31 +00:00
$IntermediatePackagesDir = "$RepoRoot\artifacts\packages\intermediate"
$PackagesDir = "$RepoRoot\artifacts\packages"
New-Item -ItemType Directory -Force -Path $IntermediatePackagesDir
foreach ($ProjectName in $ProjectsToPack) {
2015-12-01 22:41:31 +00:00
$ProjectFile = "$RepoRoot\src\$ProjectName\project.json"
& $toolsDir\dotnet pack "$ProjectFile" --no-build --build-base-path "$Stage2CompilationDir\forPackaging" --output "$IntermediatePackagesDir" --configuration "$env:CONFIGURATION" $versionArg $versionSuffix
if (!$?) {
Write-Host "$toolsDir\dotnet pack failed for: $ProjectFile"
Exit 1
}
}
2016-02-03 18:57:25 +00:00
Get-ChildItem $IntermediatePackagesDir -Filter *.nupkg | ? {$_.Name -NotLike "*.symbols.nupkg"} | Copy-Item -Destination $PackagesDir