Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpenilla/resource-factory
Gradle plugin for generating resources at build time
https://github.com/jpenilla/resource-factory
gradle-plugin resource-generator
Last synced: 2 months ago
JSON representation
Gradle plugin for generating resources at build time
- Host: GitHub
- URL: https://github.com/jpenilla/resource-factory
- Owner: jpenilla
- License: apache-2.0
- Created: 2024-03-21T19:34:41.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-09-23T22:22:22.000Z (3 months ago)
- Last Synced: 2024-10-03T11:23:37.541Z (3 months ago)
- Topics: gradle-plugin, resource-generator
- Language: Kotlin
- Homepage: https://plugins.gradle.org/search?term=xyz.jpenilla.resource-factory
- Size: 290 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Resource Factory Gradle Plugin
[![build](https://img.shields.io/github/actions/workflow/status/jpenilla/resource-factory/build.yml?branch=master)](https://github.com/jpenilla/resource-factory/actions)
[![license](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
[![latest release](https://img.shields.io/gradle-plugin-portal/v/xyz.jpenilla.resource-factory)](https://plugins.gradle.org/plugin/xyz.jpenilla.resource-factory)Gradle plugin for generating resource files at build time.
## Usage
1) Apply the plugin
```kotlin
plugins {
// Apply the plugin
id("xyz.jpenilla.resource-factory") version "VERSION"
}
```
2) Add resource factories to the desired source sets
```kotlin
// for example, the 'main' source set
sourceSets.main {
resourceFactory {
factories(/* ... */)
}
}
```## Included 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.### Convention Plugins
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:```kotlin
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...
}
```### Manually
The included factories can be used manually in two ways.
1) Directly on the project instance, and then registered manually
```kotlin
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())
}
}
```
2) From within the resource factory extension
```kotlin
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...
}
}
}
```