build: run build.fsx with dotnet fsi instead of the FAKE runner - #4422
Merged
Conversation
The build was started through `mono packages/build/FAKE/tools/FAKE.exe`, a .NET Framework executable. That runner is what forced Mono on Linux, pulled in the legacy MSBuild discovery, and had to stay in step with the .NET SDK. Run the script with `dotnet fsi` instead. FAKE 4.64.17 is now used as a library only: build.fsx itself, its targets and the produced artifacts are unchanged. Without the runner the script has to parse its own command line, so translate `<Target> key=value ...` into the environment variables FAKE reads back through getBuildParam/hasBuildParam. This happens before any other binding, since top-level values such as testSuiteFilterFlakyTests read build parameters while the script loads. Also drop the ServicePointManager.SecurityProtocol assignment: it enabled TLS 1.2 on old runtimes and now throws NotSupportedException on .NET 10, because it also requests SSL3. Mono is still required for the targets that execute .NET Framework binaries, namely MergePaketTool (ILRepack) and the net461 test passes; FAKE keeps prefixing those with mono on its own. Refs #4348
State that build.cmd and build.sh run build.fsx with dotnet fsi and that FAKE is used as a library, so no runner has to be installed and its version no longer has to match the SDK. Keep saying that Mono is still needed on Linux, but narrow it to what actually needs it: MergePaketTool and the net461 test passes. Fix the skip examples in CLAUDE.md along the way. Skip switches are build parameters, not targets, so they take a value and follow the target name; the documented `build.cmd SkipTests` was read as a target name and never worked. Refs #4348
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
First step towards #4348.
The build is started through
mono packages/build/FAKE/tools/FAKE.exe, a .NET Frameworkexecutable. That runner is what forces Mono on Linux, pulls in the legacy MSBuild discovery and
the obsolete
RoslynTools.MSBuildpath behind #4002, and has to stay in step with the .NET SDK.The problem is the runner, not the library. So this PR only changes how the script is started:
build.fsxstays the same FAKE 4.64.17 script, but runs underdotnet fsi.Upgrading to FAKE 6 is deliberately left for later: it would mean rewriting the ~730 lines of the
script (every API is renamed), replacing
Octokit.fsxwithFake.Api.GitHuband moving the GitHubrelease to a token. None of that is needed to drop the runner.
Changes
build.sh/build.cmdcalldotnet fsi build.fsx. The Mono-specificcertmgr/mozrootsdiagnostics block goes away, as does the
RoslynTools.MSBuildline (that package is not even inpaket.dependenciesany more).build.fsxgains ~10 lines: without the runner the script has to parse its own command line, soit translates
<Target> key=value ...into the environment variables FAKE reads back throughgetBuildParam/hasBuildParam. It runs before any other binding, because top-level values suchas
testSuiteFilterFlakyTestsread build parameters while the script loads.build.fsxdrops theServicePointManager.SecurityProtocolassignment. It enabled TLS 1.2 on oldruntimes and now throws
NotSupportedExceptionon .NET 10, since it also requests SSL3.CLAUDE.md's skip examples are corrected on the way: skip switches arebuild parameters, not targets, so they take a value and follow the target name — the documented
build.cmd SkipTestswas read as a target name and never worked.No change to
paket.dependencies/paket.lock, to the targets, to the produced artifacts, to thetarget frameworks, or to
ci.yml.What this does not do
Mono is still installed and still required, for the targets that execute .NET Framework binaries:
MergePaketTool(which runsILRepack.exe) and thenet461test passes. FAKE keeps prefixing thosewith
monoon its own, so they needed no change. Removing that is the next step.Validation
Run on Linux, .NET SDK 10.0.400:
dotnet fsi build.fsx CleanDocs— target selection works, only that target runs.dotnet fsi build.fsx Build— OK.dotnet fsi build.fsx Publish— OK, producesbin/net461/paket.exe,bin/net10.0/paket.dll,bin_bootstrapper/net461/paket.bootstrapper.exe,bin_bootstrapper/net10.0/paket.bootstrapper.dll.dotnet fsi build.fsx MergePaketTool— OK, includingRunTeststhrough the target graph.bin/merged/paket.exeis produced and runs:Paket version 11.0.0-alpha001.Worth a look on Windows CI, since
build.cmdunderdotnet fsicould not be exercised locally.Also checked while porting:
FakeLib.dll(which targets.NETFramework,Version=v4.5) loads fineunder .NET 10, as do
#loadofOctokit.fsxand the#rof the GAC assemblies at the top of thescript;
isMonostill evaluates totrueon Linux, so thenot isMonoguards keep the exact same"not Windows" meaning as before.
Follow-ups for #4348
ILRepack.exewith thedotnet-ilrepacktool and restrict thenet461test passes toWindows — only then can
Install Monoleaveci.yml.DotNet.testdefaults toConfiguration = Debugin FAKE 6 while build/publish/pack default toRelease, so with--no-buildthe tests would look inbin/Debug.lib/net40), which is whyFAKE < 5stays in theBuildgroup.