Skip to content

Commit

Permalink
chore(*): Setup initial hard fork structure
Browse files Browse the repository at this point in the history
- Update paperweight to v2 for hard fork support
- Update paperRef to latest hard fork commit
- Add new impl module and configure paperweight
- Patch build scripts
- Update gitignore
  • Loading branch information
ComputerNerd100 committed Dec 21, 2024
1 parent a9788b3 commit 8a12aac
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 43 deletions.
31 changes: 15 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
*.iml
*.ipr
*.iws
.idea/
.classpath
.project
.settings/
slimeworldmanager-test/
.DS_Store/
release.properties
libs/
.gradle/
.vscode/

**/.gradle/
.DS_Store
build/
slimeworldmanager-api
slimeworldmanager-server
run
*.hprof
paper-api-generator
**/run/

**/*.iml

impl/aspaper-server/build.gradle.kts
impl/aspaper-server/src/minecraft/
impl/paper-server/
impl/aspaper-api/build.gradle.kts
impl/paper-api/
impl/paper-api-generator/
/impl/aspaper-server/.gradle/
19 changes: 0 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +0,0 @@
plugins {
id("asp.paperweight-conventions")
id("com.gradleup.shadow") version "8.3.5" apply false
java
}

allprojects {
repositories {
mavenLocal()
mavenCentral()

maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.codemc.io/repository/nms/")
maven("https://repo.rapture.pw/repository/maven-releases/")
maven("https://repo.glaremasters.me/repository/concuncan/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion=4.0.0-SNAPSHOT
version=1.21.4-R0.1-SNAPSHOT

mcVersion=1.21.4
paperRef=bb76819589fcd1a7ccac245998ca32f63d99772a
paperRef=c45286cb08881ab4d28a16b8ef9c6a4fd0984ce8

org.gradle.caching=true
org.gradle.parallel=true
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lettuce = "6.5.1.RELEASE"
lombok = "1.18.36"
lombok-plugin = "8.11"
mongo = "5.2.1"
paperweight = "1.7.7"
paperweight = "2.0.0-SNAPSHOT"
plugin-yml-paper = "0.6.0"
shadow = "8.3.5"
slf4j = "2.0.16"
Expand Down
53 changes: 53 additions & 0 deletions impl/aspaper-api/build.gradle.kts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
--- a/paper-api/build.gradle.kts
+++ b/paper-api/build.gradle.kts
@@ -95,7 +_,7 @@
}

// Paper start
-val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
+val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("impl/paper-api-generator/generated")
idea {
module {
generatedSourceDirs.add(generatedApiPath.toFile())
@@ -105,6 +_,18 @@
main {
java {
srcDir(generatedApiPath)
+ srcDir(file("../paper-api/src/main/java"))
+ }
+ resources {
+ srcDir(file("../paper-api/src/main/resources"))
+ }
+ }
+ test {
+ java {
+ srcDir(file("../paper-api/src/test/java"))
+ }
+ resources {
+ srcDir(file("../paper-api/src/test/resources"))
}
}
}
@@ -169,7 +_,7 @@

tasks.withType<Javadoc> {
val options = options as StandardJavadocDocletOptions
- options.overview = "src/main/javadoc/overview.html"
+ options.overview = "../paper-api/src/main/javadoc/overview.html"
options.use()
options.isDocFilesSubDirs = true
options.links(
@@ -207,11 +_,11 @@
}

// workaround for https://github.com/gradle/gradle/issues/4046
- inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
+ inputs.dir("../paper-api/src/main/javadoc").withPropertyName("javadoc-sourceset")
val fsOps = services.fileSystemOperations
doLast {
fsOps.copy {
- from("src/main/javadoc") {
+ from("../paper-api/src/main/javadoc") {
include("**/doc-files/**")
}
into("build/docs/javadoc")
57 changes: 57 additions & 0 deletions impl/aspaper-server/build.gradle.kts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
--- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts
@@ -17,11 +_,20 @@

paperweight {
minecraftVersion = providers.gradleProperty("mcVersion")
- // macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java")
- // gitFilePatches = true
+
+ val fork = forks.register("aspaper") {
+ upstream.patchDir("paperServer") {
+ upstreamPath = "paper-server"
+ excludes = setOf("src/minecraft", "patches", "build.gradle.kts")
+ patchesDir = rootDirectory.dir("aspaper-server/paper-patches")
+ outputDir = rootDirectory.dir("paper-server")
+ }
+ }
+
+ activeFork = fork

paper {
- reobfMappingsPatch = layout.projectDirectory.file("../build-data/reobf-mappings-patch.tiny")
+ paperServerDir = upstreamsDirectory().map { it.dir("paper/paper-server") }
}

spigot {
@@ -104,7 +_,20 @@
}
}

-val log4jPlugins = sourceSets.create("log4jPlugins")
+sourceSets {
+ main {
+ java { srcDir("../paper-server/src/main/java") }
+ resources { srcDir("../paper-server/src/main/resources") }
+ }
+ test {
+ java { srcDir("../paper-server/src/test/java") }
+ resources { srcDir("../paper-server/src/test/resources") }
+ }
+}
+
+val log4jPlugins = sourceSets.create("log4jPlugins") {
+ java { srcDir("../paper-server/src/log4jPlugins/java") }
+}
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
extendsFrom(configurations.compileClasspath.get())
}
@@ -123,7 +_,7 @@
// Paper end - configure mockito agent that is needed in newer java versions

dependencies {
- implementation(project(":paper-api"))
+ implementation(project(":impl:aspaper-api"))
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
// Paper start
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
80 changes: 80 additions & 0 deletions impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
java
id("io.papermc.paperweight.patcher")
}

paperweight {
upstreams.paper {
ref = providers.gradleProperty("paperRef")

// Setup file patches for build scripts
patchFile {
path = "paper-api/build.gradle.kts"
outputFile = file("aspaper-api/build.gradle.kts")
patchFile = file("aspaper-api/build.gradle.kts.patch")
}
patchFile {
path = "paper-server/build.gradle.kts"
outputFile = file("aspaper-server/build.gradle.kts")
patchFile = file("aspaper-server/build.gradle.kts.patch")
}

patchDir("paperApi") {
upstreamPath = "paper-api"
excludes = setOf("build.gradle.kts")
patchesDir = file("aspaper-api/paper-patches")
outputDir = file("paper-api")
}
patchDir("paperApiGenerator") {
upstreamPath = "paper-api-generator"
patchesDir = file("aspaper-api-generator/paper-patches")
outputDir = file("paper-api-generator")
}
}
}

subprojects {
apply(plugin = "java-library")
apply(plugin = "maven-publish")

extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(JAVA_VERSION)
}
}

repositories {
mavenCentral()
maven(PAPER_MAVEN_PUBLIC_URL)
}

dependencies {
// "testRuntimeOnly"("org.junit.platform:junit-platform-launcher")
}

tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release = JAVA_VERSION
options.isFork = true
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}
tasks.withType<Test> {
testLogging {
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
events(TestLogEvent.STANDARD_OUT)
}
}
}
15 changes: 9 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ rootProject.name = "ASPaper"

include(":gradle:platform")
include(":api")
include(":core")
include(":importer")
include(":loaders")
include(":plugin")
include(":aspaper-api")
include(":aspaper-server")
//include(":core")
//include(":importer")
//include(":loaders")
//include(":plugin")
include(":impl")
include(":impl:aspaper-api")
include(":impl:aspaper-server")
//include(":aspaper-api")
//include(":aspaper-server")

0 comments on commit 8a12aac

Please sign in to comment.