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
7 changes: 7 additions & 0 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ from framework in project.GetTargetFrameworks()
.Requires(() => GitRepository.IsOnMainBranch() && Host is GitHubActions && GitHubActions.Workflow == ReleaseWorkflow)
.WhenSkipped(DependencyBehavior.Execute);

// Filter `Nuke.*` shim packages out of the nuget.org push — that ID is owned by
// the original NUKE maintainer. The shims still build and pack as artifacts; they
// get pushed to GitHub Packages via a separate (manual / future-automated) step.
IEnumerable<AbsolutePath> IPublish.PushPackageFiles
=> From<IPack>().PackagesDirectory.GlobFiles("*.nupkg")
.Where(x => !x.NameWithoutExtension.StartsWith("Nuke.", StringComparison.OrdinalIgnoreCase));

IEnumerable<AbsolutePath> NuGetPackageFiles
=> From<IPack>().PackagesDirectory.GlobFiles("*.nupkg");

Expand Down
2 changes: 2 additions & 0 deletions fallout.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Project Path="src\Fallout.Components\Fallout.Components.csproj" />
<Project Path="src\Fallout.GlobalTool\Fallout.GlobalTool.csproj" />
<Project Path="src\Fallout.Migrate\Fallout.Migrate.csproj" />
<Project Path="src\Shims\Nuke.Common\Nuke.Common.csproj" />
<Project Path="src\Fallout.MSBuildTasks\Fallout.MSBuildTasks.csproj" />
<Project Path="src\Fallout.ProjectModel\Fallout.ProjectModel.csproj" />
<Project Path="src\Fallout.SolutionModel\Fallout.SolutionModel.csproj" />
Expand All @@ -32,6 +33,7 @@
<Project Path="tests\Fallout.Common.Tests\Fallout.Common.Tests.csproj" />
<Project Path="tests\Fallout.GlobalTool.Tests\Fallout.GlobalTool.Tests.csproj" />
<Project Path="tests\Fallout.Migrate.Tests\Fallout.Migrate.Tests.csproj" />
<Project Path="tests\Nuke.Common.Shim.Tests\Nuke.Common.Shim.Tests.csproj" />
<Project Path="tests\Fallout.ProjectModel.Tests\Fallout.ProjectModel.Tests.csproj" />
<Project Path="tests\Fallout.SolutionModel.Tests\Fallout.SolutionModel.Tests.csproj" />
<Project Path="tests\Fallout.SourceGenerators.Tests\Fallout.SourceGenerators.Tests.csproj" />
Expand Down
23 changes: 23 additions & 0 deletions src/Shims/Nuke.Common/Attributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2026 Maintainers of Fallout.
// Originally based on NUKE by Matthias Koch and contributors.
// Distributed under the MIT License.
// https://github.com/ChrisonSimtian/Fallout/blob/main/LICENSE

using System;

namespace Nuke.Common;

// Parameter / Secret injection attributes — most consumer Build.cs files use these.

/// <summary>Transition shim for <see cref="Fallout.Common.ParameterAttribute"/>.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public sealed class ParameterAttribute : Fallout.Common.ParameterAttribute
{
public ParameterAttribute(string description = null) : base(description) { }
}

/// <summary>Transition shim for <see cref="Fallout.Common.SecretAttribute"/>.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class SecretAttribute : Fallout.Common.SecretAttribute
{
}
14 changes: 14 additions & 0 deletions src/Shims/Nuke.Common/GitAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2026 Maintainers of Fallout.
// Originally based on NUKE by Matthias Koch and contributors.
// Distributed under the MIT License.
// https://github.com/ChrisonSimtian/Fallout/blob/main/LICENSE

using System;

namespace Nuke.Common.Git;

