Skip to content

Commit

Permalink
New build and publishing configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hypherionmc committed Mar 15, 2023
1 parent 62622f5 commit 66ce203
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 127 deletions.
50 changes: 0 additions & 50 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
id 'idea'
id "com.modrinth.minotaur" version "2.+"
id "me.hypherionmc.cursegradle" version "2.0.1"
}

archivesBaseName = "${mod_name}-fabric-${minecraft_version}"
Expand Down Expand Up @@ -87,51 +85,3 @@ publishing {

build.finalizedBy delDevJar
}

modrinth {
debugMode = false
token = System.getenv("MODRINTH_TOKEN")
projectId = "nOiHJ1dx"
versionNumber = "${minecraft_version}-${version}f"
versionType = "release"
changelog = rootProject.file("changelog-fabric.md").text.trim()
uploadFile = remapJar
versionName = "[Fabric/Quilt ${minecraft_version}.x] MoreCreativeTabs - ${project.version}"
gameVersions = ["1.19", "1.19.1", "1.19.2"]
loaders = [ "fabric", "quilt" ]
dependencies {
required.project "P7dR8mSH"
}
}

curseforge {
if (System.getenv("CURSE_TOKEN") !== null) {
apiKey = System.getenv("CURSE_TOKEN")
} else {
apiKey = ""
}
project {
id = "581838"
releaseType = "release"
addGameVersion "1.19"
addGameVersion "1.19.1"
addGameVersion "1.19.2"
addGameVersion "Fabric"
addGameVersion "Quilt"
addGameVersion "Java 17"
changelogType = "markdown"
changelog = rootProject.file("changelog-fabric.md")
mainArtifact(remapJar) {
displayName = "[Fabric/Quilt ${minecraft_version}.x] MoreCreativeTabs - ${project.version}"
}
}
options {
forgeGradleIntegration = false
debug = false
fabricIntegration = false
}
}

afterEvaluate {
tasks.curseforge581838.dependsOn remapJar
}
2 changes: 1 addition & 1 deletion Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"depends": {
"fabricloader": ">=0.14",
"fabric": "*",
"minecraft": "1.19.3",
"minecraft": ">=1.19.3",
"java": ">=17"
}
}
49 changes: 0 additions & 49 deletions Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ buildscript {
}
}

plugins {
id "com.modrinth.minotaur" version "2.+"
id "me.hypherionmc.cursegradle" version "2.0.1"
}

apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
Expand Down Expand Up @@ -123,47 +118,3 @@ publishing {
}
}
}

modrinth {
debugMode = false
token = System.getenv("MODRINTH_TOKEN")
projectId = "nOiHJ1dx"
versionNumber = "${minecraft_version}-${version}"
versionType = "release"
changelog = rootProject.file("changelog-forge.md").text.trim()
uploadFile = jar
versionName = "[FORGE ${minecraft_version}.x] MoreCreativeTabs - ${project.version}"
gameVersions = ["1.19", "1.19.1", "1.19.2"]
loaders = [ "forge" ]
}

curseforge {
if (System.getenv("CURSE_TOKEN") !== null) {
apiKey = System.getenv("CURSE_TOKEN")
} else {
apiKey = ""
}
project {
id = "581838"
releaseType = "release"
addGameVersion "1.19"
addGameVersion "1.19.1"
addGameVersion "1.19.2"
addGameVersion "Forge"
addGameVersion "Java 17"
changelogType = "markdown"
changelog = rootProject.file("changelog-forge.md")
mainArtifact(jar) {
displayName = "[FORGE ${minecraft_version}.x] MoreCreativeTabs - ${project.version}"
}
}
options {
forgeGradleIntegration = false
debug = false
fabricIntegration = false
}
}

