diff --git a/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/in/build.gradle.kts b/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/in/build.gradle.kts index 6f1affe..67d0751 100644 --- a/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/in/build.gradle.kts +++ b/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/in/build.gradle.kts @@ -17,7 +17,11 @@ sponge { displayName("Example") version("0.1") entrypoint("org.spongepowered.example.Example") + guiceModule("org.spongepowered.example.ExampleModule") description("Just testing things...") + property("boolean-property", true) + property("int-property", 3) + property("string-property", "test") links { homepage("https://spongepowered.org") source("https://spongepowered.org/source") diff --git a/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/out/sponge_plugins.json b/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/out/sponge_plugins.json index c142d85..22c397f 100644 --- a/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/out/sponge_plugins.json +++ b/plugin-development/src/functionalTest/resources/org/spongepowered/gradle/plugin/simplebuild/out/sponge_plugins.json @@ -30,7 +30,13 @@ "load-order": "after", "optional": false } - ] + ], + "properties": { + "guice-module": "org.spongepowered.example.ExampleModule", + "boolean-property": "true", + "int-property": "3", + "string-property": "test" + } } ] } \ No newline at end of file diff --git a/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginConfiguration.java b/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginConfiguration.java index 72514b4..ae39303 100644 --- a/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginConfiguration.java +++ b/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginConfiguration.java @@ -85,4 +85,8 @@ public void description(final String description) { this.description.set(description); } + public void guiceModule(final String guiceModule) { + this.property("guice-module", guiceModule); + } + } diff --git a/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginInheritableConfiguration.java b/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginInheritableConfiguration.java index 795eae8..efbe253 100644 --- a/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginInheritableConfiguration.java +++ b/plugin-development/src/main/java/org/spongepowered/gradle/plugin/config/PluginInheritableConfiguration.java @@ -27,6 +27,7 @@ import org.gradle.api.Action; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.model.ObjectFactory; +import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Nested; @@ -46,6 +47,8 @@ public abstract class PluginInheritableConfiguration { private final NamedDomainObjectContainer dependencies; + private final MapProperty properties; + @Inject public PluginInheritableConfiguration(final ObjectFactory objects) { @@ -55,6 +58,7 @@ public PluginInheritableConfiguration(final ObjectFactory objects) { this.contributors = objects.domainObjectContainer(PluginContributorConfiguration.class); this.dependencies = objects.domainObjectContainer(PluginDependencyConfiguration.class); + this.properties = objects.mapProperty(String.class, Object.class); } @Input @@ -110,4 +114,14 @@ public void dependencies(final Action action) { this.dependencies.register(name, action); } + + @Input + @Optional + public MapProperty getProperties() { + return this.properties; + } + + public void property(final String key, final Object value) { + this.properties.put(key, value); + } } diff --git a/plugin-development/src/main/java/org/spongepowered/gradle/plugin/task/WritePluginMetadataTask.java b/plugin-development/src/main/java/org/spongepowered/gradle/plugin/task/WritePluginMetadataTask.java index 7e1277f..3769f6d 100644 --- a/plugin-development/src/main/java/org/spongepowered/gradle/plugin/task/WritePluginMetadataTask.java +++ b/plugin-development/src/main/java/org/spongepowered/gradle/plugin/task/WritePluginMetadataTask.java @@ -174,6 +174,8 @@ private > T populateBuilder( builder.addDependency(dependencyBuilder.build()); } + + builder.properties(src.getProperties().get()); return builder; } }