Skip to content

Commit

Permalink
Gradle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Jan 1, 2024
1 parent 466afb0 commit 3463aa6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 70 deletions.
46 changes: 41 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
plugins {
// Required for NeoGradle
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
// Used for changelog generation
id 'net.minecraftforge.gradleutils' version '2.2.0'
buildscript {
repositories {
gradlePluginPortal()
maven {
name = "Forge"
url = "https://maven.minecraftforge.net"
}
}
dependencies {
classpath 'com.modrinth.minotaur:Minotaur:2.+'
classpath 'gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.7' // Required for NeoGradle
classpath 'net.minecraftforge:gradleutils:2.2.0' // Required for changelog generation
}
}

apply plugin: 'org.jetbrains.gradle.plugin.idea-ext'
apply plugin: 'net.minecraftforge.gradleutils'

changelog {
fromTag '9.2.0'
}
Expand All @@ -23,6 +34,10 @@ subprojects {
apply plugin: 'idea'
apply plugin: 'maven-publish'

if (!project.name.equals("Common")) {
apply plugin: 'com.modrinth.minotaur'
}

version = "${minecraft_version}-${mod_version}"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand Down Expand Up @@ -88,6 +103,27 @@ subprojects {
}

afterEvaluate {
// Share Modrinth configuration between loaders
// Unfortunately the CurseForge plugin breaks when doing this
// remapJar does not exist until after initial evaluation
if (!name.equals("Common")) {
modrinth {
token = findProperty('modrinthToken')
projectId = mod_modrinth_id
versionNumber = mod_version
versionName = "${mod_version} for ${name} ${minecraft_version}"
versionType = release_channel
uploadFile = name.equals("Fabric") ? remapJar : jar
gameVersions = [minecraft_version]
loaders = [name.toLowerCase()]

if (changelog_file.exists()) {
changelog = trimChangelog(changelog_file.text)
}
}
}

// archivesBaseName is not set until after initial evaluation
publishing {
publications {
mavenJava(MavenPublication) {
Expand Down
27 changes: 5 additions & 22 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id "fabric-loom" version "1.4-SNAPSHOT"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
}

base.archivesName.set("${mod_name}-fabric")
Expand All @@ -23,6 +22,9 @@ dependencies {

loom {
accessWidenerPath = project(":Common").file("src/main/resources/${mod_id}.accesswidener")
mixin {
defaultRefmapName.set("${mod_id}.refmap.json")
}
runs {
client {
client()
Expand Down Expand Up @@ -58,10 +60,10 @@ curseforge {

releaseType = release_channel
addGameVersion minecraft_version
addGameVersion 'Fabric'
addGameVersion name

mainArtifact(remapJar) {
displayName = "${mod_display_name} Fabric ${version}"
displayName = "${mod_display_name} ${name} ${version}"

relations {
requiredDependency "fabric-api"
Expand All @@ -72,23 +74,4 @@ curseforge {
requiredDependency 'glitchcore'
}
}
}

modrinth {
token = project.findProperty('modrinthToken')
projectId = mod_modrinth_id
versionNumber = mod_version
versionName = mod_version + " for Fabric " + minecraft_version
versionType = release_channel // can be release, beta, or alpha
uploadFile = remapJar
gameVersions = [minecraft_version]
loaders = ['fabric']

if (changelog_file.exists()) {
changelog = trimChangelog(changelog_file.text)
}

dependencies {
required.project "glitchcore"
}
}
23 changes: 2 additions & 21 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id "net.minecraftforge.gradle" version "6.+"
id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
}

base.archivesName.set("${mod_name}-forge")
Expand Down Expand Up @@ -102,32 +101,14 @@ curseforge {

releaseType = release_channel
addGameVersion minecraft_version
addGameVersion name

mainArtifact(jar) {
displayName = "${mod_display_name} Forge ${version}"
displayName = "${mod_display_name} ${name} ${version}"
}

relations {
requiredDependency 'glitchcore'
}
}
}

modrinth {
token = project.findProperty('modrinthToken')
projectId = mod_modrinth_id
versionNumber = mod_version
versionName = mod_version + " for Forge " + minecraft_version
versionType = release_channel // can be release, beta, or alpha
uploadFile = jar
gameVersions = [minecraft_version]
loaders = ['forge']

if (changelog_file.exists()) {
changelog = trimChangelog(changelog_file.text)
}

dependencies {
required.project "glitchcore"
}
}
24 changes: 2 additions & 22 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id "net.neoforged.gradle.userdev" version "7.+"
id "net.neoforged.gradle.mixin" version "7.+"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
}

base.archivesName.set("${mod_name}-neoforge")
Expand Down Expand Up @@ -78,33 +77,14 @@ curseforge {

releaseType = release_channel
addGameVersion minecraft_version
addGameVersion 'NeoForge' // NeoForge isn't auto-detected and must be manually specified
addGameVersion name

mainArtifact(jar) {
displayName = "${mod_display_name} NeoForge ${version}"
displayName = "${mod_display_name} ${name} ${version}"
}

relations {
requiredDependency 'glitchcore'
}
}
}

modrinth {
token = project.findProperty('modrinthToken')
projectId = mod_modrinth_id
versionNumber = mod_version
versionName = mod_version + " for NeoForge " + minecraft_version
versionType = release_channel // can be release, beta, or alpha
uploadFile = jar
gameVersions = [minecraft_version]
loaders = ['neoforge']

if (changelog_file.exists()) {
changelog = trimChangelog(changelog_file.text)
}

dependencies {
required.project "glitchcore"
}
}

0 comments on commit 3463aa6

Please sign in to comment.