1- // version: 1700970468
1+ // version: 1707682661
22/*
33 * DO NOT CHANGE THIS FILE!
44 * Also, you may replace this file at any time if there is an update available.
@@ -24,9 +24,9 @@ plugins {
2424 id ' eclipse'
2525 id ' maven-publish'
2626 id ' org.jetbrains.gradle.plugin.idea-ext' version ' 1.1.7'
27- id ' com.gtnewhorizons.retrofuturagradle' version ' 1.3.25 '
28- id ' net.darkhax.curseforgegradle' version ' 1.1.17 ' apply false
29- id ' com.modrinth.minotaur' version ' 2.8.6 ' apply false
27+ id ' com.gtnewhorizons.retrofuturagradle' version ' 1.3.33 '
28+ id ' net.darkhax.curseforgegradle' version ' 1.1.18 ' apply false
29+ id ' com.modrinth.minotaur' version ' 2.8.7 ' apply false
3030 id ' com.diffplug.spotless' version ' 6.13.0' apply false
3131 id ' com.palantir.git-version' version ' 3.0.0' apply false
3232 id ' com.github.johnrengelman.shadow' version ' 8.1.1' apply false
@@ -62,6 +62,7 @@ propertyDefaultIfUnset("generateGradleTokenClass", "")
6262propertyDefaultIfUnset(" gradleTokenModId" , " " )
6363propertyDefaultIfUnset(" gradleTokenModName" , " " )
6464propertyDefaultIfUnset(" gradleTokenVersion" , " " )
65+ propertyDefaultIfUnset(" useSrcApiPath" , false )
6566propertyDefaultIfUnset(" includeWellKnownRepositories" , true )
6667propertyDefaultIfUnset(" includeCommonDevEnvMods" , true )
6768propertyDefaultIfUnset(" noPublishedSources" , false )
@@ -72,13 +73,15 @@ propertyDefaultIfUnset("usesShadowedDependencies", false)
7273propertyDefaultIfUnset(" minimizeShadowedDependencies" , true )
7374propertyDefaultIfUnset(" relocateShadowedDependencies" , true )
7475propertyDefaultIfUnset(" separateRunDirectories" , false )
76+ propertyDefaultIfUnset(" versionDisplayFormat" , ' $MOD_NAME \u 2212 $VERSION' )
7577propertyDefaultIfUnsetWithEnvVar(" modrinthProjectId" , " " , " MODRINTH_PROJECT_ID" )
7678propertyDefaultIfUnset(" modrinthRelations" , " " )
7779propertyDefaultIfUnsetWithEnvVar(" curseForgeProjectId" , " " , " CURSEFORGE_PROJECT_ID" )
7880propertyDefaultIfUnset(" curseForgeRelations" , " " )
7981propertyDefaultIfUnsetWithEnvVar(" releaseType" , " release" , " RELEASE_TYPE" )
8082propertyDefaultIfUnset(" generateDefaultChangelog" , false )
8183propertyDefaultIfUnset(" customMavenPublishUrl" , " " )
84+ propertyDefaultIfUnset(" mavenArtifactGroup" , getDefaultArtifactGroup())
8285propertyDefaultIfUnset(" enableModernJavaSyntax" , false )
8386propertyDefaultIfUnset(" enableSpotless" , false )
8487propertyDefaultIfUnset(" enableJUnit" , false )
@@ -103,9 +106,16 @@ if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists(
103106}
104107
105108if (apiPackage) {
106- targetPackageJava = javaSourceDir + modGroupPath + ' /' + apiPackagePath
107- targetPackageScala = scalaSourceDir + modGroupPath + ' /' + apiPackagePath
108- targetPackageKotlin = kotlinSourceDir + modGroupPath + ' /' + apiPackagePath
109+ final String endApiPath = modGroupPath + ' /' + apiPackagePath
110+ if (useSrcApiPath) {
111+ targetPackageJava = ' src/api/java/' + endApiPath
112+ targetPackageScala = ' src/api/scala/' + endApiPath
113+ targetPackageKotlin = ' src/api/kotlin/' + endApiPath
114+ } else {
115+ targetPackageJava = javaSourceDir + endApiPath
116+ targetPackageScala = scalaSourceDir + endApiPath
117+ targetPackageKotlin = kotlinSourceDir + endApiPath
118+ }
109119 if (! getFile(targetPackageJava). exists() && ! getFile(targetPackageScala). exists() && ! getFile(targetPackageKotlin). exists()) {
110120 throw new GradleException (" Could not resolve \" apiPackage\" ! Could not find ${ targetPackageJava} or ${ targetPackageScala} or ${ targetPackageKotlin} " )
111121 }
@@ -220,7 +230,17 @@ if (enableSpotless.toBoolean()) {
220230 removeUnusedImports()
221231 endWithNewline()
222232 // noinspection GroovyAssignabilityCheck
223- eclipse(' 4.19' ). configFile(formatFile)
233+ eclipse(' 4.19.0' ). configFile(formatFile)
234+ }
235+ kotlin {
236+ target ' src/*/kotlin/**/*.kt'
237+
238+ toggleOffOn()
239+ ktfmt(' 0.39' )
240+
241+ trimTrailingWhitespace()
242+ indentWithSpaces(4 )
243+ endWithNewline()
224244 }
225245 scala {
226246 target ' src/*/scala/**/*.scala'
@@ -424,8 +444,11 @@ repositories {
424444 }
425445 maven {
426446 name ' GTNH Maven'
427- url ' http://jenkins.usrv.eu:8081/nexus/content/groups/public'
428- allowInsecureProtocol = true
447+ url ' https://nexus.gtnewhorizons.com/repository/public/'
448+ }
449+ maven {
450+ name ' GTCEu Maven'
451+ url ' https://maven.gtceu.com'
429452 }
430453 }
431454 if (usesMixins. toBoolean() || forceEnableMixins. toBoolean()) {
@@ -454,9 +477,25 @@ configurations {
454477 config. extendsFrom(shadowCompile)
455478 }
456479 }
480+
481+ create(" runtimeOnlyNonPublishable" ) {
482+ description = " Runtime only dependencies that are not published alongside the jar"
483+ canBeConsumed = false
484+ canBeResolved = false
485+ }
486+ create(" devOnlyNonPublishable" ) {
487+ description = " Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)"
488+ canBeConsumed = false
489+ canBeResolved = false
490+ }
491+
492+ compileOnly. extendsFrom(devOnlyNonPublishable)
493+ runtimeOnlyNonPublishable. extendsFrom(devOnlyNonPublishable)
494+ runtimeClasspath. extendsFrom(runtimeOnlyNonPublishable)
495+ testRuntimeClasspath. extendsFrom(runtimeOnlyNonPublishable)
457496}
458497
459- String mixinProviderSpec = ' zone.rong:mixinbooter:8.9 '
498+ String mixinProviderSpec = ' zone.rong:mixinbooter:9.1 '
460499dependencies {
461500 if (usesMixins. toBoolean()) {
462501 annotationProcessor ' org.ow2.asm:asm-debug-all:5.2'
@@ -474,7 +513,7 @@ dependencies {
474513 transitive = false
475514 }
476515 } else if (forceEnableMixins. toBoolean()) {
477- runtimeOnly (mixinProviderSpec)
516+ runtimeOnlyNonPublishable (mixinProviderSpec)
478517 }
479518
480519 if (enableJUnit. toBoolean()) {
@@ -484,8 +523,8 @@ dependencies {
484523 }
485524
486525 if (enableModernJavaSyntax. toBoolean()) {
487- annotationProcessor ' com.github.bsideup.jabel:jabel-javac-plugin:1.0.0 '
488- compileOnly(' com.github.bsideup.jabel:jabel-javac-plugin:1.0.0 ' ) {
526+ annotationProcessor ' com.github.bsideup.jabel:jabel-javac-plugin:1.0.1 '
527+ compileOnly(' com.github.bsideup.jabel:jabel-javac-plugin:1.0.1 ' ) {
489528 transitive = false
490529 }
491530 // workaround for https://github.com/bsideup/jabel/issues/174
@@ -494,8 +533,8 @@ dependencies {
494533 patchedMinecraft ' me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0'
495534
496535 // allow Jabel to work in tests
497- testAnnotationProcessor " com.github.bsideup.jabel:jabel-javac-plugin:1.0.0 "
498- testCompileOnly(" com.github.bsideup.jabel:jabel-javac-plugin:1.0.0 " ) {
536+ testAnnotationProcessor " com.github.bsideup.jabel:jabel-javac-plugin:1.0.1 "
537+ testCompileOnly(" com.github.bsideup.jabel:jabel-javac-plugin:1.0.1 " ) {
499538 transitive = false // We only care about the 1 annotation class
500539 }
501540 testCompileOnly " me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0"
@@ -508,9 +547,13 @@ dependencies {
508547 }
509548
510549 if (includeCommonDevEnvMods. toBoolean()) {
511- implementation ' mezz.jei:jei_1.12.2:4.16.1.302'
512- // noinspection DependencyNotationArgument
513- implementation rfg. deobf(' curse.maven:top-245211:2667280' ) // TOP 1.4.28
550+ if (! (modId. equals(' jei' ))) {
551+ implementation ' mezz.jei:jei_1.12.2:4.16.1.302'
552+ }
553+ if (! (modId. equals(' theoneprobe' ))) {
554+ // noinspection DependencyNotationArgument
555+ implementation rfg. deobf(' curse.maven:top-245211:2667280' ) // TOP 1.4.28
556+ }
514557 }
515558}
516559
@@ -522,6 +565,12 @@ pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
522565 }
523566}
524567
568+ configurations. configureEach {
569+ resolutionStrategy. dependencySubstitution {
570+ substitute module(' org.scala-lang:scala-library:2.11.1' ) using module(' org.scala-lang:scala-library:2.11.5' ) because(' To allow mixing with Java 8 targets' )
571+ }
572+ }
573+
525574if (getFile(' dependencies.gradle' ). exists()) {
526575 apply from : ' dependencies.gradle'
527576} else if (getFile(' dependencies.gradle.kts' ). exists()) {
@@ -663,6 +712,19 @@ jar {
663712 it. isDirectory() ? it : zipTree(it)
664713 }
665714 }
715+
716+ if (useSrcApiPath && apiPackage) {
717+ from sourceSets. api. output
718+ dependsOn apiClasses
719+
720+ include " ${ modGroupPath} /**"
721+ include " assets/**"
722+ include " mcmod.info"
723+ include " pack.mcmeta"
724+ if (accessTransformersFile) {
725+ include " META-INF/${ accessTransformersFile} "
726+ }
727+ }
666728}
667729
668730// Configure default run tasks
@@ -679,12 +741,21 @@ if (separateRunDirectories.toBoolean()) {
679741// Create API library jar
680742tasks. register(' apiJar' , Jar ) {
681743 archiveClassifier. set ' api'
682- from(sourceSets. main. java) {
683- include " ${ modGroupPath} /${ apiPackagePath} /**"
684- }
744+ if (useSrcApiPath) {
745+ from(sourceSets. api. java) {
746+ include " ${ modGroupPath} /${ apiPackagePath} /**"
747+ }
748+ from(sourceSets. api. output) {
749+ include " ${ modGroupPath} /${ apiPackagePath} /**"
750+ }
751+ } else {
752+ from(sourceSets. main. java) {
753+ include " ${ modGroupPath} /${ apiPackagePath} /**"
754+ }
685755
686- from(sourceSets. main. output) {
687- include " ${ modGroupPath} /${ apiPackagePath} /**"
756+ from(sourceSets. main. output) {
757+ include " ${ modGroupPath} /${ apiPackagePath} /**"
758+ }
688759 }
689760}
690761
@@ -878,7 +949,7 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
878949 def changelogFile = getChangelog()
879950 def changelogRaw = changelogFile. exists() ? changelogFile. getText(' UTF-8' ) : " "
880951
881- mainFile. displayName = " ${ modName } : ${ modVersion} "
952+ mainFile. displayName = versionDisplayFormat . replace( ' $MOD_NAME ' , modName) . replace( ' $VERSION ' , modVersion)
882953 mainFile. releaseType = getReleaseType()
883954 mainFile. changelog = changelogRaw
884955 mainFile. changelogType = ' markdown'
@@ -894,6 +965,12 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
894965 }
895966 String [] parts = dep. split(' :' )
896967 String type = parts[0 ], slug = parts[1 ]
968+ def types = [
969+ ' req' : ' requiredDependency' , ' required' : ' requiredDependency' ,
970+ ' opt' : ' optionalDependency' , ' optional' : ' optionalDependency' ,
971+ ' embed' : ' embeddedLibrary' , ' embedded' : ' embeddedLibrary' ,
972+ ' incomp' : ' incompatible' , ' fail' : ' incompatible' ]
973+ if (types. containsKey(type)) type = types[type]
897974 if (! (type in [' requiredDependency' , ' embeddedLibrary' , ' optionalDependency' , ' tool' , ' incompatible' ])) {
898975 throw new Exception (' Invalid Curseforge dependency type: ' + type)
899976 }
@@ -918,6 +995,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
918995 modrinth {
919996 token = modrinthApiKey. getOrElse(' debug_token' )
920997 projectId = modrinthProjectId
998+ versionName = versionDisplayFormat. replace(' $MOD_NAME' , modName). replace(' $VERSION' , modVersion)
921999 changelog = changelogFile. exists() ? changelogFile. getText(' UTF-8' ) : " "
9221000 versionType = getReleaseType()
9231001 versionNumber = modVersion
@@ -935,7 +1013,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
9351013 }
9361014 String [] parts = dep. split(' :' )
9371015 String [] qual = parts[0 ]. split(' -' )
938- addModrinthDep(qual[0 ], qual[1 ], parts[1 ])
1016+ addModrinthDep(qual[0 ], qual. length > 1 ? qual [1 ] : ' project ' , parts[1 ])
9391017 }
9401018 }
9411019 tasks. modrinth. dependsOn(build)
@@ -944,9 +1022,17 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
9441022
9451023def addModrinthDep (String scope , String type , String name ) {
9461024 com.modrinth.minotaur.dependencies.Dependency dep
1025+ def types = [
1026+ ' req' : ' required' ,
1027+ ' opt' : ' optional' ,
1028+ ' embed' : ' embedded' ,
1029+ ' incomp' : ' incompatible' , ' fail' : ' incompatible' ]
1030+ if (types. containsKey(scope)) scope = types[scope]
9471031 if (! (scope in [' required' , ' optional' , ' incompatible' , ' embedded' ])) {
9481032 throw new Exception (' Invalid modrinth dependency scope: ' + scope)
9491033 }
1034+ types = [' proj' : ' project' , ' ' : ' project' , ' p' : ' project' , ' ver' : ' version' , ' v' : ' version' ]
1035+ if (types. containsKey(type)) type = types[type]
9501036 switch (type) {
9511037 case ' project' :
9521038 dep = new ModDependency (name, scope)
@@ -974,8 +1060,8 @@ if (customMavenPublishUrl) {
9741060 }
9751061
9761062 // providers is not available here, use System for getting env vars
977- groupId = System . getenv(' ARTIFACT_GROUP_ID' ) ?: project. group
978- artifactId = System . getenv(' ARTIFACT_ID' ) ?: project. name
1063+ groupId = System . getenv(' ARTIFACT_GROUP_ID' ) ?: project. mavenArtifactGroup
1064+ artifactId = System . getenv(' ARTIFACT_ID' ) ?: project. modArchivesBaseName
9791065 version = System . getenv(' RELEASE_VERSION' ) ?: publishedVersion
9801066 }
9811067 }
@@ -1120,6 +1206,11 @@ tasks.register('faq') {
11201206
11211207// Helpers
11221208
1209+ def getDefaultArtifactGroup () {
1210+ def lastIndex = project. modGroup. lastIndexOf(' .' )
1211+ return lastIndex < 0 ? project. modGroup : project. modGroup. substring(0 , lastIndex)
1212+ }
1213+
11231214def getFile (String relativePath ) {
11241215 return new File (projectDir, relativePath)
11251216}
0 commit comments