Gradle plugin for generating resource files at build time.
- Apply the plugin
plugins { // Apply the plugin id("xyz.jpenilla.resource-factory") version "VERSION" }
- Add resource factories to the desired source sets
// for example, the 'main' source set sourceSets.main { resourceFactory { factories(/* ... */) } }
Type | Convention Plugin |
---|---|
PaperPluginYaml | xyz.jpenilla.resource-factory-paper-convention |
BukkitPluginYaml | xyz.jpenilla.resource-factory-bukkit-convention |
VelocityPluginJson | xyz.jpenilla.resource-factory-velocity-convention |
FabricModJson | xyz.jpenilla.resource-factory-fabric-convention |
BungeeCordPluginYaml | xyz.jpenilla.resource-factory-bungee-convention |
The included factories can be used in two ways. PaperPluginYaml is used as an example, but the process is the same for the other included factories.
The provided convention plugins can be applied in addition to or instead of the base xyz.jpenilla.resource-factory
plugin.
These conventions behave the same as the below manual examples, however they also register an extension for the resource
object.
This allows simplifying use to the following:
plugins {
// Apply the convention plugin
id("xyz.jpenilla.resource-factory-paper-convention") version "VERSION"
}
paperPluginYaml {
// Defaults for name, version, and description are inherited from the Gradle project
main = "main.class.Name"
authors.add("MyName")
// configure fields...
}
The included factories can be used manually in two ways.
- Directly on the project instance, and then registered manually
import xyz.jpenilla.resourcefactory.paper.paperPluginYaml val yaml = paperPluginYaml { // Defaults for name, version, and description are inherited from the Gradle project main = "main.class.Name" authors.add("MyName") // configure fields... } sourceSets.main { resourceFactory { factory(yaml.resourceFactory()) } }
- From within the resource factory extension
sourceSets.main { resourceFactory { paperPluginYaml { // Defaults for name, version, and description are inherited from the Gradle project main = "main.class.Name" authors.add("MyName") // configure fields... } } }