Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id "at.petra-k.pkpcpbp.PKSubprojPlugin"
}

minecraft {
Expand Down
73 changes: 49 additions & 24 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,55 @@
plugins {
id 'fabric-loom' version "1.9+"
id "at.petra-k.pkpcpbp.PKSubprojPlugin"
}

pkSubproj {
pkPublish = true
curseforgeJar = remapJar.archiveFile
curseforgeDependencies([
"paucal",
"patchouli",
"fabric-language-kotlin",
"inline",
"cloth-config",
"cardinal-components-api",
"fabric-api",
])
modrinthJar = remapJar.archiveFile
modrinthDependencies([
"paucal:dabyDTwJ", // 0.6.0-fabric
"patchouli:1.20.1-80-fabric",
"fabric-language-kotlin:1.13.7+kotlin.2.2.21",
"inline:1.20.1-1.2.2-fabric",
"cloth-config:11.1.106+fabric",
"cardinal-components-api:5.2.1",
"fabric-api:0.84.0+1.20.1",
])
publishMods {
// for Fabric 1.21.11 and below
file = remapJar.archiveFile
modLoaders.add("fabric")
curseforge{
requires(
"paucal",
"patchouli",
"fabric-language-kotlin",
"inline",
"cloth-config",
"cardinal-components-api",
"fabric-api",
)
}
modrinth{
requires {
slug = "paucal"
version = "dabyDTwJ" // 0.6.0 fabric ver
}
requires {
slug = "patchouli"
version = "1.20.1-80-fabric"
}

requires {
slug = "fabric-language-kotlin"
version = fabricLanguageKotlinVersion
}

requires {
slug = "inline"
version = "1.20.1-1.2.2-fabric"
}

requires {
slug = "cloth-config"
version = clothConfigVersion + "+fabric"
}
requires {
slug = "cardinal-components-api"
version = cardinalComponentsVersion
}
requires {
slug = "fabric-api"
version = fabricVersion
}
}
}

loom {
Expand Down Expand Up @@ -143,7 +168,7 @@ dependencies {
// modImplementation "maven.modrinth:phosphor:${phosphorVersion}"
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
source(project(":Common").sourceSets.main.allSource)
}
compileKotlin {
Expand Down
48 changes: 30 additions & 18 deletions Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,41 @@ buildscript {
plugins {
id "java"
id "maven-publish"

id "at.petra-k.pkpcpbp.PKSubprojPlugin"
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'

pkSubproj {
pkPublish = true
curseforgeJar = jar.archiveFile
curseforgeDependencies([
"paucal",
"patchouli",
"caelus",
"inline",
])
modrinthJar = jar.archiveFile
modrinthDependencies([
"paucal:HyBiJPtT", // 0.6.0-forge
"patchouli:1.20.1-80-forge",
"caelus:3.1.0+1.20",
"inline:1.20.1-1.2.2-forge",
])
publishMods {
file = jar.archiveFile
modLoaders.add("neoForge")
curseforge{
requires(
"paucal",
"patchouli",
"caelus",
"inline"
)
}
modrinth{
requires {
slug = "paucal"
version = "HyBiJPtT"
platform = "neoforge"
}
requires {
slug = "patchouli"
version = "1.20.1-80-forge"
}
requires {
slug = "caelus"
version = "3.1.0+1.20"
}
requires {
slug = "inline"
version = "1.20.1-1.2.2-forge"
}
}
}

repositories {
Expand Down
40 changes: 29 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
#!/usr/bin/env groovy

RELEASE_BRANCHES = ["main", "1.21"]

pipeline {
agent any
tools {
jdk "jdk-17.0.1"
jdk "jdk-21"
}
parameters {
booleanParam(
name: "PUBLISH_CURSEFORGE_AND_MODRINTH",
description: "Publish to CurseForge and modrinth",
defaultValue: false,
)
booleanParam(
name: "FORMAL_RELEASE",
description: "decides if is a formal release (without -pre)",
defaultValue: false,
)
}
environment {
discordWebhook = credentials('discordWebhook')
CURSEFORGE_TOKEN = credentials('curseforgeApiKey')
MODRINTH_TOKEN = credentials('modrinthApiKey')
FORMAL_RELEASE = "${params.FORMAL_RELEASE ? 'true' : 'false'}"
}
stages {
stage('Clean') {
Expand Down Expand Up @@ -43,31 +58,34 @@ pipeline {
stage('Publish') {
when {
allOf {
branch 'main'
expression { env.BRANCH_NAME in RELEASE_BRANCHES }
not { changeRequest() }
}
}
stages {
stage('Deploy Previews') {
steps {
echo 'Deploying previews to various places'
sh './gradlew publish publishToDiscord'
sh './gradlew publish announceDiscord'
}
}
stage('Deploy releases') {
when {
expression { params.CURSEFORGE_AND_MODRINTH}
}
steps {
echo 'Maybe deploy releases'
sh './gradlew publishCurseforge publishModrinth'
}
}
}
}}
}
}
post {
always {
archiveArtifacts 'Common/build/libs/**.jar'
archiveArtifacts 'Forge/build/libs/**.jar'
archiveArtifacts 'Fabric/build/libs/**.jar'
}
}
post {
always {
archiveArtifacts 'Common/build/libs/**.jar'
archiveArtifacts 'Neoforge/build/libs/**.jar'
archiveArtifacts 'Fabric/build/libs/**.jar'
}
}
}
81 changes: 33 additions & 48 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import at.petrak.pkpcpbp.MiscUtil

buildscript {
repositories {
mavenCentral()
Expand All @@ -19,61 +17,36 @@ plugins {
// Also it looks like property lookups don't work this early
id 'fabric-loom' version '1.9+' 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
id "me.modmuss50.mod-publish-plugin"
}

repositories {
mavenCentral()
}

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
}
curseforgeInfo {
id = 569849
stability = "beta"
token = System.getenv("CURSEFORGE_TOKEN")
}
modrinthInfo {
id = "nTW3yKrm"
stability = "beta"
token = System.getenv("MODRINTH_TOKEN")
}
}

subprojects {
subprojects {subproject->
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'at.petra-k.pkpcpbp.PKSubprojPlugin'
apply plugin: 'at.petra-k.pkpcpbp.PKJson5Plugin'

if(subproject.path != ":Common") {
apply plugin: 'me.modmuss50.mod-publish-plugin'
}
group = "at.petra-k.$modID"
base.archivesName = "$modID-$platform-$minecraftVersion"
version = modVersion

def isRelease = MiscUtil.isRelease(MiscUtil.getMostRecentPush(project))
def isRelease = project.hasProperty('isRelease') ?
project.property('isRelease').toBoolean() : false
def buildNumber = System.getenv("BUILD_NUMBER")
if (!isRelease && buildNumber != null) {
version += "-pre-$buildNumber"
}

pkSubproj {
platform = project.platform
artifactId = base.archivesName.get()
versionDisplayName = "$platform-$minecraftVersion-$modVersion"
kotlin {
jvmToolchain(17)
}

pkJson5 {
Expand All @@ -86,21 +59,10 @@ subprojects {
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.
tasks.withType(GenerateModuleMetadata) {
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

Expand All @@ -116,6 +78,29 @@ subprojects {
sourcesJar {
duplicatesStrategy 'exclude'
}

if(subproject.path != ":Common") {
publishMods {
type = BETA
changelog = ""

modrinth {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "nTW3yKrm"
minecraftVersions.add("1.21.1")
}
curseforge {
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
projectId = "569849"
minecraftVersions.add("1.21.1")
client = true
server = true
}
discord {
webhookUrl = providers.environmentVariable("discordWebhook")
}
}
}
}

allprojects {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pluginManagement {

plugins {
id "org.jetbrains.kotlin.jvm" version kotlinVersion
id "me.modmuss50.mod-publish-plugin" version "2.1.1"
}
}

Expand Down