mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-29 13:15:13 +01:00
Downgrade shadowJar instead of libraries
This commit is contained in:
parent
af2102f097
commit
a26894eba8
62
build.gradle
62
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 {
|
allprojects {
|
||||||
apply plugin: "java-library"
|
apply plugin: "java-library"
|
||||||
apply plugin: "com.github.johnrengelman.shadow"
|
apply plugin: "com.github.johnrengelman.shadow"
|
||||||
apply plugin: "me.modmuss50.mod-publish-plugin"
|
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
|
// 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
|
// To define which projects/source files should be included in the jar
|
||||||
configurations {
|
configurations {
|
||||||
library
|
library
|
||||||
implementation.extendsFrom(library)
|
implementation.extendsFrom(library)
|
||||||
|
|
||||||
libraryJ8
|
|
||||||
library.extendsFrom(libraryJ8)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmdg.dg(configurations.libraryJ8)
|
|
||||||
|
|
||||||
// Repositories for the ViaVersion dependencies defined below
|
// Repositories for the ViaVersion dependencies defined below
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
@ -50,7 +43,7 @@ allprojects {
|
|||||||
maven {
|
maven {
|
||||||
url = "https://repo.viaversion.com"
|
url = "https://repo.viaversion.com"
|
||||||
metadataSources {
|
metadataSources {
|
||||||
// Cursed hack to prevent Gradle checking for Java versions
|
mavenPom()
|
||||||
artifact()
|
artifact()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,14 +65,14 @@ allprojects {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly "io.netty:netty-all:4.0.20.Final"
|
compileOnly "io.netty:netty-all:4.0.20.Final"
|
||||||
|
|
||||||
libraryJ8 "com.viaversion:viaversion-common:${project.viaversion_version}"
|
library "com.viaversion:viaversion-common:${project.viaversion_version}"
|
||||||
libraryJ8 "com.viaversion:viabackwards-common:${project.viabackwards_version}"
|
library "com.viaversion:viabackwards-common:${project.viabackwards_version}"
|
||||||
libraryJ8 "com.viaversion:viarewind-common:${project.viarewind_version}"
|
library "com.viaversion:viarewind-common:${project.viarewind_version}"
|
||||||
libraryJ8 ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
|
library ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
|
||||||
exclude group: "com.google.code.gson", module: "gson"
|
exclude group: "com.google.code.gson", module: "gson"
|
||||||
}
|
}
|
||||||
libraryJ8 "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
|
library "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
|
||||||
libraryJ8 ("net.raphimc:ViaLoader:${project.vialoader_version}") {
|
library ("net.raphimc:ViaLoader:${project.vialoader_version}") {
|
||||||
exclude group: "com.google.guava"
|
exclude group: "com.google.guava"
|
||||||
exclude group: "org.slf4j"
|
exclude group: "org.slf4j"
|
||||||
}
|
}
|
||||||
@ -167,18 +160,12 @@ subprojects {
|
|||||||
enabled = false
|
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 {
|
shadowJar {
|
||||||
|
if (versionId >= 1_17_1) {
|
||||||
archiveFileName = jar.archiveFileName
|
archiveFileName = jar.archiveFileName
|
||||||
|
} else {
|
||||||
|
destinationDirectory = temporaryDir
|
||||||
|
}
|
||||||
configurations = [project.configurations.library] // Include the dependencies from the include configuration
|
configurations = [project.configurations.library] // Include the dependencies from the include configuration
|
||||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||||
|
|
||||||
@ -197,6 +184,15 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downgradeJar {
|
||||||
|
inputFile = shadowJar.archiveFile
|
||||||
|
destinationDirectory = temporaryDir
|
||||||
|
}
|
||||||
|
|
||||||
|
shadeDowngradedApi {
|
||||||
|
archiveFileName = jar.archiveFileName
|
||||||
|
}
|
||||||
|
|
||||||
publishMods {
|
publishMods {
|
||||||
file = shadowJar.archiveFile
|
file = shadowJar.archiveFile
|
||||||
type = STABLE
|
type = STABLE
|
||||||
@ -223,4 +219,8 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar.dependsOn("shadowJar")
|
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