1+ import at.petrak.pkpcpbp.MiscUtil
2+
13buildscript {
24 repositories {
35 mavenCentral()
@@ -17,42 +19,88 @@ 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-103"
23+ id(" at.petra-k.pkpcpbp.PKSubprojPlugin" ) version " 0.2.0-pre-103" apply false
24+ id(" at.petra-k.pkpcpbp.PKJson5Plugin" ) version " 0.2.0-pre-103" 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+ // TODO: uncomment when gamma-delta/PKPCPBP#4 is merged
79+ // artifactId = base.archivesName
80+ // versionDisplayName = "$platform-$minecraftVersion-$modVersion"
81+ }
82+
83+ pkJson5 {
84+ autoProcessJson5 = true
85+ autoProcessJson5Flattening = true
86+ }
5087
5188 tasks. withType(JavaCompile ). configureEach {
5289 it. options. encoding = ' UTF-8'
5390 it. options. release = 17
5491 }
5592
93+ compileKotlin {
94+ kotlinOptions {
95+ jvmTarget = " 17"
96+ }
97+ }
98+ compileTestKotlin {
99+ kotlinOptions {
100+ jvmTarget = " 17"
101+ }
102+ }
103+
56104 // Disables Gradle's custom module metadata from being published to maven. The
57105 // metadata includes mapped dependencies which are not reasonably consumable by
58106 // other mod developers.
@@ -85,17 +133,6 @@ allprojects {
85133 javadoc. options. addStringOption(' Xdoclint:none' , ' -quiet' )
86134}
87135
88- compileKotlin {
89- kotlinOptions {
90- jvmTarget = " 17"
91- }
92- }
93- compileTestKotlin {
94- kotlinOptions {
95- jvmTarget = " 17"
96- }
97- }
98-
99136tasks. register(" runAllDatagen" ) {
100137 dependsOn " :Forge:runXplatDatagen"
101138 dependsOn " :Forge:runForgeDatagen"
0 commit comments