Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kotlin build script and move to CurseForgeGradle
- Loading branch information
1 parent
dd43a26
commit d143339
Showing
12 changed files
with
546 additions
and
454 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import com.blamejared.modtemplate.Utils | ||
|
||
val minecraftVersion: String by project | ||
val modName: String by project | ||
val modVersion: String by project | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
id("com.blamejared.modtemplate") | ||
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT" | ||
} | ||
|
||
val baseArchiveName = "${modName}-common-${minecraftVersion}" | ||
version = Utils.updatingSemVersion(modVersion) | ||
|
||
base { | ||
archivesName.set(baseArchiveName) | ||
} | ||
|
||
minecraft { | ||
version(minecraftVersion) | ||
runs { | ||
client("Common Client") { | ||
workingDirectory(project.file("run")) | ||
} | ||
server("Common Server") { | ||
workingDirectory(project.file("run_server")) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly("org.spongepowered:mixin:0.8.5") | ||
} | ||
|
||
publishing { | ||
publications { | ||
register("mavenJava", MavenPublication::class) { | ||
artifactId = baseArchiveName | ||
from(components["java"]) | ||
} | ||
} | ||
|
||
repositories { | ||
maven("file://${System.getenv("local_maven")}") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import com.blamejared.modtemplate.Utils | ||
import net.darkhax.curseforgegradle.TaskPublishCurseForge | ||
import net.darkhax.curseforgegradle.Constants as CFG_Contants | ||
|
||
plugins { | ||
`maven-publish` | ||
id("fabric-loom") version "0.10-SNAPSHOT" | ||
id("com.blamejared.modtemplate") | ||
id("net.darkhax.curseforgegradle") version ("1.0.8") | ||
} | ||
|
||
val modVersion: String by project | ||
val minecraftVersion: String by project | ||
val fabricLoaderVersion: String by project | ||
val modName: String by project | ||
val modAuthor: String by project | ||
val modId: String by project | ||
val modAvatar: String by project | ||
val curseProjectId: String by project | ||
val curseHomepageLink: String by project | ||
val gitFirstCommit: String by project | ||
val gitRepo: String by project | ||
val modJavaVersion: String by project | ||
|
||
val baseArchiveName = "${modName}-fabric-${minecraftVersion}" | ||
|
||
version = Utils.updatingSemVersion(modVersion) | ||
base { | ||
archivesName.set(baseArchiveName) | ||
} | ||
|
||
dependencies { | ||
minecraft("com.mojang:minecraft:${minecraftVersion}") | ||
mappings(loom.layered { | ||
officialMojangMappings() | ||
parchment("org.parchmentmc.data:parchment-1.18.1:2021.12.19@zip") | ||
}) | ||
modImplementation("net.fabricmc:fabric-loader:${fabricLoaderVersion}") | ||
implementation(project(":Common")) | ||
} | ||
|
||
loom { | ||
runs { | ||
named("client") { | ||
client() | ||
setConfigName("Fabric Client") | ||
ideConfigGenerated(true) | ||
runDir("run") | ||
} | ||
named("server") { | ||
server() | ||
setConfigName("Fabric Server") | ||
ideConfigGenerated(true) | ||
runDir("run_server") | ||
} | ||
} | ||
} | ||
|
||
modTemplate { | ||
mcVersion(minecraftVersion) | ||
curseHomepage(curseHomepageLink) | ||
displayName(modName) | ||
modLoader("Fabric") | ||
changelog { | ||
enabled(true) | ||
firstCommit(gitFirstCommit) | ||
repo(gitRepo) | ||
} | ||
versionTracker { | ||
enabled(true) | ||
author(modAuthor) | ||
projectName("${modName}-Fabric") | ||
homepage(curseHomepageLink) | ||
} | ||
} | ||
|
||
tasks.processResources { | ||
outputs.upToDateWhen { false } | ||
from(project(":Common").sourceSets.main.get().resources) | ||
|
||
inputs.property("version", project.version) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand("version" to project.version) | ||
} | ||
|
||
filesMatching("*.mixins.json") { | ||
expand("refmap_target" to "$baseArchiveName-") | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
source(project(":Common").sourceSets.main.get().allSource) | ||
} | ||
|
||
publishing { | ||
publications { | ||
register("mavenJava", MavenPublication::class) { | ||
artifactId = baseArchiveName | ||
from(components["java"]) | ||
} | ||
} | ||
|
||
repositories { | ||
maven("file://${System.getenv("local_maven")}") | ||
} | ||
} | ||
|
||
tasks.create<TaskPublishCurseForge>("publishCurseForge") { | ||
apiToken = Utils.locateProperty(project, "curseforge_api_token") | ||
|
||
val mainFile = upload(curseProjectId, file("${project.buildDir}/libs/$baseArchiveName-$version.jar")) | ||
mainFile.changelogType = "markdown" | ||
mainFile.changelog = Utils.getFullChangelog(project) | ||
mainFile.releaseType = CFG_Contants.RELEASE_TYPE_RELEASE | ||
mainFile.addJavaVersion("Java $modJavaVersion") | ||
mainFile.addGameVersion(minecraftVersion) | ||
|
||
doLast { | ||
project.ext.set("curse_file_url", "${curseHomepageLink}/files/${mainFile.curseFileId}") | ||
} | ||
} |
Oops, something went wrong.