Skip to content

More declarative API for defining nodes and subprojects #4

@Deftu

Description

@Deftu

I've created the following mock-up for the in-settings DSL:

preprocess {
    create(rootProject) {
        // Now acts as a true root build file for the project passed to `create`.
        // This script no longer needs to handle nodes, as they're handled below.
        // OPTIONAL! Can be left unset
        rootBuildScript = "root.gradle.kts" // Relative to the project's directory

        // `root` sets that node as the root node, aka your "branch" node
        // this acts as the head from which all subsequent nodes will remap from
        //
        // `node` takes the subproject (auto-generated) name and the version number
        // as an integer representation, empty spaces 0-padded (aside from the major)
        root(node("1.21.8-neoforge", 1_21_08))
            // `to` links to the given node and returns it back, making you chain `to`
            // calls to link consecutive nodes. extra mappings will be configurable via
            // a sealed interface, either letting the plugin decide the filename for you
            // (while making you select path still), or giving you reign over the full path
            // (`EM` for short, as to keep lines readable... `"mappings"` here is the relative path)
            .to(node("1.21.8-fabric", 1_21_08, EM.named("mappings")))
            // of course, it must still be in correct order
            .to(node("1.21.7-fabric", 1_21_07) {
                // You can pass a block to `node` which lets you configure some things,
                // such as the `Project` it's tied to should you not want it to be done
                // auto-magically in the background
                include(":fabric-1.21.7") // Different name!
                project = project(":fabric-1.21.7")
            }).to(...) // And then right back to linking more nodes...
    }
}

This also entirely removes the requirement of any form of root.gradle.kts.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions