@@ -6,13 +6,13 @@ buildscript {
6
6
}
7
7
}
8
8
dependencies {
9
- classpath group : ' network.rs485' , name : ' ForgeGradle' , version : forgegradle_version
9
+ classpath group : ' network.rs485.forge ' , name : ' ForgeGradle' , version : forgegradle_version
10
10
}
11
11
}
12
12
13
13
plugins {
14
- id ' maven'
15
14
id ' java'
15
+ id ' maven-publish'
16
16
id ' org.jetbrains.kotlin.jvm' version " $kotlin_version "
17
17
id ' org.jetbrains.kotlin.plugin.serialization' version " $kotlin_version "
18
18
id ' org.jetbrains.kotlin.plugin.lombok' version " $kotlin_version "
@@ -21,16 +21,17 @@ plugins {
21
21
id ' com.matthewprenger.cursegradle' version " $cursegradle_version "
22
22
id ' com.github.johnrengelman.shadow' version " $shadow_version "
23
23
}
24
- apply plugin : ' net.minecraftforge.gradle '
24
+ apply plugin : ' network.rs485.forge '
25
25
26
26
archivesBaseName = " logisticspipes"
27
27
group = " network.rs485"
28
28
version = " 0.10.4"
29
29
ext. vendor = " unknown"
30
30
ext. target = " Forge $forge_version "
31
31
32
- sourceCompatibility = JavaVersion . VERSION_1_8
33
- targetCompatibility = JavaVersion . VERSION_1_8
32
+ java. toolchain. languageVersion = JavaLanguageVersion . of(8 )
33
+
34
+ println " Java: ${ System.getProperty 'java.version'} , JVM: ${ System.getProperty 'java.vm.version'} (${ System.getProperty 'java.vendor'} ), Arch: ${ System.getProperty 'os.arch'} "
34
35
35
36
def ENV = System . getenv()
36
37
@@ -110,6 +111,18 @@ kotlinLombok {
110
111
lombokConfigurationFile file(" lombok.config" )
111
112
}
112
113
114
+ project. afterEvaluate {
115
+ tasks. register(' copyRunClasses' , Copy . class) {
116
+ dependsOn [' classes' ]
117
+ from sourceSets. main. output. classesDirs, sourceSets. main. output. resourcesDir, sourceSets. api. output. classesDirs
118
+ into " ${ project.buildDir} /run_classes/"
119
+
120
+ includeEmptyDirs false
121
+ }
122
+
123
+ tasks[' prepareRuns' ]. dependsOn(' copyRunClasses' )
124
+ }
125
+
113
126
minecraft {
114
127
mappings channel : ' snapshot' , version : " $mappings_version "
115
128
accessTransformer = file(" $rootDir /resources/META-INF/lp_at.cfg" )
@@ -127,7 +140,22 @@ minecraft {
127
140
// load LP core mod from classpath
128
141
property ' fml.coreMods.load' , ' logisticspipes.asm.LogisticsPipesCoreLoader'
129
142
130
- jvmArg ' -ea'
143
+ jvmArgs ' -ea'
144
+ environment ' MC_VERSION' , mcversion
145
+
146
+ lazyToken ' classpathExclude' , {
147
+ def paths = [
148
+ sourceSets. main. output. classesDirs. asPath,
149
+ sourceSets. api. output. classesDirs. asPath,
150
+ sourceSets. main. output. resourcesDir. path,
151
+ sourceSets. api. output. resourcesDir. path,
152
+ ]
153
+ String . join(File . pathSeparator, paths)
154
+ }
155
+ lazyToken ' classpathInclude' , {
156
+ def paths = [" ${ project.buildDir} /run_classes/" ]
157
+ String . join(File . pathSeparator, paths)
158
+ }
131
159
132
160
mods {
133
161
logisticspipes {
@@ -148,7 +176,22 @@ minecraft {
148
176
// load LP core mod from classpath
149
177
property ' fml.coreMods.load' , ' logisticspipes.asm.LogisticsPipesCoreLoader'
150
178
151
- jvmArg ' -ea'
179
+ jvmArgs ' -ea'
180
+ environment ' MC_VERSION' , mcversion
181
+
182
+ lazyToken ' classpathExclude' , {
183
+ def paths = [
184
+ sourceSets. main. output. classesDirs. asPath,
185
+ sourceSets. api. output. classesDirs. asPath,
186
+ sourceSets. main. output. resourcesDir. path,
187
+ sourceSets. api. output. resourcesDir. path,
188
+ ]
189
+ String . join(File . pathSeparator, paths)
190
+ }
191
+ lazyToken ' classpathInclude' , {
192
+ def paths = [" ${ project.buildDir} /run_classes/" ]
193
+ String . join(File . pathSeparator, paths)
194
+ }
152
195
153
196
mods {
154
197
logisticspipes {
@@ -162,6 +205,7 @@ minecraft {
162
205
// mimic the runServer task
163
206
environment ' mainClass' , ' net.minecraft.launchwrapper.Launch'
164
207
environment ' MCP_TO_SRG' , " $buildDir /createSrgToMcp/output.srg"
208
+ environment ' MC_VERSION' , mcversion
165
209
main ' net.minecraftforge.legacydev.MainServer'
166
210
args ' --tweakClass' , ' net.minecraftforge.fml.common.launcher.FMLServerTweaker'
167
211
arg ' nogui' // without GUI
@@ -186,6 +230,7 @@ minecraft {
186
230
jar {
187
231
from sourceSets. api. output
188
232
finalizedBy ' shadowJar'
233
+ duplicatesStrategy = DuplicatesStrategy . WARN
189
234
190
235
manifest = project. manifest {
191
236
from sharedManifest
@@ -241,26 +286,19 @@ processResources {
241
286
// this will ensure that this task is redone when the versions change.
242
287
inputs. property " version" , project. version
243
288
289
+ duplicatesStrategy = DuplicatesStrategy . INCLUDE
290
+
244
291
// replace stuff in mcmod.info, nothing else
245
292
from(sourceSets. main. resources. srcDirs) {
246
293
include ' mcmod.info'
247
294
248
295
// replace version and mcversion
249
- expand ' version' : project. version
250
- }
251
-
252
- // copy everything else, thats not the mcmod.info
253
- from(sourceSets. main. resources. srcDirs) {
254
- exclude ' mcmod.info'
296
+ expand ' version' : project. version, ' mcversion' : mcversion
255
297
}
256
298
}
257
299
258
300
repositories {
259
301
mavenCentral()
260
- maven {
261
- name = ' JitPack.io'
262
- url = ' https://jitpack.io'
263
- }
264
302
maven {
265
303
url = " https://maven.removeco.de/"
266
304
}
@@ -312,10 +350,17 @@ import java.nio.file.Files
312
350
final nonMinecraftConfigurations = configurations. findAll { conf -> conf != configurations. minecraft }
313
351
if (! nonMinecraftConfigurations. empty) {
314
352
final fgextension = project. getExtensions(). findByName(" minecraft" )
315
- final mcrepo = new MinecraftUserRepo (project, ' net.minecraftforge' , ' forge' , " $forge_version " , fgextension. getAccessTransformers(), fgextension. getMappings())
353
+ final mcrepo = new MinecraftUserRepo (
354
+ /* project = */ project,
355
+ /* group = */ ' net.minecraftforge' ,
356
+ /* name = */ ' forge' ,
357
+ /* version = */ " $forge_version " ,
358
+ /* ats = */ fgextension. getAccessTransformers(). getFrom(). toList(),
359
+ /* mapping = */ fgextension. getMappings(). get(),
360
+ )
316
361
nonMinecraftConfigurations. each {
317
362
it. resolutionStrategy. dependencySubstitution {
318
- substitute module(' net.minecraftforge:forge' ) with module(mcrepo. getDependencyString())
363
+ substitute module(' net.minecraftforge:forge' ) using module(mcrepo. getDependencyString())
319
364
}
320
365
}
321
366
}
@@ -339,6 +384,7 @@ task deobfJar(type: Jar) {
339
384
from sourceSets. main. output
340
385
from sourceSets. api. output
341
386
archiveClassifier. set(' deobf' )
387
+ duplicatesStrategy = DuplicatesStrategy . WARN
342
388
343
389
manifest = project. manifest {
344
390
from sharedManifest
@@ -349,6 +395,7 @@ task apiJar(type: Jar, dependsOn: apiClasses) {
349
395
from sourceSets. api. output
350
396
from sourceSets. api. allSource
351
397
archiveClassifier. set(' api' )
398
+ duplicatesStrategy = DuplicatesStrategy . WARN
352
399
}
353
400
354
401
curseforge {
@@ -464,7 +511,8 @@ gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
464
511
}
465
512
}
466
513
467
- class DownloadTask extends DefaultTask {
514
+ abstract class DownloadTask extends DefaultTask {
515
+ @Input
468
516
String url
469
517
470
518
@OutputFile
@@ -507,12 +555,8 @@ task language(dependsOn: [languageMain, languageBook], type: Copy) {
507
555
processResources. dependsOn language
508
556
}
509
557
510
- install. repositories. mavenInstaller. pom. whenConfigured { pom ->
511
- pom. dependencies. clear()
512
- }
513
-
514
558
tasks. named(' wrapper' ) {
515
- gradleVersion = ' 6.8.3 '
559
+ gradleVersion = ' 7.5 '
516
560
distributionType = Wrapper.DistributionType . ALL
517
561
}
518
562
@@ -545,3 +589,20 @@ task integrationTests(dependsOn: ['prepareRunServerTest'], type: Exec) {
545
589
}
546
590
}
547
591
}
592
+
593
+ publishing {
594
+ publications {
595
+ mavenJava(MavenPublication ) {
596
+ artifact jar
597
+ }
598
+ }
599
+ repositories {
600
+ maven {
601
+ url " file://${ project.projectDir} /mcmodsrepo"
602
+ }
603
+ }
604
+ }
605
+
606
+ tasks. withType(JavaCompile ). configureEach {
607
+ options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
608
+ }
0 commit comments