ViaVersion/build.gradle.kts

101 lines
3.0 KiB
Plaintext
Raw Normal View History

2021-02-24 12:04:31 +01:00
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
2021-02-17 14:49:10 +01:00
plugins {
`java-library`
2021-02-18 12:35:54 +01:00
`maven-publish`
2021-02-17 14:49:10 +01:00
}
group = "us.myles"
2021-02-18 11:40:32 +01:00
version = "3.3.0-21w07a"
description = "Allow newer clients to join older server versions."
2021-02-17 14:49:10 +01:00
subprojects {
apply<JavaLibraryPlugin>()
apply<MavenPublishPlugin>()
2021-02-17 14:49:10 +01:00
tasks {
// Variable replacements
processResources {
filesMatching(listOf("plugin.yml", "mcmod.info", "fabric.mod.json", "bungee.yml")) {
expand("version" to project.version, "description" to project.description)
}
}
2021-02-24 12:04:31 +01:00
withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
2021-02-18 11:38:50 +01:00
withType<JavaCompile> {
2021-02-24 12:04:31 +01:00
options.encoding = Charsets.UTF_8.name()
2021-02-18 11:38:50 +01:00
options.compilerArgs.addAll(listOf("-nowarn", "-Xlint:-unchecked", "-Xlint:-deprecation"))
}
}
2021-02-17 14:49:10 +01:00
val platforms = listOf(
"bukkit",
"bungee",
"fabric",
"sponge",
"velocity"
).map { "viaversion-$it" }
if (platforms.contains(project.name)) {
configureShadowJar()
2021-02-17 14:49:10 +01:00
}
2021-02-24 12:04:31 +01:00
if (project.name == "viaversion") {
apply<ShadowPlugin>()
}
2021-02-17 14:49:10 +01:00
repositories {
2021-02-24 12:04:31 +01:00
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots")
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/")
maven("https://repo.spongepowered.org/maven")
maven("https://repo.viaversion.com")
maven("https://libraries.minecraft.net")
maven("https://repo.maven.apache.org/maven2/")
2021-02-17 14:49:10 +01:00
}
dependencies {
testImplementation("io.netty", "netty-all", Versions.netty)
testImplementation("com.google.guava", "guava", Versions.guava)
testImplementation("org.junit.jupiter", "junit-jupiter-api", Versions.jUnit)
testImplementation("org.junit.jupiter", "junit-jupiter-engine", Versions.jUnit)
2021-02-17 14:49:10 +01:00
}
2021-02-24 12:04:31 +01:00
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
2021-02-17 14:49:10 +01:00
}
2021-02-19 01:33:32 +01:00
2021-02-24 12:04:31 +01:00
publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = rootProject.group as String
artifactId = project.name
version = rootProject.version as String
if (plugins.hasPlugin(ShadowPlugin::class.java)) {
artifact(tasks["shadowJar"])
} else {
from(components["java"])
}
}
}
repositories.maven {
name = "Via"
url = uri("https://repo.viaversion.com/")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
2021-02-19 11:40:29 +01:00
}
2021-02-19 01:33:32 +01:00
}
}
2021-02-17 14:49:10 +01:00
tasks {
// root project has no useful artifacts
withType<Jar> {
onlyIf { false }
2021-02-17 14:49:10 +01:00
}
}