FabricMC / fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
MIT License
226 stars 194 forks source link

[0.3] Lets talk abstracting loom away from Minecraft #63

Closed NZSmartie closed 3 years ago

NZSmartie commented 5 years ago

Some of you may have heard that I've been working to port Loom over to StarMade. One key component is loom as it download's the appropriate mappings, sets up Mixin Annotations during the compile task, etc...

The request for loom to be more abstract is sparked from fabric-loader 0.4 becoming less specific to Minecraft in terms of loading mods. As it's successfully been used used to load mods into StartMade.

Asset/Libraries

With AssetIndexJson, VertsionInfoJson and VersionManifestJson classes, i've added a static method to parse the above and add entries based on file type. However this is isn't the best approach for the long term.

Merging Jars

StarMade only has a single game jar that provides both Server and Client modes. At the same time if playing singleplay or hosting a multiplayer lan.

I've removed the merge jars task in the fork of loom for StarMade, but this could be made an optional step.

The Loom extension minecraft

This could be renamed to just loom when used in the build.gradle script.

minecraft { // This can be renamed to loom. And have another field to quickly select a minecraft configuration.
    version = project.minecraft_version
    mappings "net.fabricmc:yarn:${project.yarn_mappings}"
}

Unless it's possible to configure multiple gradle extensions, one per supported game that sets up (enables/disables) tasks in the loom plugion.


These are my thoughts so far and I welcome any feedback on ways to move forward or if it's better to maintain a fork and merging changes from upstream.

NZSmartie commented 5 years ago

Mentioned briefly in IRC that asset management for particular games should be decoupled into plugins that are used by loom.

Each plugin for loom could

loom {
        target "minecraft" // Name of plugin, or supported game that is listed by plugin
        version "1.13"
        mappings "net.fabric.yarn:1.13.6"
}

thought to add it here to help keep track of ideas.

Chocohead commented 5 years ago

Just to expand on the multiple plugin idea so that it doesn't get forgotten in the IRC past:

I'd say that the abstract and Minecraft specific plugin style that Loom 0.2 went for is better for supporting more games than the single monolithic plugin Loom 0.3 now has.

The game specific plugins can all be exported together in the single Loom jar by specifying them all in the build.gradle, then be directly referred to by name so another game's specific tasks and utilities don't have to be added if not needed. This also carries the advantage that a target property could be avoided on the Project extension by simply having the plugin use the game name. Thus:

plugins {
    //Using the theoretical Minecraft Loom plugin
    id 'fabric-loom-minecraft' version '0.3.0-SNAPSHOT'
}

//Allows defining the version and mappings on a minecraft object
minecraft {
    version = project.minecraft_version
    mappings = "net.fabricmc:yarn:${project.yarn_mappings}"
}
plugins {
    //Using the theoretical StarMade Loom plugin
    id 'fabric-loom-starmade' version '0.3.0-SNAPSHOT'
}

//Allows defining the version and mappings on a starmade object
starmade {
    version = project.starmade_version
    mappings = "net.fabricmc:yarn:${project.yarn_mappings}"
}

It could even allow multiple games to be used from a single Gradle project by applying multiple plugins at once, although that might be pushing the limits of how Loom currently handles some things like mappings without cleaner (task) namespacing.

covers1624 commented 5 years ago

My plan for this is exactly what Choco has stated, a separate plugin for each 'pipeline'.

modmuss50 commented 3 years ago

Loom is highly tied into minecraft and I dont see much benefit to doing this huge amount of work. I dont see this ever happening.