Replies: 2 comments 3 replies
|
tldr; yes the original NUKE approach IS horrible and we are working on fixing this with an architecture piece that probably spans at least the next 1-2 major versions. So long story short is, you probably have to put up with it for now :-(
Awesome, this is exactly my vision. Fallout at some point should be its standalone build server and deployment agent. Just give us some time, we're slowly but surely getting there :-) I too have a homelab and most of my projects can happily build there, instead of in MS cloud somewhere in a US DC ;-)
Iirc then we introduced context with todays release, but at least the main branch has it. We're slowly building it up so that you can have a shared context instead of limping this along in static partial classes. Basically real OOP :-) Conceptual for your problem: [Parameter] string[] TargetOs = [ "windows", "linux", "macos"]and then have the one execute method that iterates over all those TargetOs and runs your build definition. As for running one central build to build all the other builds, not quite in scope unfortunately. As I said, we're reworking the underlying architecture because in the future those things should just work out of the box and natively What I would suggest as a realistic setup (i.e. I run this at home): |
Could you explain a bit more for me on how this would work, or a possible example of how it would work? I know this is under the context of the public class MPVServer : NukeBuild
{
readonly MPVServer_Native NativeBuildServer = new();
readonly MPVServer_Linux LinuxBuildServer = new();
public Target BuildAll => _ => _
.DependsOn(LinuxBuildServer.Build)
.DependsOn(NativeBuildServer.Build);
}To my knowledge this throws an exception since it tries to look for the target called "Build" in the current context of the class and doesn't look deeper into the actual reference. I tend to agree that a per-project build is probably better for my case, but I personally dislike the idea of a fragmented base for this kind of project. That and I have never done anything with Forgejo before, which is probably the solution to the fragmentation issue. |
Uh oh!
There was an error while loading. Please reload this page.
Warning
Long Post. Verbose, but not written by AI lol
I had an idea to make myself some build servers for various open-source programs, then to build them via NUKE / Fallout. I've ran into some issues that hopefully someone more experienced can share some guidance on how I should go about structuring this.
Ideally I'd like for something like
./build.ps1 mpvor./build.ps1 all --target-os 'windows'where you can target multiple operating systems,How it currently works is via the Main method I'd do multiple
Execute<MPV_Linux>(x => x.Build),Execute<MPV_Windows>(x => x.Build)which is very tedious, requires editing the source for changing targets.How I see NUKE / Fallout set up with the expression dependencies it uses reflection within the context of the current
: NukeBuild/: FalloutBuildclass to detect dependent targets. This is problematic when you have nested targets, eg.Then inside your main class, you'd have something like:
Due to Targets having dependencies locked to their own respective instance, this approach is impossible.
Another approach I've considered is executing nested
Execute<ProjectServer>(x => ...)calls within each-other but this is also impossible due to NUKE locking the build.log file during each top-level Execute call.What NUKE / Fallout recommends in this approach from what I've read is using Build Components. But I've hit a snag on this too. Interfaces restrict the use of fields and non-public members, which means persisting state is problematic.
I started looking into how the original NUKE build chain deals with the issue of persisting state and it just seems absolutely horrible. Their original approach is making the main build class partial, and daisy-chaining on state as they go (example found here). This approach also has an issue of being unable to have duplicate member names. So you can only have 1 "Restore" member through the entire c;ass (And no, C#'s
filekeyword can't be used on member instances, only top-level types)Another approach I've considered is isolating each build server to their own respective project, then controlling everything from the NUKE build project via DotnetTasks.DotnetRun, but this (probably) has the same issue as the
Execute<ProjectServer>(x => ...)calls, where thebuild.logwill get locked by the top build project.Would love some feedback on how I can approach nested build servers using NUKE / Fallout
All reactions