Skip to content

Commit a278be9

Browse files
Switch the machine's global tool during migration, and target the kept id
Two changes to what fallout-migrate does about the tool package id. Point the migration at Fallout.GlobalTool. #581 settled on keeping the NUKE-era id rather than moving to Fallout.GlobalTools, so the current id and the retired list swap places: current: fallout.globaltool retired: nuke.globaltool, fallout.cli, fallout.globaltools A consumer already pinning fallout.globaltool now migrates to nothing, which is the point of keeping that id. Covered by a spec. Add SwitchGlobalToolStep. Rewriting .config/dotnet-tools.json only fixes the repo. A machine-wide install of a retired tool stays behind, and two packages providing the `fallout` command conflict, so the repo-only fix left the machine broken. The new step reads `dotnet tool list --global`, uninstalls each retired id that is installed, then installs the current one at the resolved version. It runs after RewriteToolManifestStep: repo first, so an interrupted run still leaves the committed state correct. Every command is best-effort — no dotnet on PATH, no global install, or an unreachable feed produces a Summary warning naming the command to run by hand, never a failed migration. --dry-run prints the commands without running them. Introduces CliWrap (3.10.3, central pin) for the process calls: buffered output and a cancellation token without hand-rolled ProcessStartInfo plumbing. Scoped to Fallout.Migrate on purpose. Fallout.Common has its own ProcessTasks layer that build authors consume, and that is not changing. Added to docs/dependencies.md under a new Console / process section. Also flips .config/dotnet-tools.json to fallout.globaltool 10.3.49. The pin could not move while the id was Fallout.GlobalTools, because nothing was published there above 10.4.0-rc.4. Verified: `dotnet tool restore` resolves it. docs/migration/tool-package-id.md rewritten around the kept id. It is now a "move off a retired id" page, and most readers need no action at all. Verified: Fallout.Migrate.Specs 63/63; solution builds; dry-run against a scratch repo pinning fallout.cli rewrites the manifest as expected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 106b695 commit a278be9

14 files changed

Lines changed: 444 additions & 65 deletions

