-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from avaerian/java-21
Update codebase to Java 21 + refactor build system
- Loading branch information
Showing
268 changed files
with
2,381 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
maven("https://repo.papermc.io/repository/maven-public/") | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(libs.paperweight) | ||
implementation(libs.shadow) | ||
|
||
/* | ||
compileOnly(libs.paperApi) | ||
/*project.project(":nms").subprojects.forEach { | ||
implementation(project(it.path)) | ||
}*/ | ||
constraints { | ||
val asmVersion = "[${libs.versions.minAsm.get()},)" | ||
implementation("org.ow2.asm:asm:$asmVersion") { | ||
because("Java 21 support") | ||
} | ||
implementation("org.ow2.asm:asm-commons:$asmVersion") { | ||
because("Java 21 support") | ||
} | ||
} | ||
*/ | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "build-logic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
plugins { | ||
id("com.gradleup.shadow") | ||
} | ||
|
||
/*tasks.named<ShadowJar>("shadowJar") { | ||
archiveClassifier.set("") | ||
configurations = [project.configurations.compileClasspath] | ||
exclude("module-info.class") | ||
exclude("*.properties") | ||
dependencies { | ||
include(project(":core")) | ||
include(project(":nms:v1_19_R3")) | ||
include(dependency("xyz.jpenilla:reflection-remapper")) | ||
} | ||
}*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import buildlogic.getLibrary | ||
import buildlogic.getVersion | ||
import buildlogic.libsCatalog | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
||
plugins { | ||
`java-library` | ||
id("io.papermc.paperweight.userdev") | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
maven("https://repo.papermc.io/repository/maven-public/") | ||
} | ||
|
||
configurations.all { | ||
resolutionStrategy.force("net.fabricmc:tiny-remapper:${libsCatalog.getVersion("minTinyRemapper")}") | ||
} | ||
|
||
tasks.withType<ShadowJar> { | ||
dependencies { | ||
exclude("org.ow2.asm:asm") | ||
//exclude("org.ow2.asm:asm-commons") | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core")) | ||
implementation(libsCatalog.getLibrary("reflectionRemapper")) | ||
|
||
constraints { | ||
val asmVersion = "[${libsCatalog.getVersion("minAsm")},)" | ||
implementation("org.ow2.asm:asm:$asmVersion") { | ||
because("Java 21 support") | ||
} | ||
implementation("org.ow2.asm:asm-commons:$asmVersion") { | ||
because("Java 21 support") | ||
} | ||
|
||
remapper("net.fabricmc:tiny-remapper:[${libsCatalog.getVersion("minTinyRemapper")},)") { | ||
because("Java 21 support") | ||
} | ||
} | ||
} | ||
|
||
/*tasks.named("assemble") { | ||
dependsOn("reobfJar") | ||
}*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package buildlogic | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.MinimalExternalModuleDependency | ||
import org.gradle.api.artifacts.VersionCatalog | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.api.artifacts.VersionConstraint | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
val Project.libsCatalog: VersionCatalog | ||
get() = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
||
fun VersionCatalog.getLibrary(name: String): Provider<MinimalExternalModuleDependency> = findLibrary(name).orElseThrow { | ||
error("Library $name not found in libs catalog") | ||
} | ||
|
||
fun VersionCatalog.getVersion(name: String): VersionConstraint = findVersion(name).orElseThrow { | ||
error("Library $name not found in libs catalog") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,53 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
||
plugins { | ||
id("com.github.johnrengelman.shadow") version("7.1.2") apply(false) | ||
`kotlin-dsl` | ||
`java-library` | ||
id("java") | ||
id("io.papermc.paperweight.userdev") version("1.5.4") apply(false) | ||
id("com.gradleup.shadow") version("8.3.1") | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(project(":main")) | ||
implementation(project(":v1_19_R1", "reobf")) | ||
group = rootProject.group | ||
version = rootProject.version | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) | ||
} | ||
|
||
allprojects { | ||
|
||
apply(plugin = "java") | ||
apply(plugin = "com.github.johnrengelman.shadow") | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(17)) | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
group = "org.minerift.ether" | ||
version = "1.0-SNAPSHOT" | ||
|
||
tasks.withType<ShadowJar> { | ||
archiveClassifier.set("") // SUPER IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
dependencies { | ||
include(project(":main")) | ||
include(project(":v1_19_R1")) | ||
include(dependency("xyz.jpenilla:reflection-remapper")) | ||
} | ||
} | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
|
||
// Paper-API dependency for submodules | ||
subprojects { | ||
repositories { | ||
mavenCentral() | ||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") } | ||
} | ||
// TODO: create a SourceSet "shade" for shadowJar to clarify shading? | ||
|
||
dependencies { | ||
compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT") | ||
} | ||
dependencies { | ||
implementation(project(":core")) | ||
implementation(project(":nms:v1_20_R2", "reobf")) | ||
|
||
// shade in these dependencies as well | ||
implementation(libs.reflectionRemapper) | ||
} | ||
|
||
// Once more versions are implemented, this list will grow | ||
configure(subprojects.filter { listOf("v1_19_R1").contains(it.name) }) { | ||
apply(plugin = "io.papermc.paperweight.userdev") | ||
tasks.named<ShadowJar>("shadowJar") { | ||
//archiveClassifier.set("implementation") | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
//exclude("module-info.class") | ||
exclude("*.properties") // TODO: review | ||
archiveFileName.set("${project.name}-${project.version}.jar") | ||
|
||
dependencies { | ||
implementation(project(":main")) | ||
implementation("xyz.jpenilla:reflection-remapper:0.1.1") | ||
include(project(":core")) | ||
include(project(":nms:v1_20_R2")) | ||
include(dependency("xyz.jpenilla:reflection-remapper")) | ||
} | ||
} | ||
|
||
/* | ||
compileJava.options.encoding = 'UTF-8' | ||
tasks.withType<Test> { | ||
//systemProperties = System.getProperties() | ||
systemProperties.remove("java.endorsed.dirs") | ||
tasks.withType<JavaCompile> { | ||
options.release.set(21) | ||
options.encoding = Charsets.UTF_8.name() | ||
} | ||
|
||
tasks.create("runBinaryTests", Test::class) { | ||
dependsOn("shadowJar") | ||
val FAT_JAR_FILEPATH = "$projectDir/build/libs/${project.name}-$version-all.jar" | ||
testClassesDirs += zipTree(FAT_JAR_FILEPATH) | ||
classpath = project.files(FAT_JAR_FILEPATH, configurations.runtimeClasspath) | ||
outputs.upToDateWhen { false } | ||
} | ||
task runBinaryTests(type: Test) { | ||
testClassesDirs += zipTree($projectDir/fatjar.jar) | ||
classpath = project.files( "$projectDir/fatjar.jar", configurations.runtime ) | ||
outputs.upToDateWhen { false } | ||
} | ||
*/ | ||
tasks.withType<Javadoc> { | ||
options.encoding = Charsets.UTF_8.name() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
plugins { | ||
id("com.gradleup.shadow") | ||
id("me.champeau.jmh") version("0.7.2") | ||
} | ||
|
||
//sourceSets["jmh"].compileClasspath += sourceSets["main"].runtimeClasspath | ||
//sourceSets["jmh"].runtimeClasspath += sourceSets["main"].runtimeClasspath | ||
|
||
repositories { | ||
mavenCentral() | ||
maven ("https://maven.enginehub.org/repo/") | ||
} | ||
|
||
|
||
|
||
dependencies { | ||
|
||
//implementation("org.jooq:joor-java-8:0.9.15") | ||
compileOnly(libs.paperApi) | ||
|
||
// TODO: move these to :build-logic build.gradle.kts with version constraints for better Mojang lib conflict handling | ||
// General libraries | ||
implementation(libs.guava) | ||
implementation(libs.gson) | ||
implementation(libs.fastutil) | ||
|
||
// SQL libraries | ||
implementation(libs.jooq) | ||
implementation(libs.hikariCP) | ||
|
||
implementation(libs.sql.driver.sqlite) | ||
implementation(libs.sql.driver.postgresql) | ||
implementation(libs.sql.driver.h2) | ||
implementation(libs.sql.driver.mysql) | ||
|
||
compileOnly(libs.worldeditBukkit) | ||
|
||
// Benchmarking | ||
jmhImplementation(libs.jmh.core) | ||
jmhAnnotationProcessor(libs.jmh.annprocessor) | ||
|
||
// Unit tests | ||
testImplementation(libs.junit.jupiter.api) | ||
testImplementation(libs.junit.jupiter.params) | ||
testRuntimeOnly(libs.junit.jupiter.engine) | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.