- import org.spongepowered.gradle.plugin.config.PluginLoaders
- import org.spongepowered.plugin.metadata.model.PluginDependency
- plugins {
- #if ($LANGUAGE == 'Kotlin')
- kotlin("jvm") version "${KOTLIN_VERSION}"
- id("com.github.johnrengelman.shadow") version "8.1.1"
- #else
- `java-library`
- #end
- id("org.spongepowered.gradle.plugin") version "2.2.0"
- }
- group = "${BUILD_COORDS.groupId}"
- version = "${BUILD_COORDS.version}"
- repositories {
- mavenCentral()
- maven("https://repo.spongepowered.org/maven/") {
- name = "spongepowered-repo"
- }
- }
- #if ($LANGUAGE == "Kotlin")
- dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
- }
- #end
- sponge {
- apiVersion("${SPONGEAPI_VERSION}")
- license("${LICENSE.id}")
- 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}
- #if ($LANGUAGE == 'Kotlin')
- kotlin {
- jvmToolchain(javaTarget)
- }
- tasks.build {
- dependsOn("shadowJar")
- }
- #else
- java {
- toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
- }
- tasks.withType<JavaCompile>().configureEach {
- options.apply {
- encoding = "utf-8" // Consistent source file encoding
- if (JavaVersion.current().isJava10Compatible) {
- release.set(javaTarget)
- }
- }
- }
- #end
- // Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output
- tasks.withType<AbstractArchiveTask>().configureEach {
- isReproducibleFileOrder = true
- isPreserveFileTimestamps = false
- }
- import org.spongepowered.gradle.plugin.config.PluginLoaders
- import org.spongepowered.plugin.metadata.model.PluginDependency
- plugins {
- #if ($LANGUAGE == 'Kotlin')
- kotlin("jvm") version "${KOTLIN_VERSION}"
- id("com.github.johnrengelman.shadow") version "8.1.1"
- #else
- `java-library`
- #end
- id("org.spongepowered.gradle.plugin") version "2.2.0"
- }
- group = "${BUILD_COORDS.groupId}"
- version = "${BUILD_COORDS.version}"
- repositories {
- mavenCentral()
- maven("https://repo.spongepowered.org/maven/") {
- name = "spongepowered-repo"
- }
- }
- #if ($LANGUAGE == "Kotlin")
- dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
- }
- #end
- sponge {
- apiVersion("${SPONGEAPI_VERSION}")
- license("${LICENSE.id}")
- 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)
- }
- }
- }
- val javaTarget = ${JAVA_VERSION} // Sponge targets a minimum of Java ${JAVA_VERSION}
- #if ($LANGUAGE == 'Kotlin')
- kotlin {
- jvmToolchain(javaTarget)
- }
- tasks.build {
- dependsOn("shadowJar")
- }
- #else
- java {
- toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
- }
- tasks.withType<JavaCompile>().configureEach {
- options.apply {
- encoding = "utf-8" // Consistent source file encoding
- if (JavaVersion.current().isJava10Compatible) {
- release.set(javaTarget)
- }
- }
- }
- #end
- // Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output
- tasks.withType<AbstractArchiveTask>().configureEach {
- isReproducibleFileOrder = true
- isPreserveFileTimestamps = false
- }