Skip to content

Commit 3c6d8b0

Browse files
committed
paperweight v2
1 parent 6408556 commit 3c6d8b0

File tree

102 files changed

+3450
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3450
-79
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ ij_kotlin_field_annotation_wrap = split_into_lines
8383
ij_kotlin_finally_on_new_line = false
8484
ij_kotlin_if_rparen_on_new_line = true
8585
ij_kotlin_import_nested_classes = false
86+
87+
[*.patch]
88+
trim_trailing_whitespace=false
89+
90+
[*.patch]
91+
trim_trailing_whitespace=false

.github/workflows/deploy-snapshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Deploy Snapshot
22
on:
33
push:
4-
branches: [ 'main' ]
4+
branches: [ 'main', 'softspoon-v2' ]
55
paths-ignore:
66
- 'license/*'
77
- 'readme.md'
@@ -29,7 +29,7 @@ jobs:
2929
echo version=$project_version >> $GITHUB_OUTPUT
3030
- name: Deploy snapshot version
3131
if: endsWith(steps.get_version.outputs.version, '-SNAPSHOT')
32-
run: ./gradlew -Dorg.gradle.parallel=true publish --no-daemon --stacktrace
32+
run: ./gradlew -Dorg.gradle.parallel=true publish --no-daemon --stacktrace -Dorg.gradle.internal.http.socketTimeout=90000 -Dorg.gradle.internal.http.connectionTimeout=90000
3333
env:
3434
ORG_GRADLE_PROJECT_paperUsername: ${{ secrets.DEPLOY_USER }}
3535
ORG_GRADLE_PROJECT_paperPassword: ${{ secrets.DEPLOY_PASS }}

.github/workflows/test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,14 @@ jobs:
1919
- name: Setup Gradle
2020
uses: gradle/gradle-build-action@v2
2121
- name: Execute Gradle build
22-
run: ./gradlew build --no-daemon --stacktrace
22+
run: |
23+
git config --global user.email "[email protected]"
24+
git config --global user.name "GitHub Actions"
25+
./gradlew build --no-daemon --stacktrace
26+
- name: Publish Test Report
27+
uses: mikepenz/action-junit-report@v4
28+
if: always()
29+
with:
30+
report_paths: '**/build/test-results/test/TEST-*.xml'
31+
detailed_summary: true
32+
annotate_notice: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ ehthumbs_vista.db
4343

4444
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
4545
!gradle-wrapper.ja
46+
47+
/test/
48+
/testpaper/
49+
/testfork/
50+
/testhistory/

buildSrc/src/main/kotlin/config-kotlin.gradle.kts

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import com.diffplug.gradle.spotless.SpotlessExtension
22
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension
3+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
4+
import org.gradle.api.tasks.testing.logging.TestLogEvent
35

