dependency catalog & relocations

This commit is contained in:
jmp committed 2021-05-08 05:49:16 -07:00
1 parent 407de5479e
commit 6637830e86
9 files changed
+298 -209

No files matched your search

+22 -86
View File
@@ -1,31 +1,38 @@
import net.draycia.carbon.*
import java.nio.charset.StandardCharsets
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription.Permission.Default.TRUE
plugins {
id("com.github.johnrengelman.shadow")
id("net.minecrell.plugin-yml.bukkit") version "0.4.0"
id("net.minecrell.plugin-yml.bukkit")
}
dependencies {
implementation(projects.carbonchatApi)
// Server
compileOnly("com.destroystokyo.paper:paper-api:$PAPER_API_VER")
implementation("io.papermc", "paperlib", "1.0.6")
// Config
implementation("org.spongepowered:configurate-yaml:$CONFIGURATE_VER")
implementation("org.yaml:snakeyaml:$SNAKEYAML_VER")
compileOnly(libs.paperApi)
implementation(libs.paperLib)
// Commands
implementation("cloud.commandframework:cloud-paper:$CLOUD_VER")
implementation(libs.cloudPaper)
// Misc
implementation("org.bstats:bstats-bukkit:$BSTATS_VER")
implementation(libs.bstatsBukkit)
// Plugins
compileOnly("me.clip:placeholderapi:$PLACEHOLDER_API_VER")
compileOnly("com.github.MilkBowl:VaultAPI:$VAULT_VER")
compileOnly("me.clip:placeholderapi:2.10.9")
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
}
tasks {
build {
dependsOn(shadowJar)
}
shadowJar {
archiveFileName.set(project.name + "-" + project.version + ".jar")
configureShadow()
relocateDependency("io.papermc.lib")
relocateDependency("io.leangen.geantyref")
}
}
// Generates plugin.yml automatically
@@ -40,81 +47,10 @@ bukkit {
website = rootProject.ext["github"] as String
permissions {
create("carbonchat.channels.global.see") {
//default = "TRUE"
default = TRUE
}
create("carbonchat.channels.global.use") {
//default = "TRUE"
}
}
}
/*
checkstyle {
def configRoot = new File(rootProject.projectDir, '.checkstyle')
toolVersion = vers['checkstyle']
configDirectory = configRoot
configProperties = [basedir: configRoot.getAbsolutePath()]
}
*/
// Set output directory and encoding
tasks {
withType<JavaCompile> {
options.encoding = StandardCharsets.UTF_8.name()
options.compilerArgs.addAll(listOf("-Xlint:all"))
}
}
// Automatically shadowJar when building
tasks {
build {
dependsOn(shadowJar)
}
}
// Output a single jar
tasks {
shadowJar {
minimize()
archiveFileName.set(project.name + "-" + project.version + ".jar")
doLast {
val archive = archiveFile.get().asFile
val libs = rootProject.buildDir.resolve("libs")
libs.mkdirs()
archive.copyTo(libs.resolve(archive.name), overwrite = true)
}
relocate("org.yaml", "net.draycia.carbon.libs.org.yaml")
relocate("org.spongepowered.configurate", "net.draycia.carbon.libs.configurate")
relocate("org.checkerframework", "net.draycia.carbon.libs.checkerframework")
relocate("org.reactivestreams", "net.draycia.carbon.libs.reactivestreams")
relocate("org.codehaus", "net.draycia.carbon.libs.codehaus")
relocate("io.leangen.geantyref", "net.draycia.carbon.libs.typereference")
relocate("io.lettuce", "net.draycia.carbon.libs.lettuce")
relocate("cloud.commandframework", "net.draycia.carbon.libs.cloud")
relocate("com.zaxxer.hikari", "net.draycia.carbon.libs.hikari")
relocate("com.typesafe.config", "net.draycia.carbon.libs.typesafe.config")
relocate("com.google.common", "net.draycia.carbon.libs.google.common")
relocate("reactor", "net.draycia.carbon.libs.reactor")
relocate("javax.annotation", "net.draycia.carbon.libs.javax.annotation")
}
}
//// Automatically relocate all shaded dependencies
//import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
//
//task relocateShadowJar(type: ConfigureShadowRelocation) {
// target = tasks.shadowJar
// prefix = "net.draycia.carbon.libs" // Default value is "shadow"
//}
//
//tasks.shadowJar.dependsOn tasks.relocateShadowJar
// Cleanup custom output directory on clean task
tasks {
clean {
doFirst {
delete("$rootDir/build/bundled")
default = TRUE
}
}
}