Fix build output so that versioned packages go into the correct directory when run through KoreBuild
This commit is contained in:
parent
6cf4cbd736
commit
2fa1fe8ce2
|
|
@ -0,0 +1,33 @@
|
|||
<Project>
|
||||
|
||||
<!--
|
||||
The "Pack" target which emits .nupkg files to disk also holds a lock on those file
|
||||
until the whole build process exits [1]. This makes it difficult to perform any
|
||||
subsequent work on the package files, such as moving them or modifying their
|
||||
contents. As a workaround, we cause the nupkgs to be written to a temporary
|
||||
subdirectory, and then after they are emitted, our SubstituteProjectFileVariables
|
||||
task writes its output to the original intended build directory.
|
||||
|
||||
[1] The file locking might be a bug in the NuGet client code. For example, see
|
||||
https://github.com/NuGet/NuGet.Client/blob/63e8539791d4f662efffceb2185ad4510396d76e/src/NuGet.Core/NuGet.Commands/CommandRunners/PackCommandRunner.cs#L135
|
||||
It opens a "PackageArchiveReader" (which in turn uses File.Open to open a file
|
||||
handle) after creating each package, but never close/disposes it.
|
||||
-->
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageDependsOn>RedirectPackageOutputDir;$(PackageDependsOn);RestorePackageOutputDir</PackageDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="RedirectPackageOutputDir">
|
||||
<PropertyGroup>
|
||||
<OrigBuildDir>$(BuildDir)</OrigBuildDir>
|
||||
<BuildDir>$(BuildDir)unversioned\</BuildDir>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="RestorePackageOutputDir">
|
||||
<PropertyGroup>
|
||||
<BuildDir>$(OrigBuildDir)</BuildDir>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<Project>
|
||||
<Import Project="FixPackageOutputDirs.targets" />
|
||||
</Project>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
<NoWarn>2008;8021</NoWarn>
|
||||
<PackageVersion Condition="'$(VersionSuffix)' == ''">$(VersionPrefix)</PackageVersion>
|
||||
<PackageVersion Condition="'$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
|
||||
<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(MSBuildThisFileDirectory)..\artifacts\tmp\</PackageOutputPath>
|
||||
<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(MSBuildThisFileDirectory)..\artifacts\build\unversioned\</PackageOutputPath>
|
||||
<NuspecProperties>version=$(PackageVersion)</NuspecProperties>
|
||||
<AspNetCoreVersionFromLineup>@(PackageReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore')->Metadata('Version'))</AspNetCoreVersionFromLineup>
|
||||
<EntityFrameworkVersionFromLineup>@(PackageReference->WithMetadataValue('Identity', 'Microsoft.EntityFrameworkCore')->Metadata('Version'))</EntityFrameworkVersionFromLineup>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
TaskName="DependencyUpdater.SubstituteProjectFileVariables"
|
||||
AssemblyFile="$(MSBuildProjectDirectory)\$(OutputPath)DependencyUpdater.dll" />
|
||||
|
||||
<Target Name="RunTask" AfterTargets="Pack">
|
||||
<Target Name="InjectVersionsIntoProjectFilesInPackage" AfterTargets="Pack">
|
||||
<SubstituteProjectFileVariables
|
||||
NupkgFile="$(PackageOutputPath)$(MSBuildProjectName).$(PackageVersion).nupkg"
|
||||
Substitutions="TemplateAspNetCoreVersion=$(AspNetCoreVersionFromLineup); TemplateEntityFrameworkVersion=$(EntityFrameworkVersionFromLineup)"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Templates.Test.Helpers
|
|||
|
||||
// Locate the artifacts directory containing the built template packages
|
||||
var solutionDir = FindAncestorDirectoryContaining("Templating.sln");
|
||||
var artifactsDir = Path.Combine(solutionDir, "artifacts");
|
||||
var artifactsDir = Path.Combine(solutionDir, "artifacts", "build");
|
||||
var builtPackages = Directory.GetFiles(artifactsDir, "*.nupkg");
|
||||
foreach (var packagePath in builtPackages)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue