Merge pull request #358 from krwq/nuget_packaging
Nuget packages generation script for each project under src/ and some bugfixes
This commit is contained in:
commit
4f132a14d2
3 changed files with 33 additions and 3 deletions
30
packaging/nuget/package.ps1
Normal file
30
packaging/nuget/package.ps1
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
. "$PSScriptRoot\..\..\scripts\_common.ps1"
|
||||||
|
|
||||||
|
$IntermediatePackagesDir = "$RepoRoot\artifacts\packages\intermediate"
|
||||||
|
$PackagesDir = "$RepoRoot\artifacts\packages"
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $IntermediatePackagesDir
|
||||||
|
|
||||||
|
$Projects = @(
|
||||||
|
"Microsoft.DotNet.Cli.Utils",
|
||||||
|
"Microsoft.DotNet.ProjectModel",
|
||||||
|
"Microsoft.DotNet.ProjectModel.Workspaces",
|
||||||
|
"Microsoft.DotNet.Runtime",
|
||||||
|
"Microsoft.Extensions.Testing.Abstractions"
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($ProjectName in $Projects) {
|
||||||
|
$ProjectFile = "$RepoRoot\src\$ProjectName\project.json"
|
||||||
|
& dotnet restore "$ProjectFile"
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "dotnet restore failed for: $ProjectFile"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
& dotnet pack "$ProjectFile" --output "$IntermediatePackagesDir"
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "dotnet pack failed for: $ProjectFile"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Get-ChildItem $IntermediatePackagesDir -Filter *.nupkg | Copy-Item -Destination $PackagesDir
|
|
@ -32,7 +32,7 @@ popd
|
||||||
|
|
||||||
# Run the app and check the exit code
|
# Run the app and check the exit code
|
||||||
pushd "$RepoRoot\artifacts\$Rid\e2etest"
|
pushd "$RepoRoot\artifacts\$Rid\e2etest"
|
||||||
mv E2E.exe corehost.exe
|
mv E2E.exe corehost.exe -Force
|
||||||
& "corehost.exe" "xunit.console.netcore.exe" "E2E.dll" -xml ..\..\e2etest.xml
|
& "corehost.exe" "xunit.console.netcore.exe" "E2E.dll" -xml ..\..\e2etest.xml
|
||||||
if (!$?) {
|
if (!$?) {
|
||||||
Write-Host "E2E Test Failure"
|
Write-Host "E2E Test Failure"
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
var configValue = configuration.Value() ?? Cli.Utils.Constants.DefaultConfiguration;
|
var configValue = configuration.Value() ?? Cli.Utils.Constants.DefaultConfiguration;
|
||||||
var outputValue = output.Value();
|
var outputValue = output.Value();
|
||||||
|
|
||||||
return BuildPackage(path, configValue, outputValue, intermediateOutput.Value()) ? 1 : 0;
|
return TryBuildPackage(path, configValue, outputValue, intermediateOutput.Value()) ? 0 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -80,7 +80,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool BuildPackage(string path, string configuration, string outputValue, string intermediateOutputValue)
|
private static bool TryBuildPackage(string path, string configuration, string outputValue, string intermediateOutputValue)
|
||||||
{
|
{
|
||||||
var contexts = ProjectContext.CreateContextForEachFramework(path);
|
var contexts = ProjectContext.CreateContextForEachFramework(path);
|
||||||
var project = contexts.First().ProjectFile;
|
var project = contexts.First().ProjectFile;
|
||||||
|
|
Loading…
Reference in a new issue