Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Pipeline/Build.Pack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Serilog.Log;

// ReSharper disable AllUnderscoreLocalParameterName
Expand Down Expand Up @@ -59,6 +61,28 @@ partial class Build
AbsolutePath packagesDirectory = ArtifactsDirectory / "Packages";
packagesDirectory.CreateOrCleanDirectory();

// Pack the meta-package separately from the slnx build. The meta-package
// csproj disables GeneratePackageOnBuild because adding ProjectReferences
// to the analyzer projects from the meta-package was found to create a
// duplicate MSBuild graph node for those analyzers under parallel CI
// builds, racing on bin/.../deps.json files and failing GenerateDepsFile
// with "file in use". Packing here with NoBuild after Compile sidesteps
// the race entirely: the slnx build has already produced every analyzer
// DLL the meta-package needs to bundle into analyzers/dotnet/cs/. Pack
// runs against the .slnx (not the csproj) so $(SolutionDir) resolves for
// the README pack target; only the meta-package is IsPackable=true so it
// is the only project actually packed.
DotNetPack(s => s
.SetProject(Solution.Path)
.SetConfiguration(Configuration)
.EnableNoLogo()
.EnableNoRestore()
.EnableNoBuild()
.SetVersion(MainVersion.FileVersion + MainVersion.PreRelease)
.SetAssemblyVersion(MainVersion.FileVersion)
.SetFileVersion(MainVersion.FileVersion)
.SetInformationalVersion(MainVersion.InformationalVersion));

List<string> packages = new();
foreach (Project project in new[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

<PropertyGroup>
<RootNamespace>Testably.Abstractions.Migration</RootNamespace>
<!--
This is a one-shot dev tool: install, run the migration, uninstall.
DevelopmentDependency=true marks the package as dev-only so it does not
propagate to the consumer's transitive dependencies and is auto-treated
with PrivateAssets=all. Consumers must reference Testably.Abstractions.Testing
themselves so the dependency survives the migration package's removal.
-->
<DevelopmentDependency>true</DevelopmentDependency>
Comment thread
vbreuss marked this conversation as resolved.
<!--
Pack runs separately from build (see Pipeline/Build.Pack.cs). Adding
ProjectReference items to the analyzer projects from here was found to
create a duplicate MSBuild graph node for those analyzers under parallel
CI builds, racing on bin/.../deps.json files and failing GenerateDepsFile
with "file in use". Disabling pack-on-build and packing separately with
NoBuild after the slnx is fully built sidesteps the race entirely. This
project must therefore always be built / packed via the .slnx, not as a
standalone csproj.
-->
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<!--
Pack the analyzer + codefix DLLs from their sibling projects' bin output.
Those projects are built by the slnx via the test / playground project
references; by the time Pack runs (after Compile in the Nuke pipeline) the
DLLs are guaranteed to exist. Paths use $(TargetFramework) and $(Configuration)
to track the central settings; PackagePath uses a trailing slash to match
sibling Pack metadata in the codebase.
-->
<None Include="..\Testably.Abstractions.Migration.Analyzers\bin\$(Configuration)\$(TargetFramework)\Testably.Abstractions.Migration.Analyzers.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs/"
Visible="false"/>
<None Include="..\Testably.Abstractions.Migration.Analyzers.CodeFixers\bin\$(Configuration)\$(TargetFramework)\Testably.Abstractions.Migration.Analyzers.CodeFixers.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs/"
Visible="false"/>
</ItemGroup>

</Project>
Loading