mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 15:25:08 +01:00
171 lines
4.7 KiB
Groovy
171 lines
4.7 KiB
Groovy
buildscript {
|
|
dependencies {
|
|
constraints {
|
|
["asm", "asm-util", "asm-tree", "asm-analysis"].each {
|
|
classpath("org.ow2.asm:$it") {
|
|
version { require("9.1") }
|
|
because("Fabric's TinyRemapper requires ASM 9")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'fabric-loom' version '0.6-SNAPSHOT'
|
|
id 'java-library'
|
|
id 'maven-publish'
|
|
id 'com.github.johnrengelman.shadow' version '6.1.0'
|
|
id 'org.cadixdev.licenser' version '0.5.0'
|
|
}
|
|
|
|
import net.fabricmc.loom.task.RemapJarTask
|
|
|
|
group = project.maven_group
|
|
version = "${project.mod_version}+${getMCVersionString()}"
|
|
archivesBaseName = project.archives_base_name + "-fabric"
|
|
|
|
// This field defines the Java version your mod target.
|
|
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too.
|
|
def targetJavaVersion = 8
|
|
|
|
def getMCVersionString() {
|
|
if (project.minecraft_version.matches("\\d\\dw\\d\\d[a-z]")) {
|
|
return project.minecraft_version
|
|
}
|
|
int lastDot = project.minecraft_version.lastIndexOf('.')
|
|
return project.minecraft_version.substring(0, lastDot)
|
|
}
|
|
|
|
minecraft {
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven { url = 'https://aperlambda.github.io/maven' }
|
|
maven {
|
|
name = 'CottonMC'
|
|
url = 'http://server.bbkr.space:8081/artifactory/libs-snapshot'
|
|
}
|
|
maven {
|
|
name = 'Terraformers'
|
|
url = 'https://maven.terraformersmc.com/releases'
|
|
}
|
|
maven { url "https://maven.shedaniel.me/" }
|
|
maven { url = "https://jitpack.io" }
|
|
}
|
|
|
|
configurations {
|
|
shadow
|
|
api.extendsFrom shadow
|
|
}
|
|
|
|
dependencies {
|
|
//to change the versions see the gradle.properties file
|
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
|
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
|
|
|
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
|
|
modImplementation "com.github.lambdaurora:spruceui:${project.spruceui_version}"
|
|
include "com.github.lambdaurora:spruceui:${project.spruceui_version}"
|
|
|
|
// Compatibility mods
|
|
modImplementation("com.github.joaoh1:okzoomer:e13183c59b") {
|
|
exclude group: 'me.shedaniel.cloth'
|
|
exclude group: 'io.github.prospector'
|
|
}
|
|
|
|
modImplementation("me.shedaniel:RoughlyEnoughItems:5.10.184")
|
|
|
|
shadow "com.electronwill.night-config:core:3.6.3"
|
|
shadow "com.electronwill.night-config:toml:3.6.3"
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.toVersion(targetJavaVersion)
|
|
targetCompatibility = JavaVersion.toVersion(targetJavaVersion)
|
|
|
|
withSourcesJar()
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.encoding = "UTF-8"
|
|
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
it.options.release = targetJavaVersion
|
|
}
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
inputs.property "version", project.version
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
expand "version": project.version
|
|
}
|
|
}
|
|
|
|
jar {
|
|
from("LICENSE") {
|
|
rename { "${it}_${project.archivesBaseName}" }
|
|
}
|
|
}
|
|
|
|
license {
|
|
header file('HEADER')
|
|
include '**/*.java'
|
|
}
|
|
|
|
shadowJar {
|
|
dependsOn jar
|
|
configurations = [project.configurations.shadow]
|
|
archiveClassifier.set('dev')
|
|
|
|
exclude 'META-INF/maven/**'
|
|
exclude 'com/google/**'
|
|
exclude 'javax/**'
|
|
exclude 'org/**'
|
|
relocate 'com.electronwill.nightconfig', 'dev.lambdaurora.lambdacontrols.shadow.nightconfig'
|
|
}
|
|
|
|
task shadowRemapJar(type: RemapJarTask) {
|
|
dependsOn shadowJar
|
|
|
|
input = file("${project.buildDir}/libs/$archivesBaseName-$version-dev.jar")
|
|
archiveName = "${archivesBaseName}-${version}.jar"
|
|
addNestedDependencies = true
|
|
}
|
|
|
|
// configure the maven publication
|
|
publishing {
|
|
repositories {
|
|
mavenLocal()
|
|
maven {
|
|
name = "GithubPackages"
|
|
url = uri("https://maven.pkg.github.com/LambdAurora/LambdaControls")
|
|
credentials {
|
|
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
|
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
|
|
}
|
|
}
|
|
}
|
|
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
// add all the jars that should be included when publishing to maven
|
|
artifact(remapJar) {
|
|
builtBy remapJar
|
|
}
|
|
artifact(sourcesJar) {
|
|
builtBy remapSourcesJar
|
|
}
|
|
}
|
|
}
|
|
}
|