diff --git a/Common/build.gradle b/Common/build.gradle index 947b7269a..aca133446 100644 --- a/Common/build.gradle +++ b/Common/build.gradle @@ -1,10 +1,6 @@ plugins { id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' - id "at.petra-k.PKSubprojPlugin" -} - -pkSubproj { - platform "common" + id "at.petra-k.pkpcpbp.PKSubprojPlugin" } minecraft { diff --git a/Common/gradle.properties b/Common/gradle.properties new file mode 100644 index 000000000..9170c91f4 --- /dev/null +++ b/Common/gradle.properties @@ -0,0 +1 @@ +platform=common diff --git a/Fabric/build.gradle b/Fabric/build.gradle index b98e98ba4..b83dda0b9 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -1,21 +1,28 @@ plugins { id 'fabric-loom' version "1.6-SNAPSHOT" - id "at.petra-k.PKSubprojPlugin" + id "at.petra-k.pkpcpbp.PKSubprojPlugin" } pkSubproj { - platform "fabric" - curseforgeJar remapJar.archiveFile + curseforgeJar = remapJar.archiveFile curseforgeDependencies([ - "paucal:0.6.0", "patchouli:1.20.1-80", "fabric-language-kotlin:1.9.4+kotlin.1.8.21", - "inline:1.20.1-1.0.1", "cloth-config:11.1.0", - "cardinal-components-api:5.2.1", "fabric-api:0.84" + "paucal:0.6.0", + "patchouli:1.20.1-80", + "fabric-language-kotlin:1.9.4+kotlin.1.8.21", + "inline:1.20.1-1.0.1", + "cloth-config:11.1.0", + "cardinal-components-api:5.2.1", + "fabric-api:0.84", ]) - modrinthJar remapJar.archiveFile + modrinthJar = remapJar.archiveFile modrinthDependencies([ - "paucal:0.6.0", "patchouli:1.20.1-80", "fabric-language-kotlin:1.9.4+kotlin.1.8.21", - "inline:1.20.1-1.0.1", "cloth-config:11.1.0", - "cardinal-components-api:5.2.1", "fabric-api:0.84" + "paucal:0.6.0", + "patchouli:1.20.1-80", + "fabric-language-kotlin:1.9.4+kotlin.1.8.21", + "inline:1.20.1-1.0.1", + "cloth-config:11.1.0", + "cardinal-components-api:5.2.1", + "fabric-api:0.84", ]) } diff --git a/Fabric/gradle.properties b/Fabric/gradle.properties index 912673b4a..d042536ad 100644 --- a/Fabric/gradle.properties +++ b/Fabric/gradle.properties @@ -1,3 +1,5 @@ +platform=fabric + fabricVersion=0.85.0+1.20.1 fabricLoaderVersion=0.14.21 fabricLanguageKotlinVersion=1.9.4+kotlin.1.8.21 diff --git a/Forge/build.gradle b/Forge/build.gradle index 8fb040db8..5bf2a9f1c 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -17,21 +17,26 @@ plugins { id "java" id "maven-publish" - id "at.petra-k.PKSubprojPlugin" + id "at.petra-k.pkpcpbp.PKSubprojPlugin" } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' pkSubproj { - platform "forge" - curseforgeJar jar.archiveFile + curseforgeJar = jar.archiveFile curseforgeDependencies([ - "paucal:0.6.0", "patchouli:1.20.1-80", "caelus:3.1.0+1.20", "inline:1.20.1-1.0.1" + "paucal:0.6.0", + "patchouli:1.20.1-80", + "caelus:3.1.0+1.20", + "inline:1.20.1-1.0.1", ]) - modrinthJar jar.archiveFile + modrinthJar = jar.archiveFile modrinthDependencies([ - "paucal:0.6.0", "patchouli:1.20.1-80", "caelus:3.1.0+1.20", "inline:1.20.1-1.0.1" + "paucal:0.6.0", + "patchouli:1.20.1-80", + "caelus:3.1.0+1.20", + "inline:1.20.1-1.0.1", ]) } diff --git a/Forge/gradle.properties b/Forge/gradle.properties index 57a5c0f48..8b3c7f47f 100644 --- a/Forge/gradle.properties +++ b/Forge/gradle.properties @@ -1,3 +1,5 @@ +platform=forge + forgeVersion=47.1.47 kotlinForForgeVersion=4.3.0 diff --git a/build.gradle b/build.gradle index 091f594d3..b0039a9be 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import at.petrak.pkpcpbp.MiscUtil + buildscript { repositories { mavenCentral() @@ -17,8 +19,9 @@ plugins { // Also it looks like property lookups don't work this early id 'fabric-loom' version '1.6-SNAPSHOT' apply false - id("at.petra-k.PKPlugin") version "0.1.0-pre-87" - id("at.petra-k.PKSubprojPlugin") version "0.1.0-pre-87" apply false + id("at.petra-k.pkpcpbp.PKPlugin") version "0.2.0-pre-104" + id("at.petra-k.pkpcpbp.PKSubprojPlugin") version "0.2.0-pre-104" apply false + id("at.petra-k.pkpcpbp.PKJson5Plugin") version "0.2.0-pre-104" apply false } repositories { @@ -26,20 +29,27 @@ repositories { } pkpcpbp { + // if something goes wrong in CI, make sure we can see the logs to figure out why + superDebugInfo = System.getenv("CI") != null + // we set the maven coordinates manually in the subprojects block + doProjectMetadata = false + setupJarMetadata = true + setupMavenMetadata = true + javaVersion = 17 modInfo { - modID(project.modID) - mcVersion(project.minecraftVersion) - modVersion(project.modVersion) + modID = project.modID + mcVersion = project.minecraftVersion + modVersion = project.modVersion } curseforgeInfo { - id 569849 - stability "beta" - token(System.getenv("CURSEFORGE_TOKEN")) + id = 569849 + stability = "beta" + token = System.getenv("CURSEFORGE_TOKEN") } modrinthInfo { - id "nTW3yKrm" - stability "beta" - token(System.getenv("MODRINTH_TOKEN")) + id = "nTW3yKrm" + stability = "beta" + token = System.getenv("MODRINTH_TOKEN") } } @@ -47,12 +57,49 @@ subprojects { apply plugin: 'java' apply plugin: 'kotlin' apply plugin: 'maven-publish' + apply plugin: 'at.petra-k.pkpcpbp.PKSubprojPlugin' + apply plugin: 'at.petra-k.pkpcpbp.PKJson5Plugin' + + group = "at.petra-k.$modID" + base.archivesName = "$modID-$platform-$minecraftVersion" + version = modVersion + + def isRelease = MiscUtil.isRelease(MiscUtil.getMostRecentPush(project)) + def buildNumber = System.getenv("BUILD_NUMBER") + if (!isRelease && buildNumber != null) { + version += "-pre-$buildNumber" + } + + pkSubproj { + platform = project.platform + // this value is only checked if we run a publish task and the commit already starts with [Release] + // so we should be fine to just leave it enabled + pkPublish = true + artifactId = base.archivesName.get() + versionDisplayName = "$platform-$minecraftVersion-$modVersion" + } + + pkJson5 { + autoProcessJson5 = true + autoProcessJson5Flattening = true + } tasks.withType(JavaCompile).configureEach { it.options.encoding = 'UTF-8' it.options.release = 17 } + compileKotlin { + kotlinOptions { + jvmTarget = "17" + } + } + compileTestKotlin { + kotlinOptions { + jvmTarget = "17" + } + } + // Disables Gradle's custom module metadata from being published to maven. The // metadata includes mapped dependencies which are not reasonably consumable by // other mod developers. @@ -85,17 +132,6 @@ allprojects { javadoc.options.addStringOption('Xdoclint:none', '-quiet') } -compileKotlin { - kotlinOptions { - jvmTarget = "17" - } -} -compileTestKotlin { - kotlinOptions { - jvmTarget = "17" - } -} - tasks.register("runAllDatagen") { dependsOn ":Forge:runXplatDatagen" dependsOn ":Forge:runForgeDatagen"