Closed
Conversation
… minor cleanup (namespaces and modules)
…rencing nuget), fixed console garbling in VS, added support for substitutions in phony rules, closing database on Ctrl-C, support for Tasks in recipes
Feature/netcore
- Added new build and publish workflows for .NET projects. - Updated .NET SDK version from 7.0 to 9.0 in global.json and project files.
#2) * Enhance documentation and improve Shell command options in Xake scripts, new dependsOn function, updates sample code in features.fsx * Update samples/features.fsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/core/ScriptFuncs.fs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: olegz <oleg.zaimkin@developertools.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor version retrieval in build script to simplify logic and improve clarity new feature: --resetdb flag that clears database before running build. fix: all targets requested become lowercase while parsing CLI args. Add stdout and stderr handlers to ShellOptions and update tests
* feature: NoPersist and Teardown options in ExecOptions feature: new "engine" mode for library mode * refactor: enhance file reading functions and improve XakeEngine demand handling * Deep refactoring of exec types and engine classes * few fixes based on code review * Update src/core/WorkerPool.fs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * following up review notes + more doc comments --------- Co-authored-by: olegz <oleg.zaimkin@developertools.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* feature: NoPersist and Teardown options in ExecOptions feature: new "engine" mode for library mode * refactor: enhance file reading functions and improve XakeEngine demand handling * Deep refactoring of exec types and engine classes * few fixes based on code review * Update src/core/WorkerPool.fs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * following up review notes + more doc comments * follow up more issues * Refactor error logging and improve demand handling in the engine: - fixed noPersist behavior - demand waits for prior runs of same target to complete before start - more tests to verify behavior --------- Co-authored-by: olegz <oleg.zaimkin@developertools.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add RuleBuilder implementing new rules definition syntax using "target" and "command" keywords * new command rules are now imperative: always executed * Update src/core/RuleBuilder.fs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix XML doc comment misassociation for `<==` operator and `needSequentially` (#8) * Initial plan * Fix XML doc comment placement: move needSequentially above the <== doc block Co-authored-by: OlegZee <513301+OlegZee@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: OlegZee <513301+OlegZee@users.noreply.github.com> * Moving new command, target(s) syntax to Xake namespace (from Experimental) --------- Co-authored-by: olegz <oleg.zaimkin@developertools.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: OlegZee <513301+OlegZee@users.noreply.github.com>
…eturn shell result code and console output
Feature/sh enhancements
* implement typed variable system with support for CLI and environment variable resolution Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…#11) Adds consistent teardown execution for CLI script runs so teardown targets run after both successful builds and build failures (including when ThrowOnError is enabled), aligning CLI behavior with the long-lived engine teardown flow. Changes: Introduces ScriptRunner.runTeardownAsync and uses it from both CLI execution and XakeEngine.StopAsync. Updates CLI runScript to always run teardown after build completion/failure, and to preserve the original build error when teardown also fails. Adds CLI-focused tests covering teardown on success, failure, teardown-failure reporting, and skipping teardown for --dryrun/--dump.
… improve progress reporting. improved: turning progress off for engine mode, cleaned output in tests
There was a problem hiding this comment.
Pull request overview
This PR modernizes Xake’s core execution model and scripting surface by introducing a long-lived engine API, typed variable/schema support with --help integration, and updated build/test infrastructure targeting newer .NET tooling.
Changes:
- Refactors script execution into a new
ScriptRunnerpipeline and adds a long-livedXakeEngine(start/Demand/StopAsync) for watch/LSP-style usage. - Introduces typed variables (
Var.*) andvarschemafor CLI/env resolution +--helpoutput. - Updates build scripts, samples, docs, CI workflows, and test target frameworks/tooling (notably
net9.0for tests and .NET 9global.json).
Reviewed changes
Copilot reviewed 66 out of 68 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| xake.sln | Removes Paket solution items from the solution structure. |
| src/tests/XakeScriptTests.fs | Updates tests for new options semantics (e.g., ResetDb) and minor refactors. |
| src/tests/XakeEngineTests.fs | Adds new tests for long-lived engine Demand/StopAsync behavior and concurrency. |
| src/tests/VarsTests.fs | Adds comprehensive tests for typed variables, env/CLI precedence, and varschema behavior. |
| src/tests/tests.fsproj | Moves tests to net9.0 and updates test packages; adds new test files. |
| src/tests/SystemTaskTests.fs | Expands shell task tests (Unix-focused) and adjusts options (ThrowOnError, ResetDb). |
| src/tests/StorageTests.fs | Adds test coverage for Storage.cleanupDb. |
| src/tests/ScriptErrorTests.fs | Switches to ThrowOnError and adjusts logger filter and want usage. |
| src/tests/RecipeTests.fs | Switches to ThrowOnError in test options. |
| src/tests/CommandTests.fs | Adds tests for new command rule behavior across runs and engine demands. |
| src/tests/CommandLineTests.fs | Refactors CLI assertions; adds teardown/resetdb/case-preservation tests. |
| src/core/XakeScriptBuilder.fs | Introduces new script builder + long-lived XakeEngine implementation. |
| src/core/XakeScript.fs | Moves/defines ExecOptions here; adds new operators and options (ResetDb/NoPersist/Teardown/VarSchema). |
| src/core/Xake.fsproj | Adjusts target frameworks, compile order, and adds new core modules. |
| src/core/WorkerPool.fs | Refactors worker pool; adds scheduler helper for yielded slots. |
| src/core/Vars.fs | Adds typed variable API (Var.*), required/default helpers, and varschema reflection-based schema capture. |
| src/core/Types.fs | Adds/updates domain type documentation and comments. |
| src/core/Tasks/Shell.fs | Extends shell CE API (stdout/stderr hooks, output capture, result composition) and improves docs. |
| src/core/Tasks/Rm.fs | Adds/updates inline documentation for rm task and aliases. |
| src/core/Tasks/misc.fs | Adds read helpers and reorganizes write helpers (writeTargetText, bytes). |
| src/core/Tasks/Cp.fs | Adds/updates inline documentation for copy task and alias. |
| src/core/ScriptRunner.fs | New centralized runner converting ExecOptions → EngineOptions, handling Ctrl+C, teardown, resetdb, etc. |
| src/core/ScriptFuncs.fs | Refactors recipe helpers; getVar now reads from ctx.Vars; adds helpers like dependsOn. |
| src/core/RuleBuilder.fs | Adds command/target/targets builder-style rule definitions. |
| src/core/RecipeFunctions.fs | Moves to module Xake.Recipe and streamlines helpers. |
| src/core/RecipeBuilder.fs | Extends recipe CE to bind Task<'T> and improves inline docs. |
| src/core/Progress.fs | Tweaks progress loop timing and console reporting (active tasks count). |
| src/core/Program.fs | Makes ParseArgs public; adds --resetdb; changes help flow to ShowHelp; adds xakeEngine builder. |
| src/core/ProcessExec.fs | Converts to module internal Xake.ProcessExec and adds docs for pexec. |
| src/core/Prelude.fs | Adds small helper docs for operators/active patterns. |
| src/core/Pickler.fs | Refactors pickler module layout and definitions into Xake.Pickler. |
| src/core/PathExt.fs | Adds auto-open path operators module. |
| src/core/Path.fs | Refactors into module Xake.Path and removes embedded PathExt operators (now in PathExt.fs). |
| src/core/FileTasksImpl.fs | Adds doc comment for ensureDirCreated. |
| src/core/Fileset.fs | Refactors into module Xake.Fileset with clearer types/docs; keeps existing behavior. |
| src/core/File.fs | Adds documentation; modifies name comparison/hash logic. |
| src/core/ExecTypes.fs | Splits engine-level types (EngineOptions/EngineState) vs exec context; adds var/schema types. |
| src/core/DependencyAnalysis.fs | Updates to use ctx.Vars for var deps; signature cleanup. |
| src/core/Database.fs | Adds noopDb, cleanupDb, backup helper, docstrings, and minor logging changes. |
| src/core/CommonLib.fs | Refactors module declaration and documentation comments. |
| src/core/inner-examples.fsx | Removes internal example script. |
| samples/rmdir.fsx | Updates script header to #r "nuget: ..." reference style/version. |
| samples/gettingstarted.fsx | Updates script references to NuGet-style #r and newer package versions. |
| samples/features.fsx | Updates sample to dotnet fsi flow and demonstrates new command/target/dependsOn/sh features. |
| samples/catch_errors.fsx | Updates script reference to NuGet-style #r. |
| samples/book/intro.fsx | Updates script references to NuGet-style #r (currently with a syntax issue). |
| readme.md | Updates badges, usage instructions, and links; shifts from FAKE to dotnet fsi. |
| LICENSE | Updates copyright year range. |
| global.json | Pins/requires .NET SDK 9 with major roll-forward. |
| build.sh | Updates build invocation to dotnet fsi. |
| build.cmd | Updates build invocation to dotnet fsi. |
| build.proj | Removes legacy FAKE tool restore project. |
| build.fsx.lock | Removes old paket lock for build script. |
| build.fsx | Updates build script to new APIs (varschema, typed vars, command/targets, sh). |
| .vscode/settings.json | Removes repo-level VS Code settings. |
| .travis.yml | Updates Travis script to dotnet fsi (SDK version currently mismatched with global.json). |
| .gitignore | Adds Ionide/VS Code/Claude local settings ignores. |
| .github/workflows/publish.yml | Adds GitHub Actions workflow for tagged publish. |
| .github/workflows/build.yml | Adds GitHub Actions workflow for PR/branch build and test. |
| docs/todo.md | Removes outdated TODO document. |
| docs/tasks.md | Rewrites tasks documentation around new APIs (sh/cp/rm, output capture). |
| docs/overview.md | Replaces long overview with concise modern baseline and examples. |
| docs/implnotes.md | Replaces legacy internals notes with updated high-level implementation notes. |
| docs/devprocess.md | Updates dev workflow to .NET 9 / dotnet fsi commands and current release process. |
| docs/cheatsheet.md | Adds new concise cheatsheet for current API and CLI usage. |
| CLAUDE.md | Adds repository guidance for Claude Code (commands, architecture, conventions). |
Comments suppressed due to low confidence (1)
src/core/File.fs:13
- File path comparison is currently case-insensitive on Unix (
ignoreCase = Env.isUnix), which is the opposite of typical filesystem semantics and also inconsistent withDomainTypes.Target(which uses ordinal compare on Unix and ignore-case on Windows). This can cause incorrect equality/hashing forFileon Unix and break dependency tracking/caching.ignoreCaseshould likely benot Env.isUnix(andgetFileHashshould follow the same rule).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
17
to
+20
| let create (logger:ILogger) maxThreads = | ||
| // controls how many threads are running in parallel | ||
| let throttler = new SemaphoreSlim (maxThreads) | ||
| let log = logger.Log | ||
|
|
||
| let mapKey (artifact:Target) = artifact.FullName | ||
|
|
||
| throttler, MailboxProcessor.Start(fun mbox -> | ||
| let rec loop(map) = async { | ||
| let! msg = mbox.Receive() | ||
|
|
||
| match msg with | ||
| | Run(artifact, targets, action, chnl) -> | ||
| let mkey = artifact |> mapKey | ||
|
|
||
| match map |> Map.tryFind mkey with | ||
| | Some (task:Task<'a>) -> | ||
| log Never "Task found for '%s'. Status %A" artifact.ShortName task.Status | ||
| chnl.Reply <| Async.AwaitTask task | ||
| return! loop(map) | ||
|
|
||
| | None -> | ||
| do log Info "Task queued '%s'" artifact.ShortName | ||
| do! throttler.WaitAsync(-1) |> Async.AwaitTask |> Async.Ignore | ||
|
|
||
| let task = Async.StartAsTask (async { | ||
| try | ||
| let! buildResult = action | ||
| do log Info "Task done '%s'" artifact.ShortName | ||
| return buildResult | ||
| finally | ||
| throttler.Release() |> ignore | ||
| }) | ||
| chnl.Reply <| Async.AwaitTask task | ||
| let newMap = targets |> List.fold (fun m t -> m |> Map.add (mapKey t) task) map | ||
| return! loop newMap | ||
| } | ||
| loop(Map.empty) ) | ||
| // controls how many threads are running in parallel | ||
| let throttler = new SemaphoreSlim (maxThreads) | ||
| let log = logger.Log |
Comment on lines
+124
to
+128
| let makeCtx extraVars = { | ||
| Engine = engine | ||
| Vars = vars @ defaultArg extraVars [] | ||
| Progress = Progress.emptyProgress() | ||
| NeedRebuild = fun _ -> false |
Comment on lines
+158
to
+163
| let details = exceptions |> Seq.last |> fun e -> e.ToString() | ||
| let errorText = errors |> String.concat "\r\n" | ||
|
|
||
| do ctx.Logger.Log Error "Error '%s'. See build.log for more details" errorText | ||
| do ctx.Logger.Log Verbose "Error details are:\n%A\n\n" details | ||
| do ctx.Logger.Log Message "\n\n\tBuild failed after running for %A\n" (System.DateTime.Now - start) |
Comment on lines
54
to
+62
| let! ctx = getCtx() | ||
| let log = ctx.Logger.Log | ||
|
|
||
| do! trace Level.Debug "[shell] settings: '%A'" opts | ||
| do! trace Level.Debug "[shell] settings: '%A'" opts // dangerous to log all options, but we need it for debugging purposes. Consider redacting sensitive info in the future. | ||
|
|
||
| let handleErr s = log (opts.ErrOutLevel s) "%s %s" opts.LogPrefix s | ||
| let handleStd s = log (opts.StdOutLevel s) "%s %s" opts.LogPrefix s | ||
| let handleStd s = | ||
| log (opts.StdOutLevel s) "%s %s" opts.LogPrefix s | ||
| extraStd s |
Comment on lines
+50
to
+55
| /// Reset database before build | ||
| ResetDb: bool | ||
|
|
||
| /// Skip build database; every target always rebuilds. | ||
| NoPersist: bool | ||
|
|
| #!/bin/bash | ||
| dotnet restore build.proj | ||
| dotnet fake run build.fsx -- build No newline at end of file | ||
| dotnet fsi build.fsx -- -- No newline at end of file |
Comment on lines
1
to
6
| language: csharp | ||
| mono: latest | ||
| dotnet: 2.1.300 | ||
| dotnet: 7.0.202 | ||
| env: VER=$(if [[ "${TRAVIS_TAG:0:1}" == "v" ]]; then echo ${TRAVIS_TAG:1}.${TRAVIS_BUILD_NUMBER}; else echo 1.0.0.${TRAVIS_BUILD_NUMBER}; fi;) | ||
| install: | ||
| - dotnet restore build.proj | ||
| script: | ||
| - export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5-api/ | ||
| - dotnet fake run build.fsx -- build test -ll Diag | ||
| - dotnet fsi build.fsx -- -- build test -ll Diag | ||
| deploy: |
Comment on lines
31
to
37
| <ItemGroup> | ||
| <PackageReference Include="NUnit" Version="3.10.1" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7" /> | ||
| <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" /> | ||
| <PackageReference Include="NUnit" Version="3.13.3" /> | ||
| <PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /> | ||
| <PackageReference Include="NUnit.Analyzers" Version="3.6.1" /> | ||
| <PackageReference Include="coverlet.collector" Version="6.0.0" /> | ||
| </ItemGroup> |
| nuget Xake ~> 1.1 prerelease | ||
| nuget Xake.Dotnet ~> 1.1 prerelease //" // (1) | ||
| #r "nuget: Xake, 1.1.4.427-beta" | ||
| #r "nuget: Xake.Dotnet, 1.1.4.7-beta" (1) |
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.
No description provided.