mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-22 12:05:23 +01:00
Downgrade shadowJar instead of libraries
This commit is contained in:
parent
af2102f097
commit
a26894eba8
66
build.gradle
66
build.gradle
@ -16,32 +16,25 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "java-library"
|
||||
apply plugin: "xyz.wagyourtail.jvmdowngrader"
|
||||
|
||||
System.setProperty("jvmdg.quiet", "true")
|
||||
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: "java-library"
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
apply plugin: "me.modmuss50.mod-publish-plugin"
|
||||
apply plugin: "xyz.wagyourtail.jvmdowngrader"
|
||||
|
||||
java {
|
||||
// Minecraft 1.17+ required Java 16/17 to compile
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
|
||||
|
||||
// We define the configuration here so we can use it across all conventions and platforms
|
||||
// To define which projects/source files should be included in the jar
|
||||
configurations {
|
||||
library
|
||||
implementation.extendsFrom(library)
|
||||
|
||||
libraryJ8
|
||||
library.extendsFrom(libraryJ8)
|
||||
}
|
||||
|
||||
jvmdg.dg(configurations.libraryJ8)
|
||||
|
||||
// Repositories for the ViaVersion dependencies defined below
|
||||
repositories {
|
||||
maven {
|
||||
@ -50,7 +43,7 @@ allprojects {
|
||||
maven {
|
||||
url = "https://repo.viaversion.com"
|
||||
metadataSources {
|
||||
// Cursed hack to prevent Gradle checking for Java versions
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
@ -72,14 +65,14 @@ allprojects {
|
||||
dependencies {
|
||||
compileOnly "io.netty:netty-all:4.0.20.Final"
|
||||
|
||||
libraryJ8 "com.viaversion:viaversion-common:${project.viaversion_version}"
|
||||
libraryJ8 "com.viaversion:viabackwards-common:${project.viabackwards_version}"
|
||||
libraryJ8 "com.viaversion:viarewind-common:${project.viarewind_version}"
|
||||
libraryJ8 ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
|
||||
library "com.viaversion:viaversion-common:${project.viaversion_version}"
|
||||
library "com.viaversion:viabackwards-common:${project.viabackwards_version}"
|
||||
library "com.viaversion:viarewind-common:${project.viarewind_version}"
|
||||
library ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
|
||||
exclude group: "com.google.code.gson", module: "gson"
|
||||
}
|
||||
libraryJ8 "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
|
||||
libraryJ8 ("net.raphimc:ViaLoader:${project.vialoader_version}") {
|
||||
library "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
|
||||
library ("net.raphimc:ViaLoader:${project.vialoader_version}") {
|
||||
exclude group: "com.google.guava"
|
||||
exclude group: "org.slf4j"
|
||||
}
|
||||
@ -167,18 +160,12 @@ subprojects {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
if (versionId >= 1_17_1) {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
} else {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveFileName = jar.archiveFileName
|
||||
if (versionId >= 1_17_1) {
|
||||
archiveFileName = jar.archiveFileName
|
||||
} else {
|
||||
destinationDirectory = temporaryDir
|
||||
}
|
||||
configurations = [project.configurations.library] // Include the dependencies from the include configuration
|
||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||
|
||||
@ -197,6 +184,15 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
downgradeJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
destinationDirectory = temporaryDir
|
||||
}
|
||||
|
||||
shadeDowngradedApi {
|
||||
archiveFileName = jar.archiveFileName
|
||||
}
|
||||
|
||||
publishMods {
|
||||
file = shadowJar.archiveFile
|
||||
type = STABLE
|
||||
@ -223,4 +219,8 @@ subprojects {
|
||||
}
|
||||
|
||||
jar.dependsOn("shadowJar")
|
||||
}
|
||||
if (versionId < 1_17_1) {
|
||||
// Downgrade the jar to Java 8 for Minecraft 1.16.5 and below
|
||||
jar.dependsOn("shadeDowngradedApi")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user