164 lines
4.0 KiB
Groovy
164 lines
4.0 KiB
Groovy
plugins {
|
|
id 'fabric-loom' version '0.12-SNAPSHOT'
|
|
id 'maven-publish'
|
|
id 'idea'
|
|
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
|
id "me.hypherionmc.modutils.modpublisher" version "1.0.13"
|
|
}
|
|
|
|
archivesBaseName = "${mod_name}-fabric-${minecraft_version}"
|
|
|
|
configurations {
|
|
shade
|
|
implementation.extendsFrom shade
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${minecraft_version}"
|
|
mappings loom.officialMojangMappings()
|
|
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
|
implementation project(":Common")
|
|
|
|
shade "me.hypherionmc.moon-config:core:${moon_config}"
|
|
shade "me.hypherionmc.moon-config:toml:${moon_config}"
|
|
|
|
modCompileOnlyApi("com.terraformersmc:modmenu:${mod_menu_version}") {
|
|
exclude(group: "net.fabricmc.fabric-api")
|
|
}
|
|
}
|
|
|
|
loom {
|
|
accessWidenerPath = project(":Common").file("src/main/resources/craterlib.aw")
|
|
runs {
|
|
client {
|
|
client()
|
|
setConfigName("Fabric Client")
|
|
ideConfigGenerated(true)
|
|
runDir("run")
|
|
}
|
|
server {
|
|
server()
|
|
setConfigName("Fabric Server")
|
|
ideConfigGenerated(true)
|
|
runDir("run")
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
processResources {
|
|
from project(":Common").sourceSets.main.resources
|
|
inputs.property "version", project.version
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
expand "version": project.version
|
|
}
|
|
|
|
filesMatching('*.mixins.json') {
|
|
expand "refmap_target": "${archivesBaseName}-"
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
source(project(":Common").sourceSets.main.allSource)
|
|
}
|
|
|
|
jar {
|
|
from("LICENSE") {
|
|
rename { "${it}_${mod_name}" }
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
from sourceSets.main.output
|
|
|
|
configurations = [project.configurations.shade]
|
|
dependencies {
|
|
relocate 'me.hypherionmc.moonconfig', 'shadow.hypherionmc.moonconfig'
|
|
}
|
|
}
|
|
|
|
remapJar {
|
|
dependsOn(shadowJar)
|
|
shouldRunAfter(shadowJar)
|
|
input.set shadowJar.archiveFile.get()
|
|
}
|
|
|
|
reg.configureJarTask(shadowJar)
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
groupId project.group
|
|
artifactId project.archivesBaseName
|
|
version project.version
|
|
from components.java
|
|
pom.withXml {
|
|
Node pomNode = asNode()
|
|
pomNode.dependencies.'*'.findAll() {
|
|
it.artifactId.text() == 'regutils-joined-fabric' ||
|
|
it.artifactId.text() == 'core' ||
|
|
it.artifactId.text() == 'toml' || it.artifactId.text() == "modmenu"
|
|
}.each() {
|
|
it.parent().remove(it)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url "https://maven.firstdarkdev.xyz/" + (project.release ? "releases" : "snapshots")
|
|
credentials {
|
|
username System.getenv("MAVEN_USER")
|
|
password System.getenv("MAVEN_PASS")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task delDevJar {
|
|
doLast {
|
|
def tree = fileTree('build/libs')
|
|
tree.include '**/*-dev.jar'
|
|
tree.include '**/*-all.jar'
|
|
tree.each { it.delete() }
|
|
}
|
|
}
|
|
build.finalizedBy delDevJar
|
|
|
|
task copyAllArtifacts(type: Copy) {
|
|
from "$buildDir/libs"
|
|
into "$rootDir/artifacts"
|
|
include("*.jar")
|
|
}
|
|
|
|
build.finalizedBy(copyAllArtifacts)
|
|
|
|
publisher {
|
|
apiKeys {
|
|
modrinth = System.getenv("MODRINTH_TOKEN")
|
|
curseforge = System.getenv("CURSE_TOKEN")
|
|
}
|
|
|
|
curseID = curse_id
|
|
modrinthID = modrinth_id
|
|
versionType = "release"
|
|
changelog = rootProject.file("changelog-fabric.md")
|
|
version = "${minecraft_version}-${project.version}"
|
|
displayName = "[FABRIC/QUILT 1.20] CraterLib - ${project.version}"
|
|
gameVersions = ["1.20"]
|
|
loaders = ["fabric", "quilt"]
|
|
artifact = remapJar
|
|
|
|
modrinthDepends {
|
|
required = ["P7dR8mSH"]
|
|
}
|
|
|
|
curseDepends {
|
|
required = ["fabric-api"]
|
|
}
|
|
}
|
|
|
|
publishMod.dependsOn(build) |