LibJF/build.gradle

239 lines
6.4 KiB
Groovy
Raw Normal View History

2021-09-27 20:55:48 +02:00
plugins {
id "java-library"
id "eclipse"
id "idea"
id "maven-publish"
id "fabric-loom" version "0.10-SNAPSHOT" apply false
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "1.1.0"
}
version = "$project.mod_version"
2021-04-11 16:00:37 +02:00
2021-09-27 20:55:48 +02:00
def moduleDependencies(project, List<String> depNames) {
def deps = depNames.iterator().collect { project.dependencies.project(path: ":$it", configuration: 'dev') }
project.dependencies {
deps.each {
api it
}
}
2021-09-27 21:18:55 +02:00
/*project.publishing {
2021-09-27 20:55:48 +02:00
publications {
mavenJava(MavenPublication) {
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
deps.each {
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name)
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}
}
}
}
2021-09-27 21:18:55 +02:00
}*/
2021-04-11 20:23:52 +02:00
}
2021-09-27 20:55:48 +02:00
allprojects {
apply plugin: "java-library"
apply plugin: "fabric-loom"
tasks.withType(JavaCompile).configureEach {
it.options.release = 16
}
group = "io.gitlab.jfronny.libjf"
sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
}
loom {
runs {
testmodClient {
client()
ideConfigGenerated project.rootProject == project
name = "Testmod Client"
source sourceSets.testmod
}
testmodServer {
server()
ideConfigGenerated project.rootProject == project
name = "Testmod Server"
source sourceSets.testmod
}
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.minecraft_version}+${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "com.terraformersmc:modmenu:2.0.10"
2021-09-27 21:01:31 +02:00
include modImplementation(fabricApi.module("fabric-tag-extensions-v0", "${project.fabric_version}"))
include modImplementation(fabricApi.module("fabric-resource-loader-v0", "${project.fabric_version}"))
2021-09-27 20:55:48 +02:00
}
configurations {
dev
}
loom {
shareRemapCaches = true
}
repositories {
maven {
name = 'TerraformersMC'
url = 'https://maven.terraformersmc.com/'
}
}
jar {
archiveClassifier = "dev"
}
afterEvaluate {
remapJar {
input = file("${project.buildDir}/libs/$archivesBaseName-${project.version}-dev.jar")
archiveFileName = "${archivesBaseName}-${project.version}.jar"
}
artifacts {
dev file: file("${project.buildDir}/libs/$archivesBaseName-${project.version}-dev.jar"), type: "jar", builtBy: jar
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = "sources"
from sourceSets.main.allSource
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
2021-04-11 20:23:52 +02:00
}
}
2021-09-27 20:55:48 +02:00
subprojects {
dependencies {
testmodImplementation sourceSets.main.output
}
2021-04-11 16:00:37 +02:00
2021-09-27 20:55:48 +02:00
publishing {
publications {
mavenJava(MavenPublication) {
afterEvaluate {
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}
}
2021-04-11 16:00:37 +02:00
}
2021-09-27 20:55:48 +02:00
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
dependencies {
afterEvaluate {
subprojects.each {
api project(path: ":${it.name}", configuration: "dev")
include project("${it.name}:")
testmodImplementation project("${it.name}:").sourceSets.testmod.output
2021-07-18 10:36:51 +02:00
}
2021-09-27 20:55:48 +02:00
}
}
task modrinth(type: com.modrinth.minotaur.TaskModrinthUpload, dependsOn: remapJar) {
onlyIf {
System.getenv().MODRINTH_API_TOKEN
}
token = System.getenv().MODRINTH_API_TOKEN
projectId = "WKwQAwke"
versionNumber = version
versionName = "[${project.minecraft_version}] ${project.mod_version}"
uploadFile = remapJar
addGameVersion("${project.minecraft_version}")
addLoader('fabric')
}
curseforge {
if (System.getenv().CURSEFORGE_API_TOKEN) {
apiKey = System.getenv().CURSEFORGE_API_TOKEN
} else {
println "No CURSEFORGE_API_TOKEN specified"
}
project {
id = "482600"
releaseType = 'release'
addGameVersion "Fabric"
addGameVersion "${project.minecraft_version}"
changelog = ""
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
mainArtifact.displayName = "[${project.minecraft_version}] ${project.mod_version}"
afterEvaluate {
uploadTask.dependsOn(remapJar)
2021-07-18 10:36:51 +02:00
}
}
2021-09-27 20:55:48 +02:00
options {
forgeGradleIntegration = false
}
}
task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
input = jar.archiveFile
archiveFileName = "${archivesBaseName}-${project.version}-maven.jar"
addNestedDependencies = false
}
2021-09-27 20:55:48 +02:00
build.dependsOn remapMavenJar
publishing {
2021-09-27 21:12:46 +02:00
repositories {
maven {
url = "https://gitlab.com/api/v4/projects/25805200/packages/maven"
name = "gitlab"
credentials(HttpHeaderCredentials) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
2021-09-27 20:55:48 +02:00
publications {
maven(MavenPublication) {
artifact(remapMavenJar) {
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}