afterEvaluate {
tasks.curseforge581838.dependsOn reobfJar
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
import net.minecraft.world.item.CreativeModeTab;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static net.minecraft.world.item.CreativeModeTabs.*;
import static net.minecraft.world.item.CreativeModeTabs.INVENTORY;

/**
* @author HypherionSA
Expand All @@ -28,7 +29,7 @@ public class MoreCreativeTabs {
private static boolean hasRun = false;

public MoreCreativeTabs() {

ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> "", (a, b) -> true));
}

public static void reloadResources() {
Expand Down
5 changes: 2 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ pipeline {
}
stage("Prepare") {
steps {
sh "wget -O changelog-forge.md https://raw.githubusercontent.com/hypherionmc/changelogs/main/mct/changelog-forge.md"
sh "wget -O changelog-fabric.md https://raw.githubusercontent.com/hypherionmc/changelogs/main/mct/changelog-fabric.md"
sh "wget -O changelog-forge.md https://raw.githubusercontent.com/hypherionmc/changelogs/main/mct/changelog.md"
sh "chmod +x ./gradlew"
sh "./gradlew clean"
}
}
stage("Publish") {
steps {
sh "./gradlew modrinth curseforge -Prelease=true"
sh "./gradlew build mergeJars publishMod -Prelease=true"
}
}
}
Expand Down
71 changes: 51 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
subprojects {
apply plugin: 'java'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
plugins {
id "io.github.pacifistmc.forgix" version "1.2.6"
id "me.hypherionmc.modutils.modpublisher" version "1.0.2"
}

// Jenkins
ext {
release = project.properties['release'] ?: false
}
// Jenkins
ext {
release = project.properties['release'] ?: false
}

def version_base = "${project.base_version}"
def final_ver = "${version_base}.${project.version_patch}"

if (System.getenv('BUILD_NUMBER') != null && project.release == false) {
final_ver = version_base + "." + System.getenv('BUILD_NUMBER') + "d"
}

forgix {
group = project.group
mergedJarName = "${mod_name}-combo-${minecraft_version}-${final_ver}.jar"
outputDir = "artifacts/merged"

def version_base = "${project.version}"
version = "${version_base}.${project.version_patch}"
forge {
projectName = "Forge"

if (System.getenv('BUILD_NUMBER') != null && project.release == false) {
version = version_base + "." + System.getenv('BUILD_NUMBER') + "d"
mixin "${mod_id}.mixin.json"
mixin "${mod_id}.forge.mixin.json"
}

fabric {
projectName = "Fabric"
}
}

subprojects {
apply plugin: 'java'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
version = final_ver

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_name}" }
Expand Down Expand Up @@ -52,18 +75,26 @@ subprojects {
}

task preClean {
delete "$buildDir/libs"
delete "$rootDir/artifacts"
}
}

task copyAllArtifacts(type: Copy) {
if (project.name !== "Common") {
from "$buildDir/libs"
into "$rootDir/artifacts"
include("*.jar")
delete("$rootDir/artifacts/*-common-*.jar")
}
publisher {
apiKeys {
curseforge = System.getenv("CURSE_TOKEN")
modrinth = System.getenv("MODRINTH_TOKEN")
}

build.finalizedBy(copyAllArtifacts)
debug = debug_publish
curseID = curse_id
modrinthID = modrinth_id
versionType = rel_type
changelog = rootProject.file(changelog_file)
version = "${minecraft_version}-${final_ver}"
displayName = "[1.19.3/4] MoreCreativeTabs - ${final_ver}"
gameVersions = ["1.19.3", "1.19.4"]
loaders = ["forge", "fabric", "quilt"]
artifact = forgix.getOutputDir() + "/" + forgix.getMergedJarName()
}

publishMod.dependsOn(mergeJars)
1 change: 0 additions & 1 deletion changelog-forge.md

This file was deleted.

File renamed without changes.
9 changes: 8 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project
version=1.2
base_version=1.2
version_patch=0
group=me.hypherionmc.morecreativetabs

Expand All @@ -25,3 +25,10 @@ mod_id=morecreativetabs
# Gradle
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# Publishing
curse_id=581838
modrinth_id=nOiHJ1dx
rel_type=release
changelog_file=changelog.md
debug_publish=false
3 changes: 3 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pluginManagement {
name = 'Sponge Snapshots'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
url "https://maven.firstdarkdev.xyz/releases"
}
}
}

Expand Down

0 comments on commit 66ce203

Please sign in to comment.