@@ -3,159 +3,78 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
3
3
4
4
plugins {
5
5
java
6
- `kotlin- dsl`
7
- `maven- publish`
8
- `always- up- to- date`
9
- alias(libs.plugins.shadow) apply false
10
- alias(libs.plugins.paperweight)
6
+ id(" io.papermc.paperweight.patcher" ) version " 2.0.0-beta.14"
11
7
}
12
8
13
- val jdkVersion = property(" jdkVersion" ).toString().toInt()
14
- kotlin.jvmToolchain(jdkVersion)
15
-
16
- repositories {
17
- mavenCentral()
18
- maven(" https://repo.papermc.io/repository/maven-public/" ) { name = " papermc"
19
- content { onlyForConfigurations(configurations.paperclip.name) }
20
- }
21
- maven(" https://repo.codemc.io/repository/maven-public/" ) { name = " codemc" }
22
- maven(" https://jitpack.io" ) { name = " jitpack" }
23
- }
24
-
25
- dependencies {
26
- remapper(libs.remapper)
27
- paperclip(libs.paperclip)
28
- decompiler(libs.decompiler)
29
- }
30
-
31
- val brandName: String by project
32
- val providerRepo: String by project
33
9
paperweight {
34
- serverProject = project(" :${brandName.lowercase()} -server" )
10
+ upstreams.paper {
11
+ ref = providers.gradleProperty(" paperCommit" )
35
12
36
- remapRepo = " https://repo.papermc.io/repository/maven-public/"
37
- decompileRepo = " https://repo.papermc.io/repository/maven-public/"
38
-
39
- usePaperUpstream(providers.gradleProperty(" paperCommit" )) {
40
- withPaperPatcher {
41
- apiPatchDir.set(projectDir.resolve(" patches/api" ))
42
- apiOutputDir.set(projectDir.resolve(" $brandName -API" ))
43
-
44
- serverPatchDir.set(projectDir.resolve(" patches/server" ))
45
- serverOutputDir.set(projectDir.resolve(" $brandName -Server" ))
13
+ patchFile {
14
+ path = " paper-server/build.gradle.kts"
15
+ outputFile = file(" plazma-server/build.gradle.kts" )
16
+ patchFile = file(" plazma-server/build.gradle.kts.patch" )
46
17
}
47
-
48
- patchTasks.register(" generatedApi" ) {
49
- isBareDirectory = true
50
- upstreamDirPath = " paper-api-generator/generated"
51
- patchDir = projectDir.resolve(" patches/generated-api" )
52
- outputDir = projectDir.resolve(" paper-api-generator/generated" )
18
+ patchFile {
19
+ path = " paper-api/build.gradle.kts"
20
+ outputFile = file(" plazma-api/build.gradle.kts" )
21
+ patchFile = file(" plazma-api/build.gradle.kts.patch" )
53
22
}
54
- }
55
- }
56
-
57
- tasks {
58
- applyPatches {
59
- dependsOn(" applyGeneratedApiPatches" )
60
- }
61
-
62
- rebuildPatches {
63
- dependsOn(" rebuildGeneratedApiPatches" )
64
- }
65
-
66
- generateDevelopmentBundle {
67
- apiCoordinates.set(" ${project.group} :${brandName.lowercase()} -api" )
68
- libraryRepositories.addAll(
69
- " https://repo1.maven.org/maven2/" ,
70
- " https://papermc.io/repo/repository/maven-public/" ,
71
- " https://repo.codemc.io/repository/maven-public/" ,
72
- " https://jitpack.io" ,
73
- )
74
- }
75
- }
76
-
77
- publishing.publications.create<MavenPublication >(" devBundle" ) {
78
- artifact(tasks.generateDevelopmentBundle) { artifactId = " dev-bundle" }
79
- }
80
-
81
- val mavenUsername: String? by project
82
- val mavenPassword: String? by project
83
- allprojects {
84
- apply (plugin = " java" )
85
- apply (plugin = " maven-publish" )
86
-
87
- java.toolchain.languageVersion.set(JavaLanguageVersion .of(jdkVersion))
88
-
89
- publishing.repositories.maven(" https://maven.pkg.github.com/$providerRepo " ) {
90
- name = " github"
91
-
92
- credentials {
93
- username = mavenUsername ? : System .getenv(" GRADLE_PROPERTY_MAVEN_USERNAME" ) ? : System .getenv(" MAVEN_USERNAME" )
94
- password = mavenPassword ? : System .getenv(" GRADLE_PROPERTY_MAVEN_PASSWORD" ) ? : System .getenv(" MAVEN_PASSWORD" )
95
- }
96
- }
97
-
98
- publishing.repositories.maven(" https://repo.codemc.io/repository/maven-snapshots/" ) {
99
- name = " codemc"
100
-
101
- credentials {
102
- username = mavenUsername ? : System .getenv(" GRADLE_PROPERTY_MAVEN_USERNAME" ) ? : System .getenv(" MAVEN_USERNAME" )
103
- password = mavenPassword ? : System .getenv(" GRADLE_PROPERTY_MAVEN_PASSWORD" ) ? : System .getenv(" MAVEN_PASSWORD" )
23
+ patchDir(" paperApi" ) {
24
+ upstreamPath = " paper-api"
25
+ excludes = setOf (" build.gradle.kts" )
26
+ patchesDir = file(" plazma-api/paper-patches" )
27
+ outputDir = file(" paper-api" )
104
28
}
105
29
}
106
30
}
107
31
108
32
subprojects {
33
+ apply (plugin = " java-library" )
34
+ apply (plugin = " maven-publish" )
35
+
109
36
repositories {
37
+ mavenLocal()
110
38
mavenCentral()
111
- maven(" https://repo.papermc.io/repository/maven-public/" ) { name = " papermc" }
112
- maven(" https://repo.codemc.io/repository/maven-public/" ) { name = " codeme" }
113
- maven(" https://jitpack.io" ) { name = " jitpack" }
39
+ maven(" https://repo.papermc.io/repository/maven-public/" )
40
+ maven(" https://jitpack.io" )
114
41
}
115
42
116
- tasks {
117
- withType<JavaCompile >().configureEach {
118
- options.encoding = Charsets .UTF_8 .name()
119
- options.release = jdkVersion
120
- }
121
-
122
- withType<Javadoc > {
123
- options.encoding = Charsets .UTF_8 .name()
124
- }
125
-
126
- withType<ProcessResources > {
127
- filteringCharset = Charsets .UTF_8 .name()
43
+ extensions.configure<JavaPluginExtension > {
44
+ toolchain {
45
+ languageVersion = JavaLanguageVersion .of(21 )
128
46
}
47
+ }
129
48
130
- withType< Test > {
131
- testLogging {
132
- showStackTraces = true
133
- exceptionFormat = TestExceptionFormat . FULL
134
- events( TestLogEvent . STANDARD_OUT )
49
+ extensions.configure< PublishingExtension > {
50
+ repositories {
51
+ maven( " https://repo.purpurmc.org/snapshots " ) {
52
+ name = " purpur "
53
+ credentials( PasswordCredentials :: class )
135
54
}
136
55
}
137
56
}
138
- }
139
-
140
- val paperRepoVal = property(" paperRepo" ).toString()
141
- val paperBranch = property(" paperBranch" ).toString()
142
- val purpurRepoVal = property(" purpurRepo" ).toString()
143
- val purpurBranch = property(" purpurBranch" ).toString()
144
- val pufferfishRepoVal = property(" pufferfishRepo" ).toString()
145
- val pufferfishBranch = property(" pufferfishBranch" ).toString()
146
- val isUsePufferfish = property(" usePufferfish" ).toString().toBoolean()
147
- alwaysUpToDate {
148
-
149
- paperRepo.set(paperRepoVal)
150
- paperRef.set(paperBranch)
151
- paperCommitName.set(" paperCommit" )
152
-
153
- purpurRepo.set(purpurRepoVal)
154
- purpurRef.set(purpurBranch)
155
- purpurCommitName.set(" purpurCommit" )
156
-
157
- pufferfishRepo.set(pufferfishRepoVal)
158
- pufferfishRef.set(pufferfishBranch)
159
- usePufferfish.set(isUsePufferfish)
160
57
58
+ tasks.withType<JavaCompile > {
59
+ options.encoding = Charsets .UTF_8 .name()
60
+ options.release = 21
61
+ options.isFork = true
62
+ }
63
+ tasks.withType<Javadoc > {
64
+ options.encoding = Charsets .UTF_8 .name()
65
+ }
66
+ tasks.withType<ProcessResources > {
67
+ filteringCharset = Charsets .UTF_8 .name()
68
+ }
69
+ tasks.withType<Test > {
70
+ testLogging {
71
+ showStackTraces = true
72
+ exceptionFormat = TestExceptionFormat .FULL
73
+ events(TestLogEvent .STANDARD_OUT )
74
+ }
75
+ }
76
+ tasks.withType<AbstractArchiveTask >().configureEach {
77
+ isPreserveFileTimestamps = false
78
+ isReproducibleFileOrder = true
79
+ }
161
80
}
0 commit comments