1+ import at.petrak.pkpcpbp.MiscUtil
2+
13buildscript {
24 repositories {
35 mavenCentral()
@@ -17,42 +19,87 @@ plugins {
1719 // Also it looks like property lookups don't work this early
1820 id ' fabric-loom' version ' 1.6-SNAPSHOT' apply false
1921
20- id(" at.petra-k.PKPlugin" ) version " 0.1.0-pre-87"
21- id(" at.petra-k.PKSubprojPlugin" ) version " 0.1.0-pre-87" apply false
22+ id(" at.petra-k.pkpcpbp.PKPlugin" ) version " 0.2.0-pre-104"
23+ id(" at.petra-k.pkpcpbp.PKSubprojPlugin" ) version " 0.2.0-pre-104" apply false
24+ id(" at.petra-k.pkpcpbp.PKJson5Plugin" ) version " 0.2.0-pre-104" apply false
2225}
2326
2427repositories {
2528 mavenCentral()
2629}
2730
2831pkpcpbp {
32+ // if something goes wrong in CI, make sure we can see the logs to figure out why
33+ superDebugInfo = System . getenv(" CI" ) != null
34+ // we set the maven coordinates manually in the subprojects block
35+ doProjectMetadata = false
36+ setupJarMetadata = true
37+ setupMavenMetadata = true
38+ javaVersion = 17
2939 modInfo {
30- modID( project. modID)
31- mcVersion( project. minecraftVersion)
32- modVersion( project. modVersion)
40+ modID = project. modID
41+ mcVersion = project. minecraftVersion
42+ modVersion = project. modVersion
3343 }
3444 curseforgeInfo {
35- id 569849
36- stability " beta"
37- token( System . getenv(" CURSEFORGE_TOKEN" ) )
45+ id = 569849
46+ stability = " beta"
47+ token = System . getenv(" CURSEFORGE_TOKEN" )
3848 }
3949 modrinthInfo {
40- id " nTW3yKrm"
41- stability " beta"
42- token( System . getenv(" MODRINTH_TOKEN" ) )
50+ id = " nTW3yKrm"
51+ stability = " beta"
52+ token = System . getenv(" MODRINTH_TOKEN" )
4353 }
4454}
4555
4656subprojects {
4757 apply plugin : ' java'
4858 apply plugin : ' kotlin'
4959 apply plugin : ' maven-publish'
60+ apply plugin : ' at.petra-k.pkpcpbp.PKSubprojPlugin'
61+ apply plugin : ' at.petra-k.pkpcpbp.PKJson5Plugin'
62+
63+ group = " at.petra-k.$modID "
64+ base. archivesName = " $modID -$platform -$minecraftVersion "
65+ version = modVersion
66+
67+ def isRelease = MiscUtil . isRelease(MiscUtil . getMostRecentPush(project))
68+ def buildNumber = System . getenv(" BUILD_NUMBER" )
69+ if (! isRelease && buildNumber != null ) {
70+ version + = " -pre-$buildNumber "
71+ }
72+
73+ pkSubproj {
74+ platform = project. platform
75+ // this value is only checked if we run a publish task and the commit already starts with [Release]
76+ // so we should be fine to just leave it enabled
77+ pkPublish = true
78+ artifactId = base. archivesName. get()
79+ versionDisplayName = " $platform -$minecraftVersion -$modVersion "
80+ }
81+
82+ pkJson5 {
83+ autoProcessJson5 = true
84+ autoProcessJson5Flattening = true
85+ }
5086
5187 tasks. withType(JavaCompile ). configureEach {
5288 it. options. encoding = ' UTF-8'
5389 it. options. release = 17
5490 }
5591
92+ compileKotlin {
93+ kotlinOptions {
94+ jvmTarget = " 17"
95+ }
96+ }
97+ compileTestKotlin {
98+ kotlinOptions {
99+ jvmTarget = " 17"
100+ }
101+ }
102+
56103 // Disables Gradle's custom module metadata from being published to maven. The
57104 // metadata includes mapped dependencies which are not reasonably consumable by
58105 // other mod developers.
@@ -85,17 +132,6 @@ allprojects {
85132 javadoc. options. addStringOption(' Xdoclint:none' , ' -quiet' )
86133}
87134
88- compileKotlin {
89- kotlinOptions {
90- jvmTarget = " 17"
91- }
92- }
93- compileTestKotlin {
94- kotlinOptions {
95- jvmTarget = " 17"
96- }
97- }
98-
99135tasks. register(" runAllDatagen" ) {
100136 dependsOn " :Forge:runXplatDatagen"
101137 dependsOn " :Forge:runForgeDatagen"
0 commit comments