-
-
Notifications
You must be signed in to change notification settings - Fork 12
Smooth the Fallout.Common.ProjectModel → Fallout.Solutions migration path #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ChrisonSimtian
wants to merge
3
commits into
main
Choose a base branch
from
fix/solutionmodel-rename-migration-path
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
59328f8
Map Common.ProjectModel to Fallout.Solutions in the CLI migrator
ChrisonSimtian 46c537f
Add Fallout.Common.ProjectModel entry-point transition shim
ChrisonSimtian b6469a3
Stop the ProjectModel entry-point shim colliding with the Nuke.Common…
ChrisonSimtian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| using Fallout.Common.IO; | ||
| using Fallout.Persistence.Solution.Model; | ||
|
|
||
| namespace Fallout.Common.ProjectModel; | ||
|
|
||
| // Transition shims for the solution entry-point types, which shipped under | ||
| // `Fallout.Common.ProjectModel` in Fallout 11.0.1–11.0.12 and moved to the | ||
| // dedicated `Fallout.Solutions` namespace in 11.0.13 (#248 / #257). Mirroring the | ||
| // pair below keeps the canonical consumer pattern | ||
| // | ||
| // using Fallout.Common.ProjectModel; | ||
| // [Solution] readonly Solution Solution; | ||
| // | ||
| // compiling for consumers upgrading from those releases, without their having to | ||
| // run `fallout-migrate` first. | ||
| // | ||
| // SHALLOW BY DESIGN. This is an entry-point grace period, not a full alias of the | ||
| // old namespace. Navigating the graph (e.g. `solution.Projects`) hands back | ||
| // canonical `Fallout.Solutions.*` instances, so intermediate variables typed | ||
| // against `Fallout.Common.ProjectModel` will not bind, and `GenerateProjects` | ||
| // source-generation keys off the canonical attribute type and won't fire through | ||
| // the shim. `fallout-migrate` (or the Nuke→Fallout codefix) is the complete | ||
| // migration path — it rewrites every reference, shallow and deep. This mirrors the | ||
| // same ceiling the generated `Nuke.Common.ProjectModel` transition shim has. | ||
|
|
||
| /// <summary> | ||
| /// Transition shim for the relocated <see cref="Fallout.Solutions.Solution"/>. See the file-level | ||
| /// remarks — shallow by design; run <c>fallout-migrate</c> for a complete rewrite. | ||
| /// </summary> | ||
| public class Solution(SolutionModel model, AbsolutePath path = null) | ||
| : global::Fallout.Solutions.Solution(model, path) | ||
| { | ||
| // C# does not inherit user-defined conversion operators onto a subclass, so the | ||
| // canonical Solution's string / AbsolutePath coercions would silently disappear | ||
| // on the shim. Re-expose them so `string s = Solution;` and `AbsolutePath p = Solution;` | ||
| // keep working. The parameter type (shim Solution) is more specific than the | ||
| // canonical's, so these win over the inherited operators without ambiguity. | ||
| public static implicit operator string(Solution solution) => (global::Fallout.Solutions.Solution)solution; | ||
| public static implicit operator AbsolutePath(Solution solution) => (global::Fallout.Solutions.Solution)solution; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Transition shim for the relocated <see cref="Fallout.Solutions.SolutionAttribute"/>. Deserializes | ||
| /// into the annotated member's declared type, so <c>[Solution] readonly Solution Solution;</c> against | ||
| /// the shim <see cref="Solution"/> above resolves correctly. | ||
| /// </summary> | ||
| public class SolutionAttribute(string relativePath) | ||
| : global::Fallout.Solutions.SolutionAttribute(relativePath) | ||
| { | ||
| public SolutionAttribute() | ||
| : this(relativePath: null) | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tests/Consumers/Fallout.Consumer.ProjectModelShim/Build.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // | ||
| // Pre-rename Fallout consumer pattern (Fallout 11.0.1–11.0.12), compiled against | ||
| // the Fallout.Common.ProjectModel transition shim. If a Build.cs from those | ||
| // releases stops compiling against the latest Fallout, this fails — protecting | ||
| // users upgrading across the SolutionModel → Solution / Fallout.Solutions rename. | ||
|
|
||
| using Fallout.Common; | ||
| using Fallout.Common.IO; | ||
| using Fallout.Common.ProjectModel; // the interim namespace, now served by the transition shim | ||
|
|
||
| internal class Build : FalloutBuild | ||
| { | ||
| public static int Main() => Execute<Build>(x => x.Default); | ||
|
|
||
| [Solution] | ||
| private readonly Solution Solution; | ||
|
|
||
| private Target Default => _ => _ | ||
| .Executes(() => | ||
| { | ||
| Serilog.Log.Information("hello from fallout consumer (Fallout.Common.ProjectModel shim)"); | ||
| Serilog.Log.Information("solution name: {Name}", Solution?.Name ?? "<unbound>"); | ||
| }); | ||
| } |
29 changes: 29 additions & 0 deletions
29
tests/Consumers/Fallout.Consumer.ProjectModelShim/Fallout.Consumer.ProjectModelShim.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <OutputType>Exe</OutputType> | ||
| <IsPackable>false</IsPackable> | ||
| <RootNamespace>Fallout.Consumer.ProjectModelShim</RootNamespace> | ||
| <NoWarn>$(NoWarn);CS0649</NoWarn> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- | ||
| Compile-time sentinel for the Fallout.Common.ProjectModel transition shim. | ||
|
|
||
| The solution types shipped under `Fallout.Common.ProjectModel` in Fallout | ||
| 11.0.1–11.0.12 and moved to `Fallout.Solutions` in 11.0.13 (#248 / #257). | ||
| Build.cs deliberately keeps the OLD `using Fallout.Common.ProjectModel;` + | ||
| `[Solution] readonly Solution Solution;` shape, so that if the shim in | ||
| src/Fallout.Common/ProjectModel/TransitionShims.cs regresses, this stops | ||
| compiling and CI fails — mirroring how Nuke.Consumer guards the | ||
| Nuke.Common.ProjectModel shim. | ||
| --> | ||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\src\Fallout.Common\Fallout.Common.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Fallout.Build\Fallout.Build.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Persistence\Fallout.Solution\Fallout.Solution.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Fallout.Components\Fallout.Components.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the new migration design, that new migrations should go into their dedicated `XxxStep".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, claude doesn't quite understand it yet. so this needs some work plus some agent.md adjustments. just down with a pretty bad cold this week so doing things slower and one at a time 😊