46
plugins {
57
idea
@@ -11,7 +13,7 @@ java {
1113
}
1214

1315
tasks.withType(JavaCompile::class).configureEach {
14-
options.release = 11
16+
options.release = 17
1517
}
1618

1719
kotlin {
@@ -21,14 +23,15 @@ kotlin {
2123
target {
2224
compilations.configureEach {
2325
kotlinOptions {
24-
jvmTarget = "11"
25-
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xjdk-release=11")
26+
jvmTarget = "17"
27+
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xjdk-release=17", "-opt-in=kotlin.io.path.ExperimentalPathApi")
2628
}
2729
}
2830
}
2931
}
3032

3133
repositories {
34+
mavenLocal() // TODO remove again
3235
maven("https://repo.papermc.io/repository/maven-snapshots/") {
3336
mavenContent {
3437
includeModule("org.cadixdev", "mercury")
@@ -38,6 +41,28 @@ repositories {
3841
mavenContent {
3942
includeGroup("codechicken")
4043
includeGroup("net.fabricmc")
44+
includeGroupAndSubgroups("io.papermc")
45+
}
46+
}
47+
maven("https://maven.parchmentmc.org") {
48+
name = "ParchmentMC"
49+
mavenContent {
50+
releasesOnly()
51+
includeGroupAndSubgroups("org.parchmentmc")
52+
}
53+
}
54+
maven("https://maven.neoforged.net/releases") {
55+
name = "NeoForged"
56+
mavenContent {
57+
releasesOnly()
58+
includeGroupAndSubgroups("net.neoforged")
59+
}
60+
}
61+
maven("https://maven.fabricmc.net") {
62+
name = "FabricMC"
63+
mavenContent {
64+
releasesOnly()
65+
includeGroupAndSubgroups("net.fabricmc")
4166
}
4267
}
4368
mavenCentral()
@@ -55,6 +80,16 @@ testing {
5580
useKotlinTest(embeddedKotlinVersion)
5681
dependencies {
5782
implementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
83+
implementation("org.junit.platform:junit-platform-launcher:1.10.1")
84+
}
85+
86+
targets.configureEach {
87+
testTask {
88+
testLogging {
89+
events(TestLogEvent.FAILED)
90+
exceptionFormat = TestExceptionFormat.FULL
91+
}
92+
}
5893
}
5994
}
6095
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group = io.papermc.paperweight
2-
version = 1.7.5-SNAPSHOT
2+
version = 2.0.0-SNAPSHOT
33

44
org.gradle.caching = true
55
org.gradle.parallel = true

gradle/libs.versions.toml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
[versions]
2-
asm = "9.7"
2+
asm = "9.7.1"
33
lorenz = "0.5.8"
4-
hypo = "1.2.4"
4+
hypo = "2.3.0"
5+
serialize = "1.5.1"
6+
feather = "1.1.0"
57

68
[libraries]
79
asm-core = { module = "org.ow2.asm:asm", version.ref = "asm" }
810
asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "asm" }
911

1012
httpclient = "org.apache.httpcomponents:httpclient:4.5.14"
1113
kotson = "com.github.salomonbrys.kotson:kotson:2.5.0"
14+
coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2"
15+
jgit = "org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r"
1216
gson = "com.google.code.gson:gson:2.10.1"
1317

1418
cadix-lorenz-core = { module = "org.cadixdev:lorenz", version.ref = "lorenz" }
1519
cadix-lorenz-asm = { module = "org.cadixdev:lorenz-asm", version.ref = "lorenz" }
1620
cadix-lorenz-proguard = { module = "org.cadixdev:lorenz-io-proguard", version.ref = "lorenz" }
1721
cadix-atlas = "org.cadixdev:atlas:0.2.1"
1822
cadix-at = "org.cadixdev:at:0.1.0-rc1"
23+
#cadix-mercury = "org.cadixdev:mercury:0.1.2-paperweight-local-SNAPSHOT" # todo local mods for patch remapping
1924
cadix-mercury = "org.cadixdev:mercury:0.1.2-paperweight-SNAPSHOT"
25+
cadix-bombe-jar = "org.cadixdev:bombe-jar:0.4.4"
2026

2127
hypo-model = { module = "dev.denwav.hypo:hypo-model", version.ref = "hypo" }
2228
hypo-core = { module = "dev.denwav.hypo:hypo-core", version.ref = "hypo" }
@@ -29,18 +35,29 @@ slf4j-jdk14 = "org.slf4j:slf4j-jdk14:1.7.32"
2935
lorenzTiny = "net.fabricmc:lorenz-tiny:3.0.0"
3036
jbsdiff = "io.sigpipe:jbsdiff:1.0"
3137

32-
diffpatch = "codechicken:DiffPatch:1.5.0.29"
38+
feather-core = { module = "org.parchmentmc:feather", version.ref = "feather" }
39+
feather-gson = { module = "org.parchmentmc.feather:io-gson", version.ref = "feather" }
40+
41+
diffpatch = "codechicken:DiffPatch:1.5.0.30"
42+
43+
serialize-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialize" }
44+
serialize-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialize" }
45+
46+
restamp = "io.papermc.restamp:restamp:1.1.1-SNAPSHOT"
47+
48+
# test
49+
mockk = "io.mockk:mockk:1.13.8"
3350

3451
# Gradle
3552
gradle-licenser = "net.kyori:indra-licenser-spotless:3.1.3"
3653
gradle-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.23.1"
3754
gradle-shadow = "com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1"
38-
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.3.0"
55+
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.5.0"
3956
gradle-plugin-kotlin = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin" }
4057
gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:1.2.1"
4158

4259
[bundles]
4360
asm = ["asm-core", "asm-tree"]
44-
cadix = ["cadix-lorenz-core", "cadix-lorenz-asm", "cadix-lorenz-proguard", "cadix-atlas", "cadix-at", "cadix-mercury"]
61+
cadix = ["cadix-lorenz-core", "cadix-lorenz-asm", "cadix-lorenz-proguard", "cadix-atlas", "cadix-at", "cadix-mercury", "cadix-bombe-jar"]
4562
hypo = ["hypo-model", "hypo-core", "hypo-hydrate", "hypo-asm-core", "hypo-asm-hydrate", "hypo-mappings"]
4663
kotson = ["kotson", "gson"]

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

paperweight-core/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ dependencies {
77
shade(projects.paperweightLib)
88

99
implementation(libs.bundles.kotson)
10+
implementation(libs.coroutines)
1011
}
1112

1213
gradlePlugin {

paperweight-core/src/main/kotlin/io/papermc/paperweight/core/PaperweightCore.kt

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package io.papermc.paperweight.core
2525
import io.papermc.paperweight.DownloadService
2626
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
2727
import io.papermc.paperweight.core.taskcontainers.AllTasks
28+
import io.papermc.paperweight.core.taskcontainers.SoftSpoonTasks
2829
import io.papermc.paperweight.core.tasks.PaperweightCorePrepareForDownstream
2930
import io.papermc.paperweight.taskcontainers.BundlerJarTasks
3031
import io.papermc.paperweight.taskcontainers.DevBundleTasks
@@ -53,7 +54,9 @@ class PaperweightCore : Plugin<Project> {
5354

5455
val ext = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightCoreExtension::class, target)
5556

56-
target.gradle.sharedServices.registerIfAbsent(DOWNLOAD_SERVICE_NAME, DownloadService::class) {}
57+
target.gradle.sharedServices.registerIfAbsent(DOWNLOAD_SERVICE_NAME, DownloadService::class) {
58+
parameters.projectPath.set(target.projectDir)
59+
}
5760

5861
target.tasks.register<Delete>("cleanCache") {
5962
group = "paper"
@@ -69,6 +72,7 @@ class PaperweightCore : Plugin<Project> {
6972
target.configurations.create(REMAPPER_CONFIG)
7073
target.configurations.create(DECOMPILER_CONFIG)
7174
target.configurations.create(PAPERCLIP_CONFIG)
75+
target.configurations.create(MACHE_CONFIG)
7276

7377
if (target.providers.gradleProperty("paperweight.dev").orNull == "true") {
7478
target.tasks.register<CreateDiffOutput>("diff") {
@@ -90,10 +94,12 @@ class PaperweightCore : Plugin<Project> {
9094
ext.mainClass
9195
)
9296

97+
val softSpoonTasks = SoftSpoonTasks(target, tasks)
98+
9399
target.createPatchRemapTask(tasks)
94100

95101
target.tasks.register<PaperweightCorePrepareForDownstream>(PAPERWEIGHT_PREPARE_DOWNSTREAM) {
96-
dependsOn(tasks.applyPatches)
102+
dependsOn(tasks.applyPatchesLegacy)
97103
vanillaJar.set(tasks.downloadServerJar.flatMap { it.outputJar })
98104
remappedJar.set(tasks.lineMapJar.flatMap { it.outputJar })
99105
decompiledJar.set(tasks.decompileJar.flatMap { it.outputJar })
@@ -124,21 +130,35 @@ class PaperweightCore : Plugin<Project> {
124130
}
125131

126132
target.afterEvaluate {
133+
println("SoftSpoon: ${ext.softSpoon.get()}")
134+
127135
target.repositories {
128-
maven(ext.paramMappingsRepo) {
129-
name = PARAM_MAPPINGS_REPO_NAME
130-
content { onlyForConfigurations(PARAM_MAPPINGS_CONFIG) }
131-
}
132-
maven(ext.remapRepo) {
133-
name = REMAPPER_REPO_NAME
134-
content { onlyForConfigurations(REMAPPER_CONFIG) }
135-
}
136-
maven(ext.decompileRepo) {
137-
name = DECOMPILER_REPO_NAME
138-
content { onlyForConfigurations(DECOMPILER_CONFIG) }
136+
if (!ext.softSpoon.get()) {
137+
maven(ext.paramMappingsRepo) {
138+
name = PARAM_MAPPINGS_REPO_NAME
139+
content { onlyForConfigurations(PARAM_MAPPINGS_CONFIG) }
140+
}
141+
maven(ext.remapRepo) {
142+
name = REMAPPER_REPO_NAME
143+
content { onlyForConfigurations(REMAPPER_CONFIG) }
144+
}
145+
maven(ext.decompileRepo) {
146+
name = DECOMPILER_REPO_NAME
147+
content { onlyForConfigurations(DECOMPILER_CONFIG) }
148+
}
149+
} else {
150+
maven(ext.macheRepo) {
151+
name = MACHE_REPO_NAME
152+
content { onlyForConfigurations(MACHE_CONFIG) }
153+
}
139154
}
140155
}
141156

157+
if (ext.softSpoon.get()) {
158+
softSpoonTasks.afterEvaluate()
159+
return@afterEvaluate
160+
}
161+
142162
// Setup the server jar
143163
val cache = target.layout.cache
144164

0 commit comments

Comments
 (0)