mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-18 16:35:25 +01:00
Complete Kotlin-DSL Gradle scripting for multiple projects.
Added the shadow plugin integration with the entire project. Indvidual modules each have their designated dependencies and each will assign various dependencies based on constants now made through buildSrc. Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
This commit is contained in:
parent
196ace4b81
commit
8645ce641d
@ -1,33 +1,45 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven("https://files.minecraftforge.net/maven/")
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extras
|
// Things used by other projects
|
||||||
var core by extra { project("core") }
|
Projects.core = project("core")
|
||||||
// Bukkit/Spigot plugins
|
Projects.bukkit = project("bukkit")
|
||||||
|
Projects.sponge = project("sponge")
|
||||||
|
var core: Project by extra { project("core") }
|
||||||
val bukkit by extra { project("bukkit") }
|
val bukkit by extra { project("bukkit") }
|
||||||
val bukkit_18 by extra { bukkit.project("1_8_8") }
|
val bukkit_18 by extra { bukkit.project("1_8_8") }
|
||||||
val bukkit_112 by extra { bukkit.project("1_12") }
|
val bukkit_112 by extra { bukkit.project("1_12") }
|
||||||
val bukkit_113 by extra { bukkit.project("1_13") }
|
val bukkit_113 by extra { bukkit.project("1_13") }
|
||||||
|
|
||||||
// Sponge plugins
|
|
||||||
val sponge by extra { project("sponge") }
|
val sponge by extra { project("sponge") }
|
||||||
val sponge_7 by extra { sponge.project("api7") }
|
val sponge_7 by extra { sponge.project("api7") }
|
||||||
|
|
||||||
|
val configurate by extra { ""}
|
||||||
|
|
||||||
group = properties["pluginGroup"]!!
|
group = properties["pluginGroup"]!!
|
||||||
version = properties["pluginVersion"]!!
|
version = properties["pluginVersion"]!!
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
java
|
`maven-publish`
|
||||||
id("com.github.johnrengelman.shadow") version "4.0.4"
|
id("com.github.johnrengelman.shadow") version "4.0.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
create("childJars")
|
||||||
|
}
|
||||||
|
val childJars: Configuration by configurations
|
||||||
|
|
||||||
|
|
||||||
// Set up defaults for all projects, maven repositories, java compatibility level and compiling encoding
|
// Set up defaults for all projects, maven repositories, java compatibility level and compiling encoding
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin="java-library")
|
apply(plugin="java-library")
|
||||||
@ -36,16 +48,17 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
// World Edit
|
// World Edit
|
||||||
maven("https://maven.sk89q.com/repo")
|
maven(Repos.sk89q)
|
||||||
// bStats
|
// bStats
|
||||||
maven("https://repo.codemc.org/repository/maven-public")
|
maven(Repos.bstats)
|
||||||
|
// configurate
|
||||||
|
maven(Repos.sponge)
|
||||||
|
// spigot
|
||||||
|
maven(Repos.spigot)
|
||||||
|
maven(Repos.sonatype)
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile("org.apache.tomcat", "tomcat-jdbc", "7.0.52") // tomcat JDBC
|
|
||||||
compile("org.apache.tomcat", "tomcat-juli", "7.0.52") // tomcat juli
|
|
||||||
testCompile("junit", "junit", "4.12")
|
|
||||||
}
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
@ -53,22 +66,42 @@ allprojects {
|
|||||||
tasks.getting(JavaCompile::class) {
|
tasks.getting(JavaCompile::class) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
}
|
}
|
||||||
}
|
val shadowJar by tasks.getting(ShadowJar::class) { // Configure basics of relocation
|
||||||
|
relocate(Shadow.Origin.juli, Shadow.Target.juli)
|
||||||
val jar by tasks.getting(Jar::class) {
|
relocate(Shadow.Origin.tomcat, Shadow.Target.tomcat)
|
||||||
manifest {
|
exclude(Shadow.Exclude.ForgeGradle.dummyThing)
|
||||||
attributes(mapOf(
|
exclude(Shadow.Exclude.ForgeGradle.template)
|
||||||
"Implementation-Title" to "mcMMO",
|
|
||||||
"Implementation-Version" to rootProject.properties["pluginVersion"]!!,
|
|
||||||
"Main-Class" to "com.gmail.nossr50.mcMMO" // Main plugin class for bukkit
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val shadowJar by tasks.getting(ShadowJar::class) {
|
// Sub projects don't need to shadow their dependencies. This eliminates common ones
|
||||||
|
subprojects {
|
||||||
|
val shadowJar by tasks.getting(ShadowJar::class) {
|
||||||
dependencies {
|
dependencies {
|
||||||
include(project("core"))
|
exclude(dependency("${Deps.Groups.sponge}:${Deps.Modules.configurate_yaml}"))
|
||||||
include(dependency("org.bstats:bstats-bukkit:1.4"))
|
exclude(dependency(Shadow.Exclude.guava))
|
||||||
|
exclude(dependency(Shadow.Exclude.snakeyaml))
|
||||||
|
exclude(dependency(Shadow.Exclude.tomcat))
|
||||||
|
exclude(dependency(Shadow.Exclude.juli))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
relocate("org.bstats", "com.gmail.nossr50.metrics.bstat")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile(bukkit)
|
||||||
|
compile(sponge)
|
||||||
|
compile(bukkit_18)
|
||||||
|
compile(bukkit_112)
|
||||||
|
compile(bukkit_113)
|
||||||
|
compile(sponge_7)
|
||||||
|
}
|
||||||
|
val shadowJar by tasks.getting(ShadowJar::class) { // Root shadow relocation
|
||||||
|
|
||||||
|
relocate(Shadow.Origin.bstatsBukkit, Shadow.Target.bstatsBukkit)
|
||||||
|
|
||||||
|
baseName = "mcMMO"
|
||||||
|
classifier = "bundle"
|
||||||
|
}
|
||||||
|
val build by tasks
|
||||||
|
build.dependsOn(shadowJar)
|
||||||
|
3
buildSrc/build.gradle.kts
Normal file
3
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
188
buildSrc/src/main/java/Config.kt
Normal file
188
buildSrc/src/main/java/Config.kt
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
@file:Suppress("MayBeConstant", "unused")
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
object Plugins {
|
||||||
|
const val spongeGradleId = "${Deps.Groups.sponge}.plugin"
|
||||||
|
|
||||||
|
object FG2_3 {
|
||||||
|
const val classpath = "net.minecraftforge.gradle:ForgeGradle:${Versions.fg23}"
|
||||||
|
const val extensionName = "minecraft"
|
||||||
|
const val id = "net.minecraftforge.gradle.forge"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object Repos {
|
||||||
|
const val sk89q = "https://maven.sk89q.com/repo"
|
||||||
|
// bStats
|
||||||
|
const val bstats = "https://repo.codemc.org/repository/maven-public"
|
||||||
|
// configurate
|
||||||
|
const val sponge = "https://repo.spongepowered.org/maven/"
|
||||||
|
const val spigot = "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
|
||||||
|
const val sonatype = "https://oss.sonatype.org/content/repositories/snapshots"
|
||||||
|
const val forge = "https://files.minecraftforge.net/maven/"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Config {
|
||||||
|
|
||||||
|
object Libs {
|
||||||
|
const val configurate = "${Deps.Groups.sponge}:${Deps.Modules.configurate_yaml}:${Versions.configurate}"
|
||||||
|
const val jdbc = "${Deps.Groups.tomcat}:${Deps.Modules.jdbc}:${Versions.jdbc}"
|
||||||
|
const val juli = "${Deps.Groups.tomcat}:${Deps.Modules.juli}:${Versions.jdbc}"
|
||||||
|
const val junitDep = "${Deps.Groups.junit}:${Deps.Modules.junit}:${Versions.junit}"
|
||||||
|
|
||||||
|
object Bukkit {
|
||||||
|
object `1_8` {
|
||||||
|
const val api = "$bukkit:${Versions.bukkit18}"
|
||||||
|
const val spigotApi = "${Bukkit.spigotApi}:${Versions.bukkit18}"
|
||||||
|
const val spigot = "$${Bukkit.spigot}:${Versions.bukkit18}"
|
||||||
|
const val nms = "$craftbukkit:${Versions.bukkit18}"
|
||||||
|
// only legacy existed at this point, no core.
|
||||||
|
const val wgLegacy = "${Bukkit.wgLegacy}:${Versions.wg18}"
|
||||||
|
}
|
||||||
|
|
||||||
|
object `1_12` {
|
||||||
|
const val api = "$bukkit:${Versions.bukkit112}"
|
||||||
|
const val spigotApi = "${Bukkit.spigotApi}:${Versions.bukkit112}"
|
||||||
|
const val spigot = "$${Bukkit.spigot}:${Versions.bukkit112}"
|
||||||
|
const val nms = "$craftbukkit:${Versions.bukkit112}"
|
||||||
|
// only legacy existed at this point, no core.
|
||||||
|
const val wgLegacy = "${Bukkit.wgLegacy}:${Versions.wg112}"
|
||||||
|
}
|
||||||
|
|
||||||
|
object `1_13` {
|
||||||
|
const val api = "$bukkit:${Versions.bukkit113}"
|
||||||
|
const val spigotApi = "${Bukkit.spigotApi}:${Versions.bukkit113}"
|
||||||
|
const val spigot = "$${Bukkit.spigot}:${Versions.bukkit113}"
|
||||||
|
const val nms = "$craftbukkit:${Versions.bukkit113}"
|
||||||
|
const val wgCore = "${Bukkit.wgCore}:${Versions.wg113}"
|
||||||
|
const val wgLegacy = "${Bukkit.wgLegacy}:${Versions.wg113}"
|
||||||
|
}
|
||||||
|
|
||||||
|
const val bukkit = "${Deps.Groups.bukkit}:${Deps.Modules.bukkit}"
|
||||||
|
const val craftbukkit = "${Deps.Groups.bukkit}:${Deps.Modules.craftbukkit}"
|
||||||
|
const val wgCore = "${Deps.Groups.worldguard}:${Deps.Modules.wgCore}"
|
||||||
|
const val wgLegacy = "${Deps.Groups.worldguard}:${Deps.Modules.wgLegacy}"
|
||||||
|
const val spigotApi = "${Deps.Groups.spigot}:${Deps.Modules.spigotApi}"
|
||||||
|
const val spigot = "${Deps.Groups.spigot}:${Deps.Modules.spigot}"
|
||||||
|
const val bstats = "${Deps.Groups.bstats}:${Deps.Modules.bstatsBukit}:${Versions.bstats}"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Sponge {
|
||||||
|
object API7 { // All of these are specific to the API7 module, API8 will change
|
||||||
|
const val forgeGradleId = "net.minecraftforge.gradle.forge"
|
||||||
|
const val spongeGradleId = "${Deps.Groups.sponge}.plugin"
|
||||||
|
const val spongeGradleVersion = "0.9.0"
|
||||||
|
const val api = "${Sponge.api}:${Versions.sapi7}"
|
||||||
|
const val common = "${Sponge.common}:${Versions.spongeImpl7}"
|
||||||
|
const val forge_version = "14.23.5.2768"
|
||||||
|
const val minecraftVersion = "1.12.2-$forge_version"
|
||||||
|
const val mappings = "snapshot_20180808"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Exclude {
|
||||||
|
const val group = Deps.Groups.sponge
|
||||||
|
const val module = Deps.Modules.spongeAPI
|
||||||
|
}
|
||||||
|
|
||||||
|
const val api = "${Deps.Groups.sponge}:${Deps.Modules.spongeAPI}"
|
||||||
|
const val common = "${Deps.Groups.sponge}:${Deps.Modules.spongecommon}"
|
||||||
|
const val bstats = "${Deps.Groups.bstats}:${Deps.Modules.bstatsSponge}:${Versions.bstats}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object Deps {
|
||||||
|
object Groups {
|
||||||
|
const val nossr = "com.gmail.nossr50"
|
||||||
|
const val google = "com.google"
|
||||||
|
const val guava = "com.google.guava"
|
||||||
|
const val gson = "com.google.code.gson"
|
||||||
|
const val yaml = "org.yaml"
|
||||||
|
const val sk89q = "com.sk89q"
|
||||||
|
const val apache = "org.apache"
|
||||||
|
const val worldguard = "$sk89q.worldguard"
|
||||||
|
const val worldedit = "$sk89q.worldedit"
|
||||||
|
const val sponge = "org.spongepowered"
|
||||||
|
const val spigot = "org.spigotmc"
|
||||||
|
const val md5 = "net.md_5"
|
||||||
|
const val bukkit = "org.bukkit"
|
||||||
|
const val bstats = "org.bstats"
|
||||||
|
const val tomcat = "org.apache.tomcat"
|
||||||
|
const val junit = "junit"
|
||||||
|
const val checker = "org.checkerframework"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Modules {
|
||||||
|
const val guava = "guava"
|
||||||
|
const val gson = "gson"
|
||||||
|
const val snakeyaml = "snakeyaml"
|
||||||
|
const val wgCore = "worldguard-core"
|
||||||
|
const val wgLegacy = "worldguard-legacy"
|
||||||
|
const val bungeecordChat = "bungeecord-chat"
|
||||||
|
const val spongeAPI = "spongeapi"
|
||||||
|
const val spongecommon = "spongecommon"
|
||||||
|
const val spongeforge = "spongeforge"
|
||||||
|
const val spongevanilla = "spongevanilla"
|
||||||
|
const val bukkit = "bukkit"
|
||||||
|
const val craftbukkit = "craftbukkit"
|
||||||
|
const val bstatsBukit = "bstats-bukkit"
|
||||||
|
const val bstatsSponge = "bstats-sponge"
|
||||||
|
const val spigotApi = "spigot-api"
|
||||||
|
const val spigot = "spigot"
|
||||||
|
const val configurate = "configurate"
|
||||||
|
const val configurate_core = "${configurate}-core"
|
||||||
|
const val configurate_yaml = "${configurate}-yaml"
|
||||||
|
const val jdbc = "tomcat-jdbc"
|
||||||
|
const val juli = "tomcat-juli"
|
||||||
|
const val junit = "junit"
|
||||||
|
const val checker = "checker-qual"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object Projects {
|
||||||
|
var core: Project? = null
|
||||||
|
var bukkit: Project? = null
|
||||||
|
var sponge: Project? = null
|
||||||
|
}
|
||||||
|
|
||||||
|
object Shadow {
|
||||||
|
object Origin {
|
||||||
|
const val juli = "${Deps.Groups.apache}.juli"
|
||||||
|
const val tomcat = "${Deps.Groups.apache}.tomcat"
|
||||||
|
const val apache = "${Deps.Groups.apache}.commons.logging"
|
||||||
|
const val bstatsBukkit = "${Deps.Groups.bstats}.bukkit"
|
||||||
|
const val configurate = "ninja.leaping.configurate"
|
||||||
|
const val checker = "org.checkerframework"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Target {
|
||||||
|
const val juli = "${Deps.Groups.nossr}.database.tomcat.juli"
|
||||||
|
const val tomcat = "${Deps.Groups.nossr}.database.tomcat"
|
||||||
|
const val apache = "${Deps.Groups.nossr}.commons.logging"
|
||||||
|
const val bstatsBukkit = "${Deps.Groups.nossr}.metrics.bstat"
|
||||||
|
const val configurate = "${Deps.Groups.nossr}.${Deps.Modules.configurate}"
|
||||||
|
const val checker = "${Deps.Groups.nossr}.${Deps.Modules.configurate}.checkerframework"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Exclude {
|
||||||
|
const val tomcat = "${Deps.Groups.tomcat}:${Deps.Modules.jdbc}"
|
||||||
|
const val juli = "${Deps.Groups.apache}:${Deps.Modules.juli}"
|
||||||
|
const val guava = "${Deps.Groups.guava}:${Deps.Modules.guava}"
|
||||||
|
const val snakeyaml = "${Deps.Groups.yaml}:${Deps.Modules.snakeyaml}"
|
||||||
|
const val bukkit = Deps.Groups.bukkit
|
||||||
|
const val spigot = Deps.Groups.spigot
|
||||||
|
const val sk89q = "com.sk89q"
|
||||||
|
const val wg = "$sk89q.worldguard"
|
||||||
|
const val intake = "$sk89q.intake"
|
||||||
|
const val flyway = "com.flywaydb"
|
||||||
|
const val khelekore = "org.khelekore"
|
||||||
|
const val findbugs = "com.google.code.findbugs"
|
||||||
|
const val bstats = "${Deps.Groups.bstats}"
|
||||||
|
|
||||||
|
object ForgeGradle {
|
||||||
|
const val dummyThing = "dummyThing"
|
||||||
|
const val template = "Version.java.template"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
buildSrc/src/main/java/Versions.kt
Normal file
15
buildSrc/src/main/java/Versions.kt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
object Versions {
|
||||||
|
const val configurate = "3.6" // Latest configurate
|
||||||
|
const val bukkit18 = "1.8.8-R0.1-SNAPSHOT" // Last bukkit 1.8.8
|
||||||
|
const val bukkit112 = "1.12.2-R0.1-SNAPSHOT" // Last bukkit 1.12.2
|
||||||
|
const val bukkit113 = "1.13.2-R0.1-SNAPSHOT" // Latest bukkit
|
||||||
|
const val sapi7 = "7.1.0" // Latest SpongeAPI stable
|
||||||
|
const val spongeImpl7 = "7.1.5" // Latest SpongeCommon stable
|
||||||
|
const val jdbc = "7.0.52"
|
||||||
|
const val junit = "4.12"
|
||||||
|
const val fg23 = "2.3-SNAPSHOT" // ForgeGradle to support MC 1.12.2
|
||||||
|
const val wg18 = "6.1.2" // Bukkit/CraftBukkit/Spigot 1.8.8 supported build, works on newer, but last one to support 1.8.8
|
||||||
|
const val wg112 = "6.2" // Last WorldGuard to support 1.12
|
||||||
|
const val wg113 = "7.0.0-SNAPSHOT" // Latest WorldGuard to support 1.13.2
|
||||||
|
const val bstats = "1.4" // Supports all backwards compatible. Always relocated
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
|
import Config.Libs.Bukkit.`1_12` as Bukkit
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT") // Spigot API
|
compileOnly(Bukkit.api) // Spigot API
|
||||||
implementation("com.sk89q.worldguard", "worldguard-legacy", "6.2") // WorldGuard
|
compileOnly(Bukkit.nms)
|
||||||
|
compileOnly(Bukkit.wgLegacy) // WorldGuard
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
import Config.Libs.Bukkit.`1_13` as Bukkit
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT") // Spigot API
|
compileOnly(Bukkit.api) // Bukkit API
|
||||||
implementation("com.sk89q.worldguard", "worldguard-core", "7.0.0-SNAPSHOT") // WorldGuard
|
compileOnly(Bukkit.nms)
|
||||||
implementation("com.sk89q.worldguard", "worldguard-legacy", "7.0.0-SNAPSHOT") // NEEDED
|
compileOnly(Bukkit.wgCore) // WorldGuard
|
||||||
|
compileOnly(Bukkit.wgLegacy) // WG for Bukkit
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
import Config.Libs.Bukkit.`1_8` as Bukkit
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") // Spigot API
|
compileOnly(Bukkit.api) // Spigot API
|
||||||
implementation("com.sk89q.worldguard:worldguard-legacy:6.1.2") // Old worldguard
|
compileOnly(Bukkit.wgLegacy) // Old worldguard
|
||||||
|
compileOnly(Bukkit.nms)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.gmail.nossr50.platform.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock;
|
||||||
|
|
||||||
|
public class Testing18 {
|
||||||
|
|
||||||
|
Material material;
|
||||||
|
|
||||||
|
CraftBlock block;
|
||||||
|
|
||||||
|
}
|
@ -1,21 +1,18 @@
|
|||||||
buildscript {
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
repositories { jcenter() }
|
import Config.Libs.Bukkit as Bukkit
|
||||||
dependencies { classpath("com.github.jengelman.gradle.plugins:shadow:4.0.4") }
|
|
||||||
}
|
val bukkit: Project = Projects.bukkit!!
|
||||||
val bukkit: Project by rootProject.extra
|
val core: Project = Projects.core!!
|
||||||
val core: Project by rootProject.extra
|
|
||||||
// This configures the bukkit/spigot ecosystem repositories, so they all share the same repos
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
|
||||||
// Spigot & Bukkit
|
|
||||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
|
||||||
mavenLocal() // For nms variants
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(core) // includes junit for tests
|
compile(core) // includes junit for tests
|
||||||
compile("org.bstats", "bstats-bukkit", "1.4") // Bukkit bstats
|
implementation(Bukkit.bstats) // Bukkit bstats
|
||||||
|
}
|
||||||
|
|
||||||
|
val shadowJar by tasks.getting(ShadowJar::class) {
|
||||||
|
relocate(Shadow.Origin.bstatsBukkit, Shadow.Target.bstatsBukkit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,12 +20,35 @@ subprojects {
|
|||||||
dependencies {
|
dependencies {
|
||||||
// Provide the base bukkit plugin dependency for plugin classloading.
|
// Provide the base bukkit plugin dependency for plugin classloading.
|
||||||
// All "versioned" implementations will be properly classloaded by the bukkit parent
|
// All "versioned" implementations will be properly classloaded by the bukkit parent
|
||||||
(compile(bukkit) as ModuleDependency).apply { exclude("org.spigotmc") }
|
compileOnly(bukkit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT") // Spigot API
|
// Temporary dependencies while things are being moved.
|
||||||
|
compileOnly(Bukkit.`1_13`.spigotApi) { // Spigot API
|
||||||
|
isTransitive = true
|
||||||
|
}
|
||||||
|
compileOnly(Bukkit.`1_13`.api) { // Spigot API
|
||||||
|
isTransitive = true
|
||||||
|
|
||||||
|
}
|
||||||
|
compileOnly(Bukkit.`1_13`.wgCore) {
|
||||||
|
isTransitive = true
|
||||||
|
exclude(group = Shadow.Exclude.sk89q)
|
||||||
|
exclude(group = Shadow.Exclude.intake, module = "intake")
|
||||||
|
exclude(group = Shadow.Exclude.sk89q, module = "squirrelid")
|
||||||
|
exclude(group = Shadow.Exclude.flyway)
|
||||||
|
exclude(group = Shadow.Exclude.khelekore)
|
||||||
|
exclude(group = Shadow.Exclude.findbugs)
|
||||||
|
}
|
||||||
|
compileOnly(Bukkit.`1_13`.wgLegacy) {
|
||||||
|
isTransitive = true
|
||||||
|
exclude(group = Shadow.Exclude.bukkit)
|
||||||
|
exclude(group = Shadow.Exclude.sk89q, module = "commandbook")
|
||||||
|
exclude(group = Shadow.Exclude.bstats)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
bukkit/src/main/java/com/gmail/nossr50/BukkitBlockType.java
Normal file
12
bukkit/src/main/java/com/gmail/nossr50/BukkitBlockType.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
public class BukkitBlockType {
|
||||||
|
|
||||||
|
private Material material;
|
||||||
|
|
||||||
|
private BlockData blockData;
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,22 @@
|
|||||||
|
import Config.Libs as Libs
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
`java-library`
|
||||||
|
id("com.github.johnrengelman.shadow")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
compile(Libs.configurate) {
|
||||||
|
exclude(Deps.Groups.guava, Deps.Modules.guava)
|
||||||
|
exclude(Deps.Groups.checker, Deps.Modules.checker)
|
||||||
|
}
|
||||||
|
compile(Libs.jdbc)
|
||||||
|
compile(Libs.juli)
|
||||||
|
testCompile(Libs.junitDep)
|
||||||
|
|
||||||
|
// Spigot for in-dev dependency
|
||||||
|
compileOnly(Libs.Bukkit.`1_13`.spigotApi) {
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ pluginManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
maven("https://repo.spongepowered.org/maven/")
|
maven("https://repo.spongepowered.org/maven/")
|
||||||
|
maven("https://files.minecraftforge.net/maven/")
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,47 @@
|
|||||||
plugins {
|
import net.minecraftforge.gradle.user.UserBaseExtension
|
||||||
java
|
import Config.Libs.Sponge.API7 as API7
|
||||||
// Apply the spongegradle plugin to generate the metadata file
|
|
||||||
id("org.spongepowered.plugin") version "0.9.0" // supplies sponge repo and plugin metadata creation tasks
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
maven(Repos.forge)
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath(Plugins.FG2_3.classpath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Extension created to set up the minecraft block for ForgeGradle. This should change in FG3.
|
||||||
|
val Project.minecraft: UserBaseExtension
|
||||||
|
get() = extensions.getByName<UserBaseExtension>(Plugins.FG2_3.extensionName)
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
// Apply the spongegradle plugin to generate the metadata file
|
||||||
|
id(Config.Libs.Sponge.API7.spongeGradleId) version Config.Libs.Sponge.API7.spongeGradleVersion // supplies sponge repo and plugin metadata creation tasks
|
||||||
|
}
|
||||||
|
apply(plugin = API7.forgeGradleId)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("org.spongepowered", "spongeapi", "7.1.0") // SpongeAPI
|
compileOnly(API7.api) // SpongeAPI
|
||||||
compile("org.bstats", "bstats-sponge", "1.4") // Sponge bstats
|
}
|
||||||
|
|
||||||
|
configure<UserBaseExtension> {
|
||||||
|
version = API7.minecraftVersion
|
||||||
|
runDir = "run"
|
||||||
|
mappings = API7.mappings
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Jar> {
|
||||||
|
inputs.properties += "version" to project.version
|
||||||
|
inputs.properties += "mcversion" to project.minecraft.version
|
||||||
|
|
||||||
|
baseName = "mcmmo"
|
||||||
|
|
||||||
|
filesMatching("/mcmod.info") {
|
||||||
|
expand(mapOf(
|
||||||
|
"version" to project.version,
|
||||||
|
"mcversion" to project.minecraft.version
|
||||||
|
))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "mcMMO for Sponge"
|
|
||||||
|
3
sponge/api7/gradle.properties
Normal file
3
sponge/api7/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mod_name = "mcmmo"
|
||||||
|
mod_version = "2.2-SNAPSHOT"
|
||||||
|
mc_version = "1.12.2"
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.gmail.nossr50.sponge.api7;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import org.spongepowered.api.event.Listener;
|
||||||
|
import org.spongepowered.api.event.game.GameRegistryEvent;
|
||||||
|
import org.spongepowered.api.item.ItemType;
|
||||||
|
import org.spongepowered.api.plugin.Plugin;
|
||||||
|
|
||||||
|
@Plugin(id = "mcmmo", name = "mcMMO", description = "mcMMO for Sponge")
|
||||||
|
public class API7Plugin {
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
|
@Listener
|
||||||
|
public void onRegister(GameRegistryEvent.Register<ItemType> event) {
|
||||||
|
Item derp = new Item(); // NMS!!!
|
||||||
|
event.register((ItemType) derp); // Since sponge mixes into Item, we can cast.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,31 +1,29 @@
|
|||||||
|
import Config.Libs.Sponge as Sponge
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
val core: Project by rootProject.extra
|
val core = Projects.core!! // because it's a var and potentially null by declaration
|
||||||
val sponge: Project by rootProject.extra
|
val sponge = Projects.sponge!! // because it's a var and potentially null by declaration
|
||||||
|
|
||||||
description = "mcMMO for Sponge"
|
description = "mcMMO for Sponge"
|
||||||
|
|
||||||
repositories {
|
|
||||||
// sponge
|
|
||||||
maven("https://repo.spongepowered.org/maven")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(group="org.spongepowered", name="spongeapi", version="7.1.0") // Base version
|
compile(Sponge.bstats) // Bstats is used for all sponge versions
|
||||||
|
compileOnly(Sponge.API7.api) // Base version
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(core)
|
compile(Projects.core!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
(compile(sponge) as ModuleDependency).apply {
|
(compileOnly(sponge) as ModuleDependency).apply {
|
||||||
exclude("org.spongepowered")
|
exclude(Sponge.Exclude.group, Sponge.Exclude.module)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user