CurseGradle is a Gradle plugin that lets you publish artifacts to CurseForge. Consult the CurseGradle wiki for the full details. It works out of the box for ForgeGradle projects, but requires a bit of configuration for Fabric projects, which is the subject of this gist.
CurseGradle will assume the environment is a ForgeGradle environment, so its integration has to be manually switched off.
Without ForgeGradle, CurseGradle doesn't know which Minecraft version you are working with, so it has to be specified manually.
The correct main artifact is the output of the remapJar
task.
The curseforge
section of the buildscript should contain at least the following:
curseforge {
...
project {
id = PROJECT_ID
addGameVersion "1.14-Snapshot"
mainArtifact(remapJar.jar)
....
}
options {
forgeGradleIntegration = false
}
}
One problem remains - The curseforge publishing task does not depend on the remapJar
task.
By making the curseforge publishing task depend on the remapJar
task we ensure the file is up-to-date when uploaded.
This can be fixed with the following hack:
afterEvaluate {
tasks.curseforgePROJECT_ID.dependsOn remapJar
}
CurseGradle generates a publish task for the project in afterEvaluate, which we can only access in our own afterEvaluate.
The name of the publish task is based on the project ID.
We can then make the publish task depend on the remapJar
task.
Thanks!