generated from axieum/fabric-example-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: refactor artifacts and publications (#46)
build: adjust shadow jar configurations build(publish): do not publish fat-jars to maven refactor: remove unused mixin files build: improve fabric mod metadata ci: add maven pom definition ci(release): only publish packages with changes
- Loading branch information
Showing
20 changed files
with
147 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,15 @@ plugins { | |
id 'maven-publish' | ||
id 'com.modrinth.minotaur' version '2.2.1' | ||
id 'com.matthewprenger.cursegradle' version '1.4.0' | ||
id 'com.github.johnrengelman.shadow' version '7.1.2' | ||
id 'fabric-loom' version '0.12-SNAPSHOT' | ||
} | ||
|
||
allprojects { | ||
apply plugin: 'java' | ||
apply plugin: 'checkstyle' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.github.johnrengelman.shadow' | ||
apply plugin: 'fabric-loom' | ||
|
||
group = project.maven_group | ||
|
@@ -20,7 +22,7 @@ allprojects { | |
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 | ||
|
||
// Declare dependencies | ||
configurations { devElements { extendsFrom implementation, namedElements } } | ||
configurations { shade } | ||
dependencies { | ||
// Fabric | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
|
@@ -29,20 +31,11 @@ allprojects { | |
|
||
// Mods | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { | ||
exclude module: 'modmenu' | ||
} | ||
|
||
// Code Quality | ||
compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}" | ||
testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_jupiter_version}" | ||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_jupiter_version}" | ||
|
||
// Subprojects | ||
subprojects.each { | ||
implementation project(path: ":${it.name}", configuration: 'devElements') | ||
include project("${it.name}:") // nest within distribution | ||
} | ||
} | ||
|
||
// Perform tests using the JUnit test suite | ||
|
@@ -56,6 +49,19 @@ allprojects { | |
// withJavadocJar() | ||
} | ||
|
||
// Produce a fat-jar of all shaded dependencies | ||
shadowJar { | ||
configurations = [project.configurations.shade] | ||
destinationDirectory.set(layout.buildDirectory.dir('devlibs')) | ||
} | ||
|
||
remapJar { | ||
dependsOn tasks.shadowJar | ||
inputFile.set(tasks.shadowJar.archiveFile) | ||
} | ||
|
||
components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } | ||
|
||
// Add the licence to all distributions | ||
tasks.withType(Jar).configureEach { | ||
it.from rootProject.file('LICENCE.txt') | ||
|
@@ -65,11 +71,17 @@ allprojects { | |
processResources { | ||
inputs.property 'id', project.mod_id | ||
inputs.property 'name', project.mod_name | ||
inputs.property 'description', project.mod_description | ||
inputs.property 'version', project.version | ||
|
||
// fabric.mod.json | ||
filesMatching('fabric.mod.json') { | ||
expand(['id': project.mod_id, 'name': project.mod_name, 'version': project.version]) | ||
expand([ | ||
'id': project.mod_id, | ||
'name': project.mod_name, | ||
'description': project.mod_description, | ||
'version': project.version, | ||
]) | ||
} | ||
} | ||
|
||
|
@@ -101,7 +113,35 @@ allprojects { | |
publishing { | ||
// Declare all publications | ||
publications { | ||
mavenJava(MavenPublication) { from components.java } | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
pom { | ||
name = project.mod_name | ||
description = project.mod_description | ||
url = "https://github.com/${project.github_repo}" | ||
licenses { license { name = 'MIT'; url = 'https://opensource.org/licenses/MIT' } } | ||
developers { | ||
developer { | ||
name = 'Axieum' | ||
email = '[email protected]' | ||
url = 'https://github.com/axieum' | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:git://github.com/${project.github_repo}.git" | ||
developerConnection = "scm:git:ssh://[email protected]:${project.github_repo}.git" | ||
url = "https://github.com/${project.github_repo}" | ||
} | ||
issueManagement { system = 'GitHub'; url = "https://github.com/${project.github_repo}/issues" } | ||
ciManagement { system = 'GitHub'; url = "https://github.com/${project.github_repo}/actions" } | ||
properties = [ | ||
'mod_id': project.mod_id, | ||
'minecraft_version': project.minecraft_version, | ||
'loader_version': project.loader_version, | ||
'yarn_mappings': project.yarn_mappings, | ||
] | ||
} | ||
} | ||
} | ||
|
||
// Add repositories to publish to | ||
|
@@ -119,6 +159,9 @@ allprojects { | |
} | ||
} | ||
|
||
// Nest all subproject artifacts within the main/bundle distribution | ||
dependencies { subprojects.each { include project("${it.name}:") } } | ||
|
||
// Define how artifacts are published to CurseForge (https://curseforge.com) | ||
curseforge { | ||
// Set the API token from the environment | ||
|
@@ -157,7 +200,7 @@ curseforge { | |
// Configure other options | ||
options { | ||
forgeGradleIntegration = false | ||
debug = System.getenv('CURSEFORGE_DEBUG') as boolean ?: false | ||
debug = (System.getenv('CURSEFORGE_DEBUG') ?: 'false').toBoolean() | ||
} | ||
} | ||
|
||
|
@@ -167,7 +210,7 @@ modrinth { | |
// Set the API token from the environment | ||
token = System.getenv('MODRINTH_TOKEN') ?: '' | ||
// Set whether debug mode is enabled | ||
debugMode = System.getenv('MODRINTH_DEBUG') as boolean ?: false | ||
debugMode = (System.getenv('MODRINTH_DEBUG') ?: 'false').toBoolean() | ||
// Set the project id | ||
projectId = project.mr_project_id | ||
// Set the release name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,20 @@ | ||
plugins { | ||
id 'com.github.johnrengelman.shadow' version '7.1.2' | ||
} | ||
|
||
apply plugin: 'com.github.johnrengelman.shadow' | ||
configurations { shadow; implementation.extendsFrom shadow } | ||
|
||
// Declare dependencies | ||
dependencies { | ||
include "me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}" | ||
shadow "com.vdurmont:emoji-java:${project.emoji_java_version}" | ||
shadow("net.dv8tion:JDA:${project.jda_version}") { | ||
modApi include("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { | ||
exclude module: 'modmenu' | ||
} | ||
implementation shade("com.vdurmont:emoji-java:${project.emoji_java_version}") | ||
implementation shade("net.dv8tion:JDA:${project.jda_version}") { | ||
exclude module: 'opus-java' // exclude audio | ||
} | ||
shadow("org.apache.logging.log4j:log4j-slf4j18-impl:${project.log4j_version}") { | ||
implementation shade("org.apache.logging.log4j:log4j-slf4j18-impl:${project.log4j_version}") { | ||
exclude module: 'log4j-api' // exclude log4j itself, we transitively use via Minecraft | ||
exclude module: 'log4j-core' | ||
} | ||
} | ||
|
||
// Produce a fat-jar of all the shaded dependencies | ||
// Configure the fat-jar of shaded dependencies | ||
shadowJar { | ||
archiveClassifier.set('dev') | ||
configurations = [project.configurations.shadow] | ||
|
||
// Relocate dependencies | ||
final dest = "${project.group}.shadow.api" | ||
// relocate 'club.minnced.opus', "${dest}.club.minnced.opus" | ||
relocate 'com.fasterxml.jackson', "${dest}.com.fasterxml.jackson" | ||
relocate 'com.iwebpp.crypto', "${dest}.com.iwebpp.crypto" | ||
relocate 'com.neovisionaries.ws', "${dest}.com.neovisionaries.ws" | ||
// relocate 'com.sun.jna', "${dest}.com.sun.jna" | ||
// relocate 'com.vdurmont.emoji', "${dest}.com.vdurmont.emoji" | ||
relocate 'gnu.trove', "${dest}.gnu.trove" | ||
relocate 'javax.annotation', "${dest}.javax.annotation" | ||
// relocate 'net.dv8tion.jda', "${dest}.net.dv8tion.jda" | ||
relocate 'okhttp3', "${dest}.okhttp3" | ||
relocate 'okio', "${dest}.okio" | ||
relocate 'org.jetbrains.annotations', "${dest}.org.jetbrains.annotations" | ||
// relocate 'tomp2p.opuswrapper', "${dest}.tomp2p.opuswrapper" | ||
} | ||
|
||
// Provide the fat-jar to Fabric's remapping task | ||
remapJar { | ||
dependsOn tasks.shadowJar | ||
inputFile.set(tasks.shadowJar.archiveFile) | ||
// Relocate problematic dependencies | ||
relocate 'kotlin', "${project.group}.shadow.kotlin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
# Mod | ||
mod_name = Minecord API | ||
mod_id = minecord-api | ||
mod_name = Minecord API | ||
mod_description = Equips developers with the tools necessary to integrate their mods with Discord | ||
## {x-release-please-start-version} | ||
mod_version = 1.0.0-beta.3 | ||
## {x-release-please-end} | ||
|
||
# Dependencies | ||
cloth_config_version = 7.0.65 | ||
emoji_java_version = 5.1.1 | ||
jda_version = 5.0.0-alpha.12 | ||
log4j_version = 2.17.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,22 @@ | |
"id": "${id}", | ||
"version": "${version}", | ||
"name": "${name}", | ||
"description": "Equips developers with the tools necessary to integrate their mods with Discord", | ||
"authors": [ | ||
"Axieum" | ||
], | ||
"description": "${description}", | ||
"contact": { | ||
"homepage": "https://github.com/axieum/minecord", | ||
"sources": "https://github.com/axieum/minecord", | ||
"issues": "https://github.com/axieum/minecord/issues", | ||
"wiki": "https://github.com/axieum/minecord/wiki" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Axieum", | ||
"contact": { | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/axieum" | ||
} | ||
} | ||
], | ||
"license": "MIT", | ||
"icon": "assets/minecord-api/icon.png", | ||
"environment": "server", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,6 @@ | ||
plugins { | ||
id 'com.github.johnrengelman.shadow' version '7.1.2' | ||
} | ||
|
||
apply plugin: 'com.github.johnrengelman.shadow' | ||
configurations { shadow; implementation.extendsFrom shadow } | ||
|
||
// Declare dependencies | ||
dependencies { | ||
implementation project(path: ':minecord-api', configuration: 'shadow') | ||
shadow "io.github.java-diff-utils:java-diff-utils:${project.java_diff_utils_version}" | ||
} | ||
|
||
// Produce a fat-jar of all the shaded dependencies | ||
shadowJar { | ||
archiveClassifier.set('dev') | ||
configurations = [project.configurations.shadow] | ||
} | ||
|
||
// Provide the fat-jar to Fabric's remapping task | ||
remapJar { | ||
dependsOn tasks.shadowJar | ||
inputFile.set(tasks.shadowJar.archiveFile) | ||
implementation project(path: ':minecord-api', configuration: 'namedElements') | ||
implementation shade("io.github.java-diff-utils:java-diff-utils:${project.java_diff_utils_version}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,22 @@ | |
"id": "${id}", | ||
"version": "${version}", | ||
"name": "${name}", | ||
"description": "Bridges chat-related events between Minecraft and Discord", | ||
"authors": [ | ||
"Axieum" | ||
], | ||
"description": "${description}", | ||
"contact": { | ||
"homepage": "https://github.com/axieum/minecord", | ||
"sources": "https://github.com/axieum/minecord", | ||
"issues": "https://github.com/axieum/minecord/issues", | ||
"wiki": "https://github.com/axieum/minecord/wiki" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Axieum", | ||
"contact": { | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/axieum" | ||
} | ||
} | ||
], | ||
"license": "MIT", | ||
"icon": "assets/minecord-chat/icon.png", | ||
"environment": "server", | ||
|
Oops, something went wrong.