/// <summary>Transition shim for <see cref="Fallout.Common.Git.GitRepositoryAttribute"/>.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class GitRepositoryAttribute : Fallout.Common.Git.GitRepositoryAttribute
{
}
28 changes: 28 additions & 0 deletions src/Shims/Nuke.Common/Nuke.Common.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>Nuke.Common</AssemblyName>
<RootNamespace>Nuke.Common</RootNamespace>
<PackageId>Nuke.Common</PackageId>
<Title>Nuke.Common (Fallout transition shim)</Title>
<!--
Packs as a normal build artifact. The release pipeline's Publish target filters
`Nuke.*` packages out of the nuget.org push (see Build.cs PushPackageFiles
override) since that package ID belongs to the original NUKE maintainer. The
produced nupkg can be uploaded to GitHub Packages or attached to a GH release.
-->
<IsPackable>true</IsPackable>
<Description>Transition shim that re-exports the most common Nuke.* types as subclasses/wrappers of the canonical Fallout.* types. For projects mid-migration from NUKE to Fallout. Published only to GitHub Packages (nuget.org's Nuke.Common is owned by the original NUKE maintainer).</Description>
<PackageTags>build automation continuous-integration tools orchestration nuke shim transition</PackageTags>
<!-- Disable XML doc generation here; Directory.Build.props turns it on for packable projects,
but the shim types' XML docs are intentionally minimal (point at the canonical type). -->
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Build\Fallout.Build.csproj" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions src/Shims/Nuke.Common/NukeBuild.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2026 Maintainers of Fallout.
// Originally based on NUKE by Matthias Koch and contributors.
// Distributed under the MIT License.
// https://github.com/ChrisonSimtian/Fallout/blob/main/LICENSE

namespace Nuke.Common;

/// <summary>
/// Transition shim. Inherits from <see cref="Fallout.Common.FalloutBuild"/>. Replace your
/// <c>using Nuke.Common;</c> with <c>using Fallout.Common;</c> and <c>NukeBuild</c> with
/// <c>FalloutBuild</c> when you're ready — see <c>fallout-migrate</c>.
/// </summary>
public abstract class NukeBuild : Fallout.Common.FalloutBuild
{
}

/// <summary>
/// Transition shim. Extends <see cref="Fallout.Common.IFalloutBuild"/>.
/// </summary>
public interface INukeBuild : Fallout.Common.IFalloutBuild
{
}
16 changes: 16 additions & 0 deletions src/Shims/Nuke.Common/ProjectModelAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2026 Maintainers of Fallout.
// Originally based on NUKE by Matthias Koch and contributors.
// Distributed under the MIT License.
// https://github.com/ChrisonSimtian/Fallout/blob/main/LICENSE

using System;

namespace Nuke.Common.ProjectModel;

/// <summary>Transition shim for <see cref="Fallout.Common.ProjectModel.SolutionAttribute"/>.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class SolutionAttribute : Fallout.Common.ProjectModel.SolutionAttribute
{
public SolutionAttribute() { }
public SolutionAttribute(string relativePath) : base(relativePath) { }
}
60 changes: 60 additions & 0 deletions src/Shims/Nuke.Common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Nuke.Common transition shim

This package is a **partial transition shim** for projects mid-migration from NUKE to Fallout. Published only to GitHub Packages — `Nuke.Common` on nuget.org is owned by the original NUKE maintainer.

## What's covered

| Old (`Nuke.Common`) | New (`Fallout.Common`) | Shim mechanism |
|---|---|---|
| `NukeBuild` | `FalloutBuild` | Subclass |
| `INukeBuild` | `IFalloutBuild` | Sub-interface |
| `[Parameter]` | `Fallout.Common.ParameterAttribute` | Subclass |
| `[Secret]` | `Fallout.Common.SecretAttribute` | Subclass |
| `[Solution]` | `Fallout.Common.ProjectModel.SolutionAttribute` | Subclass |
| `[GitRepository]` | `Fallout.Common.Git.GitRepositoryAttribute` | Subclass |

The MVP unblocks a `class Build : NukeBuild` declaration with parameter/secret/solution/git injection — the entry-point surface of most consumer Build.cs files.

## What's NOT covered (yet)

- **CI attributes** (`[GitHubActions]`, `[AzurePipelines]`, `[TeamCity]`, `[AppVeyor]`, ...) — these take enum parameters (`GitHubActionsImage`, etc.) that the shim doesn't re-export. C# can't subclass enums; bridging them needs a source generator. Tracked in the follow-up issue.
- **The `Target` delegate** — delegates can't be implicitly converted across types in C#, so the shim can't bridge `Nuke.Common.Target Compile => _ => _` cleanly. Use `fallout-migrate` for the source-level rename.
- **Static helper classes** — `DotNetTasks`, `MSBuildTasks`, etc. require method-by-method delegation. Tracked for the source-generator follow-up.
- **IO types** — `AbsolutePath`, file globbing helpers — also need wrapper classes with mirrored members.

## Packaging

The shim packs normally as a build artifact (`Nuke.Common.<version>.nupkg`). The release pipeline's `Publish` target filters `Nuke.*` packages out of the nuget.org push — that ID is owned by the original NUKE maintainer. The produced nupkg can be uploaded to GitHub Packages or attached to a GitHub release.

Until automated dual-publish lands (tracked in [#69](https://github.com/ChrisonSimtian/Fallout/issues/69)), the manual GH Packages push is:

```pwsh
dotnet pack src/Shims/Nuke.Common/Nuke.Common.csproj -c Release
dotnet nuget push **/Nuke.Common.*.nupkg `
--api-key $env:GITHUB_TOKEN `
--source https://nuget.pkg.github.com/ChrisonSimtian/index.json
```

## Migration path

For projects that just want their `class Build : NukeBuild { ... }` to compile against our framework:

1. Add `https://nuget.pkg.github.com/ChrisonSimtian/index.json` as a NuGet source (`nuget.config`).
2. Bump the `Nuke.Common` package version to the latest published here.
3. Build. If the shim covers what you use, you're done. Otherwise:
4. Run `fallout-migrate` to rewrite the remaining references.

## What this shim is NOT

- Not a permanent dependency — designed for a transition window.
- Not a replacement for the migration story — most consumers should run `fallout-migrate` and target `Fallout.Common` directly.
- Not on nuget.org — only on this fork's GitHub Packages feed.

## Future work

Source-generator-based expansion to cover the full public API is tracked in the issue tracker. The architectural decision is between:

1. **Per-package shims** with hand-written wrappers (this approach, doesn't scale to all 158 public types in Common alone).
2. **Generated wrappers** from a Roslyn source generator that reflects the canonical assembly metadata — single source of truth, mechanical regeneration.

(2) is the long-term answer. (1) is what shipped first.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ internal class Solution(SolutionModel model, AbsolutePath path) : Fallout.Common
public Fallout.Common.ProjectModel.Project Fallout_Utilities_Tests => this.GetProject("Fallout.Utilities.Tests");
public Fallout.Common.ProjectModel.Project Fallout_Utilities_Text_Json => this.GetProject("Fallout.Utilities.Text.Json");
public Fallout.Common.ProjectModel.Project Fallout_Utilities_Text_Yaml => this.GetProject("Fallout.Utilities.Text.Yaml");
public Fallout.Common.ProjectModel.Project Nuke_Common => this.GetProject("Nuke.Common");
public Fallout.Common.ProjectModel.Project Nuke_Common_Shim_Tests => this.GetProject("Nuke.Common.Shim.Tests");

public _misc misc => Unsafe.As<_misc>(this.GetSolutionFolder("misc"));

Expand Down
11 changes: 11 additions & 0 deletions tests/Nuke.Common.Shim.Tests/Nuke.Common.Shim.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Shims\Nuke.Common\Nuke.Common.csproj" />
</ItemGroup>

</Project>
30 changes: 30 additions & 0 deletions tests/Nuke.Common.Shim.Tests/SampleConsumerBuild.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2026 Maintainers of Fallout.
// Originally based on NUKE by Matthias Koch and contributors.
// Distributed under the MIT License.
// https://github.com/ChrisonSimtian/Fallout/blob/main/LICENSE
//
// This file is the **compile-only test** for the Nuke.Common shim. It mirrors what a
// typical NUKE-era consumer Build.cs imports. If this file compiles, the MVP shim covers
// the surface it claims to cover. Nothing here is executed.

#pragma warning disable CS0649 // unassigned readonly — these are injected at runtime
#pragma warning disable CS0169 // unused fields — same reason

using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.ProjectModel;

namespace Nuke.Common.Shim.Tests;

// Consumer's typical Build.cs entry-point — inherits the shim's NukeBuild,
// uses the canonical Fallout types via `Fallout.Common.Target` (shim doesn't
// bridge delegates; that's `fallout-migrate`'s job).
public abstract class SampleConsumerBuild : NukeBuild, INukeBuild
{
[Parameter("Configuration to build")] readonly string Configuration;
[Parameter] readonly bool RunTests;
[Secret] readonly string NuGetApiKey;
[Solution] readonly Fallout.Common.ProjectModel.Solution Solution;
[Solution("path/to/explicit.slnx")] readonly Fallout.Common.ProjectModel.Solution ExplicitSolution;
[GitRepository] readonly Fallout.Common.Git.GitRepository GitRepository;
}
Loading