.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"version": 1,
33
"isRoot": true,
44
"tools": {
5-
"fallout.globaltools": {
6-
"version": "10.4.0-rc.4",
5+
"fallout.globaltool": {
6+
"version": "10.3.49",
77
"commands": [
88
"fallout"
99
]

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.8.0" />
1111
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.7.9" />
1212
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
13+
<PackageVersion Include="CliWrap" Version="3.10.3" />
1314
<PackageVersion Include="Glob" Version="1.1.9" />
1415
<PackageVersion Include="HtmlAgilityPack" Version="1.11.71" />
1516
<PackageVersion Include="Humanizer" Version="3.0.1" />

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The CLI installs as `fallout`. Verify with `fallout --help`.
6464
> dotnet tool uninstall -g Fallout.GlobalTools
6565
> ```
6666
>
67-
> If a repo pins the old id in `.config/dotnet-tools.json`, change the version too — the pin you have does not exist under the new id. `fallout-migrate` does both. See [Fallout.GlobalTool → Fallout.GlobalTools](docs/migration/tool-package-id.md).
67+
> Same for a repo that pins a retired id in `.config/dotnet-tools.json`: change the version along with the id, because the pin you have does not exist under `Fallout.GlobalTool`. `fallout-migrate` does both, and switches your global install too. See [Moving off a retired tool package id](docs/migration/tool-package-id.md).
6868
6969
For per-repo manifest pinning (`.config/dotnet-tools.json`), project setup, and shell completion, see the [Installation guide on docs.fallout.build](https://docs.fallout.build/getting-started/installation).
7070

docs/dependencies.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ Central package versions are pinned in `Directory.Packages.props`; this page lin
6464
|---|---|
6565
| `NuGet.Packaging` | Read .nupkg metadata. Used by `NuGetVersionResolver`, `ProjectUpdater`. |
6666

67+
## Console / process
68+
69+
| Package | Purpose | Used by |
70+
|---|---|---|
71+
| `Spectre.Console` (+ `.Cli`) | Console rendering and command-line parsing | `Fallout.Migrate` |
72+
| `CliWrap` | Run an external process and buffer its output, with a cancellation token and no manual `ProcessStartInfo` plumbing | `Fallout.Migrate``SwitchGlobalToolStep` shells out to `dotnet tool`. Deliberately not used in `Fallout.Common`, which has its own `ProcessTasks` layer that build authors consume. |
73+
6774
## Vendored source
6875

6976
| Package | Source | Why vendored |

docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ description: Fallout is a C#-first build automation framework for .NET — the h
1818

1919
```powershell
2020
# terminal-command
21-
dotnet tool install Fallout.GlobalTools --global
21+
dotnet tool install Fallout.GlobalTool --global
2222
```
2323

2424
**2. Go to a repository of your choice and set up a build:**

docs/migration/tool-package-id.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,55 @@
11
---
2-
title: Fallout.GlobalTool → Fallout.GlobalTools
3-
description: The dotnet-tool NuGet package id changed. The fallout command did not. This page shows how to move an existing install or manifest.
2+
title: Moving off a retired tool package id
3+
description: The Fallout CLI ships as Fallout.GlobalTool. Three other package ids were used along the way and are now retired. This page shows how to move an install or a manifest onto the current one.
44
---
55

6-
The dotnet-tool NuGet package id is now **`Fallout.GlobalTools`**. The **command stays `fallout`**, so
7-
build scripts, CI steps, and shell invocations do not change. Only the install or restore reference
8-
moves.
6+
The Fallout CLI ships as **`Fallout.GlobalTool`**. This is the same package id NUKE users have had
7+
pinned since the rebrand, so most readers have nothing to do.
98

10-
If you have never installed the tool, you do not need this page. Follow
11-
[Installation](../01-getting-started/01-installation.md).
9+
Three other ids were used along the way and are now retired. If you pin one of them, this page shows
10+
how to move. The **command stays `fallout`** in every case, so build scripts, CI steps, and shell
11+
invocations do not change. Only the install or restore reference moves.
1212

13-
## Why you need to act
13+
## Do you need to act?
1414

15-
The older package ids are still on nuget.org, still listed, and frozen. `dotnet tool update` on an old
16-
id reports that you are already on the latest version, because you are — for that id. The newer
17-
releases are published under the new id.
15+
Run `dotnet tool list --global`, and open `.config/dotnet-tools.json` if your repo has one.
1816

19-
| Package id | Last version | Status |
20-
|---|---|---|
21-
| `Nuke.GlobalTool` | NUKE-era | Frozen. Not a Fallout package. |
22-
| `Fallout.GlobalTool` | `10.3.49` | Frozen. Receives no further releases. |
23-
| `Fallout.Cli` | `10.3.47`, `11.0.18` | Frozen. The `11.0.x` line was withdrawn; see [v11 is defunct](#a-note-on-the-110x-versions). |
24-
| **`Fallout.GlobalTools`** | current | **Active. All future tool releases.** |
17+
| Package id | Status |
18+
|---|---|
19+
| **`Fallout.GlobalTool`** | **Current. All releases. Nothing to do.** |
20+
| `Nuke.GlobalTool` | Retired. The NUKE-era id, not a Fallout package. |
21+
| `Fallout.Cli` | Retired. The `11.0.x` line was withdrawn; see [the note below](#a-note-on-the-110x-versions). |
22+
| `Fallout.GlobalTools` | Retired. Note the trailing **s**. One prerelease, `10.4.0-rc.4`. |
2523

2624
`rollForward: true` in your manifest does not help. It resolves a version *within* one package id, so
2725
it cannot move you to a different id.
2826

2927
## The easy way
3028

31-
`fallout-migrate` rewrites the manifest for you, including the version pin:
29+
`fallout-migrate` rewrites the manifest for you, including the version pin, and switches your global
30+
install:
3231

3332
```sh
3433
dotnet tool install -g Fallout.Migrate
3534
fallout-migrate .
3635
```
3736

37+
Run it with `--dry-run` first if you want to see the commands it would run without running them.
38+
3839
## Local manifest, by hand
3940

4041
Open `.config/dotnet-tools.json`. Change the tool id **and the version**. The version you had pinned
41-
belongs to the old id and does not exist under the new one, so renaming the key alone gives you a
42-
manifest that fails to restore.
42+
belongs to the retired id and does not exist under the current one, so renaming the key alone gives
43+
you a manifest that fails to restore.
4344

4445
```diff
4546
{
4647
"version": 1,
4748
"isRoot": true,
4849
"tools": {
49-
- "fallout.globaltool": {
50-
- "version": "10.3.49",
51-
+ "fallout.globaltools": {
50+
- "fallout.cli": {
51+
- "version": "11.0.18",
52+
+ "fallout.globaltool": {
5253
+ "version": "<current version>",
5354
"commands": [ "fallout" ]
5455
}
@@ -62,15 +63,15 @@ Then restore:
6263
dotnet tool restore
6364
```
6465

65-
`dotnet tool list` should show a `fallout.globaltools` row and no `fallout.globaltool` row.
66+
`dotnet tool list` should show a `fallout.globaltool` row and no row for the retired id.
6667

6768
## Global install, by hand
6869

69-
Uninstall the old package first. Two tools claiming the `fallout` command will conflict.
70+
Uninstall the retired package first. Two tools claiming the `fallout` command will conflict.
7071

7172
```sh
72-
dotnet tool uninstall -g Fallout.GlobalTool
73-
dotnet tool install -g Fallout.GlobalTools
73+
dotnet tool uninstall -g Fallout.Cli
74+
dotnet tool install -g Fallout.GlobalTool
7475
```
7576

7677
`dotnet tool list -g` confirms the result.
@@ -92,3 +93,5 @@ from `10.x` to calendar versioning without a v11 line. Do not pin `11.0.x`.
9293
## Refs
9394

9495
- [#575](https://github.com/Fallout-build/Fallout/issues/575) — the upgrade path this page documents.
96+
- [#581](https://github.com/Fallout-build/Fallout/pull/581) — settled on `Fallout.GlobalTool` as the id to keep.
97+
- [#582](https://github.com/Fallout-build/Fallout/issues/582) — the rule that stops this happening again.

src/Fallout.Migrate/Common/MigrationContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal sealed class MigrationContext(AbsolutePath rootDirectory, bool dryRun,
2828
public string FalloutVersion { get; internal set; }
2929

3030
/// <summary>
31-
/// The version to pin for the <c>fallout.globaltools</c> dotnet tool in a rewritten
31+
/// The version to pin for the <c>fallout.globaltool</c> dotnet tool in a rewritten
3232
/// <c>dotnet-tools.json</c>, or <c>null</c> when it could not be resolved. Tracked separately from
3333
/// <see cref="FalloutVersion"/> because the tool ships under its own package id, which was
3434
/// introduced later and so has a different set of published versions (#575). Set by

src/Fallout.Migrate/Fallout.Migrate.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19+
<PackageReference Include="CliWrap" />
1920
<PackageReference Include="JetBrains.Annotations" />
2021
<PackageReference Include="Spectre.Console.Cli" />
2122
</ItemGroup>

src/Fallout.Migrate/Migration.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ internal sealed class Migration(AbsolutePath rootDirectory, bool dryRun, TextWri
2020
/// <summary>
2121
/// The steps executed by <see cref="RunAsync"/>, in order. <see cref="ResolveFalloutVersionStep"/> must
2222
/// run first, since later steps read <see cref="MigrationContext.FalloutVersion"/> and
23-
/// <see cref="MigrationContext.ToolVersion"/> from it.
23+
/// <see cref="MigrationContext.ToolVersion"/> from it. <see cref="SwitchGlobalToolStep"/> runs
24+
/// after <see cref="RewriteToolManifestStep"/>: the manifest rewrite fixes the repo, the switch
25+
/// fixes the machine, and doing the repo first means an interrupted run still leaves the
26+
/// committed state correct.
2427
/// </summary>
2528
private static readonly IReadOnlyList<IMigrationStep> steps =
2629
[
@@ -33,6 +36,7 @@ internal sealed class Migration(AbsolutePath rootDirectory, bool dryRun, TextWri
3336
new RewriteBootstrapScriptsStep(),
3437
new CleanupBootstrapScriptsStep(),
3538
new RewriteToolManifestStep(),
39+
new SwitchGlobalToolStep(),
3640
new RenameNukeDirectoryStep()
3741
];
3842

src/Fallout.Migrate/Steps/ResolveFalloutVersionStep.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal sealed class ResolveFalloutVersionStep : IMigrationStep
4444
/// from <see cref="PackageId"/>: the tool id was introduced later, so it has its own, much
4545
/// shorter, set of published versions (#575).
4646
/// </summary>
47-
private const string ToolPackageId = "fallout.globaltools";
47+
private const string ToolPackageId = RewriteToolManifestStep.CurrentToolId;
4848

4949
private static readonly HttpClient httpClient = CreateHttpClient();
5050

0 commit comments

Comments
 (0)