- import org.spongepowered.gradle.plugin.config.PluginLoaders
- import org.spongepowered.plugin.metadata.model.PluginDependency
-
- plugins {
- `java-library`
- id("org.spongepowered.gradle.plugin") version "2.1.1"
- }
-
- group = "${GROUP_ID}"
- version = "${PLUGIN_VERSION}"
-
- repositories {
- mavenCentral()
- }
-
- sponge {
- apiVersion("${SPONGEAPI_VERSION}")
- license("${LICENSE}")
- loader {
- name(PluginLoaders.JAVA_PLAIN)
- version("1.0")
- }
- plugin("${PLUGIN_ID}") {
- displayName("${PLUGIN_NAME}")
- entrypoint("${MAIN_CLASS}")
- #if (${DESCRIPTION})
- description("${DESCRIPTION}")
- #else
- description("My plugin description")
- #end
- links {
- #if (${WEBSITE})
- homepage("${WEBSITE}")
- #else
- // homepage("https://spongepowered.org")
- #end
- // source("https://spongepowered.org/source")
- // issues("https://spongepowered.org/issues")
- }
- #foreach (${AUTHOR} in ${AUTHORS})
- contributor("${AUTHOR}") {
- description("Author")
- }
- #end
- dependency("spongeapi") {
- loadOrder(PluginDependency.LoadOrder.AFTER)
- optional(false)
- }
- #foreach (${DEPENDENCY} in ${DEPENDENCIES})
- dependency("${DEPEDENCY}") {
- loadOrder(PluginDependency.LoadOrder.AFTER)
- optional(false)
- }
- #end
- }
- }
-
- val javaTarget = ${JAVA_VERSION} // Sponge targets a minimum of Java ${JAVA_VERSION}
- java {
- sourceCompatibility = JavaVersion.toVersion(javaTarget)
- targetCompatibility = JavaVersion.toVersion(javaTarget)
- if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
- toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
- }
- }
-
- tasks.withType(JavaCompile::class).configureEach {
- options.apply {
- encoding = "utf-8" // Consistent source file encoding
- if (JavaVersion.current().isJava10Compatible) {
- release.set(javaTarget)
- }
- }
- }
-
- // Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output
- tasks.withType(AbstractArchiveTask::class).configureEach {
- isReproducibleFileOrder = true
- isPreserveFileTimestamps = false
- }
- import org.spongepowered.gradle.plugin.config.PluginLoaders
- import org.spongepowered.plugin.metadata.model.PluginDependency
-
- plugins {
- `java-library`
- id("org.spongepowered.gradle.plugin") version "2.2.0"
- }
-
- group = "${GROUP_ID}"
- version = "${PLUGIN_VERSION}"
-
- repositories {
- mavenCentral()
- }
-
- sponge {
- apiVersion("${SPONGEAPI_VERSION}")
- license("${LICENSE}")
- loader {
- name(PluginLoaders.JAVA_PLAIN)
- version("1.0")
- }
- plugin("${PLUGIN_ID}") {
- displayName("${PLUGIN_NAME}")
- entrypoint("${MAIN_CLASS}")
- #if (${DESCRIPTION})
- description("${DESCRIPTION}")
- #else
- description("My plugin description")
- #end
- links {
- #if (${WEBSITE})
- homepageLink("${WEBSITE}")
- #else
- // homepageLink("https://spongepowered.org")
- #end
- // sourceLink("https://spongepowered.org/source")
- // issuesLink("https://spongepowered.org/issues")
- }
- #foreach (${AUTHOR} in ${AUTHORS})
- contributor("${AUTHOR}") {
- description("Author")
- }
- #end
- dependency("spongeapi") {
- loadOrder(PluginDependency.LoadOrder.AFTER)
- optional(false)
- }
- #foreach (${DEPENDENCY} in ${DEPENDENCIES})
- dependency("${DEPEDENCY}") {
- loadOrder(PluginDependency.LoadOrder.AFTER)
- optional(false)
- }
- #end
- }
- }
-
- val javaTarget = ${JAVA_VERSION} // Sponge targets a minimum of Java ${JAVA_VERSION}
- java {
- sourceCompatibility = JavaVersion.toVersion(javaTarget)
- targetCompatibility = JavaVersion.toVersion(javaTarget)
- if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
- toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
- }
- }
-
- tasks.withType(JavaCompile::class).configureEach {
- options.apply {
- encoding = "utf-8" // Consistent source file encoding
- if (JavaVersion.current().isJava10Compatible) {
- release.set(javaTarget)
- }
- }
- }
-
- // Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output
- tasks.withType(AbstractArchiveTask::class).configureEach {
- isReproducibleFileOrder = true
- isPreserveFileTimestamps = false
- }