Update build scripts

This commit is contained in:
KennyTV 2021-02-23 11:29:18 +01:00
parent 3fc2a3e395
commit 99e2297d67
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
6 changed files with 36 additions and 6 deletions

View File

@ -50,6 +50,7 @@ subprojects {
maven("https://repo.spongepowered.org/maven") maven("https://repo.spongepowered.org/maven")
maven("https://repo.viaversion.com") maven("https://repo.viaversion.com")
maven("https://repo.maven.apache.org/maven2/") maven("https://repo.maven.apache.org/maven2/")
mavenLocal()
} }
indra { indra {
@ -62,6 +63,15 @@ subprojects {
} }
mitLicense() mitLicense()
} }
publishing.repositories.maven {
name = "Via"
url = uri("https://repo.viaversion.com/")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
} }
tasks { tasks {

View File

@ -6,6 +6,8 @@ object Versions {
const val netty = "4.0.20.Final" const val netty = "4.0.20.Final"
const val gson = "2.8.6" const val gson = "2.8.6"
const val jetbrainsAnnotations = "19.0.0" const val jetbrainsAnnotations = "19.0.0"
const val log4j = "2.8.1"
const val fabricLoader = "0.4.8+build.154"
// Platforms // Platforms
const val spigot = "1.16.5-R0.1-SNAPSHOT" const val spigot = "1.16.5-R0.1-SNAPSHOT"

View File

@ -1,6 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.invoke import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.withType import org.gradle.kotlin.dsl.withType
@ -18,6 +19,11 @@ fun Project.configureShadowJar() {
getByName("build") { getByName("build") {
dependsOn(withType<ShadowJar>()) dependsOn(withType<ShadowJar>())
} }
withType<Jar> {
if (name == "jar") {
archiveClassifier.set("unshaded")
}
}
} }
} }

View File

@ -1,5 +1,5 @@
dependencies { dependencies {
implementation(project(":viabackwards-common")) implementation(project(":viabackwards-common"))
compileOnly("net.fabricmc", "fabric-loader", "0.4.8+build.154") compileOnly("net.fabricmc", "fabric-loader", Versions.fabricLoader)
compileOnly("org.apache.logging.log4j", "log4j-api", "2.8.1") compileOnly("org.apache.logging.log4j", "log4j-api", Versions.log4j)
} }

View File

@ -6,7 +6,10 @@ setupViaSubproject("bungee")
setupViaSubproject("velocity") setupViaSubproject("velocity")
setupViaSubproject("sponge") setupViaSubproject("sponge")
setupViaSubproject("fabric") setupViaSubproject("fabric")
setupViaSubproject("universal")
setupSubproject("viabackwards") {
projectDir = file("universal")
}
fun setupViaSubproject(name: String) { fun setupViaSubproject(name: String) {
setupSubproject("viabackwards-$name") { setupSubproject("viabackwards-$name") {

View File

@ -1,6 +1,10 @@
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
apply<ShadowPlugin>()
tasks { tasks {
val universalJar = register<Jar>("universalJar") { withType<ShadowJar> {
artifacts.add("archives", this)
archiveClassifier.set("") archiveClassifier.set("")
archiveFileName.set("ViaBackwards-${project.version}.jar") archiveFileName.set("ViaBackwards-${project.version}.jar")
destinationDirectory.set(rootProject.projectDir.resolve("build/libs")) destinationDirectory.set(rootProject.projectDir.resolve("build/libs"))
@ -19,6 +23,11 @@ tasks {
} }
} }
build { build {
dependsOn(universalJar) dependsOn(withType<ShadowJar>())
}
withType<Jar> {
if (name == "jar") {
archiveClassifier.set("unshaded")
}
} }
} }