Cleanup and fix some of the gradle scripts. Add shadows to retain dependencies.

Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
This commit is contained in:
Gabriel Harris-Rouquette 2019-02-07 17:10:08 -08:00
parent fe40748929
commit e80c183894
No known key found for this signature in database
GPG Key ID: F34C08E5B2D67A0A
6 changed files with 56 additions and 25 deletions

View File

@ -1,9 +1,7 @@
buildscript { buildscript {
repositories { dependencies {
mavenLocal() classpath("com.github.jengelman.gradle.plugins:shadow:4.0.4")
mavenCentral()
} }
} }
group = properties["pluginGroup"]!! group = properties["pluginGroup"]!!
@ -14,6 +12,7 @@ plugins {
java java
} }
// Set up defaults for all projects, maven repositories, java compatibility level and compiling encoding
allprojects { allprojects {
apply(plugin="java-library") apply(plugin="java-library")
@ -30,4 +29,8 @@ allprojects {
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
} }
tasks.getting(JavaCompile::class) {
options.encoding = "UTF-8"
}
} }

View File

@ -1,3 +1,14 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:4.0.4")
}
}
repositories { repositories {
// Spigot & Bukkit // Spigot & Bukkit
@ -5,36 +16,44 @@ repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots") maven("https://oss.sonatype.org/content/repositories/snapshots")
mavenLocal() // For nms variants mavenLocal() // For nms variants
} }
plugins { plugins {
java java
id("com.github.johnrengelman.shadow")
} }
dependencies { dependencies {
implementation("org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT") // Spigot API implementation("org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT") // Spigot API
implementation("com.sk89q.worldguard", "worldguard-core", "7.0.0-SNAPSHOT") // WorldGuard implementation("com.sk89q.worldguard", "worldguard-core", "7.0.0-SNAPSHOT") // WorldGuard
implementation("com.sk89q.worldguard", "worldguard-legacy", "7.0.0-SNAPSHOT") // NEEDED implementation("com.sk89q.worldguard", "worldguard-legacy", "7.0.0-SNAPSHOT") // NEEDED
implementation("org.bstats", "bstats-bukkit", "1.4") // Bukkit bstats compile("org.bstats", "bstats-bukkit", "1.4") // Bukkit bstats
implementation("org.apache.tomcat", "tomcat-jdbc", "7.0.52") // tomcat JDBC implementation("org.apache.tomcat", "tomcat-jdbc", "7.0.52") // tomcat JDBC
implementation("org.apache.tomcat", "tomcat-juli", "7.0.52") // tomcat juli implementation("org.apache.tomcat", "tomcat-juli", "7.0.52") // tomcat juli
implementation("junit", "junit", "4.12") implementation("junit", "junit", "4.12")
compile(project(":core"))
} }
java { java {
sourceSets { sourceSets {
create("nms") create("nms")
} }
} }
val jar by tasks.getting(Jar::class) { val jar by tasks.getting(Jar::class) {
manifest { manifest {
attributes(mapOf( attributes(mapOf(
"Implementation-Title" to project.name, "Implementation-Title" to "mcMMO",
"Implementation-Version" to project.version, "Implementation-Version" to rootProject.properties["pluginVersion"]!!,
"Main-Class" to "com.gmail.nossr50.mcMMO" // Main plugin class for bukkit "Main-Class" to "com.gmail.nossr50.mcMMO" // Main plugin class for bukkit
)) ))
} }
} }
val shadowJar by tasks.getting(ShadowJar::class) {
dependencies {
include(project(":core"))
include(dependency("org.bstats:bstats-bukkit:1.4"))
}
relocate("org.bstats", "com.gmail.nossr50.metrics.bstat")
}

View File

@ -1,2 +1,2 @@
pluginGroup="com.gmail.nossr50" pluginGroup=com.gmail.nossr50
pluginVersion="2.2.0-SNAPSHOT" pluginVersion=2.2.0-SNAPSHOT

View File

@ -8,3 +8,11 @@
*/ */
rootProject.name = "mcMMO" rootProject.name = "mcMMO"
include("core", "bukkit", "sponge") include("core", "bukkit", "sponge")
pluginManagement {
repositories {
jcenter()
maven("https://repo.spongepowered.org/maven/")
gradlePluginPortal()
}
}

View File

@ -1,30 +1,30 @@
buildscript { import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
repositories {
maven("https://repo.spongepowered.org/maven")
}
}
plugins { plugins {
java java
id("org.spongepowered.plugin") version "0.9.0" id("org.spongepowered.plugin") version "0.9.0" // supplies sponge repo and plugin metadata creation tasks
id("com.github.johnrengelman.shadow")
} }
dependencies { dependencies {
compile("org.spongepowered", "spongeapi", "7.1.0") // SpongeAPI compile("org.spongepowered", "spongeapi", "7.1.0") // SpongeAPI
compile(project(":core"))
implementation("org.bstats", "bstats-sponge", "1.4") // Sponge bstats compile("org.bstats", "bstats-sponge", "1.4") // Sponge bstats
} }
description = "mcMMO for Sponge" description = "mcMMO for Sponge"
val compileJava by tasks.getting(JavaCompile::class) {
options.encoding = "UTF-8"
}
val jar by tasks.getting(Jar::class) { val jar by tasks.getting(Jar::class) {
manifest { manifest {
attributes(mapOf( attributes(mapOf(
"Implementation-Title" to project.name, "Implementation-Title" to "mcMMO",
"Implementation-Version" to project.version "Implementation-Version" to rootProject.properties["pluginVersion"]!!
)) ))
} }
} }
val shadowJar by tasks.getting(ShadowJar::class) {
dependencies {
include(project(":core"))
}
}

View File

@ -9,7 +9,8 @@ import org.spongepowered.api.plugin.Plugin;
authors = {"nossr50", "gabizou", "bloodmage"}, authors = {"nossr50", "gabizou", "bloodmage"},
version = "2.2.0-SNAPSHOT", version = "2.2.0-SNAPSHOT",
name = "mcMMO", name = "mcMMO",
url = "https://www.mcmmo.org/" url = "https://www.mcmmo.org/",
description = "mcMMO plugin for Sponge"
) )
public class SpongePlugin { public class SpongePlugin {