dotnet-installer/packaging/nuget/package.ps1
2016-01-23 16:56:22 -08:00

34 lines
1.2 KiB
PowerShell

# 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 "") {
$versionArg = "--version-suffix"
}
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"
. "$REPOROOT\scripts\package\projectsToPack.ps1"
$IntermediatePackagesDir = "$RepoRoot\artifacts\packages\intermediate"
$PackagesDir = "$RepoRoot\artifacts\packages"
New-Item -ItemType Directory -Force -Path $IntermediatePackagesDir
foreach ($ProjectName in $ProjectsToPack) {
$ProjectFile = "$RepoRoot\src\$ProjectName\project.json"
& $toolsDir\dotnet pack "$ProjectFile" --basepath "$Stage2CompilationDir\bin" --output "$IntermediatePackagesDir" --configuration "$Configuration" $versionArg $versionSuffix
if (!$?) {
Write-Host "$toolsDir\dotnet pack failed for: $ProjectFile"
Exit 1
}
}
Get-ChildItem $IntermediatePackagesDir\$Configuration -Filter *.nupkg | ? {$_.Name -NotLike "*.symbols.nupkg"} | Copy-Item -Destination $PackagesDir