Files
distant-horizons-sharded/build.gradle
T
2021-12-06 11:39:57 +00:00

139 lines
4.1 KiB
Groovy

plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "7.1.0"
}
version = '1.0'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
loom {
accessWidenerPath = file("src/main/resources/lod.accesswidener")
}
// this is required so that we can use
// jitpack in the dependencies section below
repositories {
mavenCentral()
// used to download and compile dependencies from git repos
maven { url 'https://jitpack.io' }
// Required for ModMenu
maven { url "https://maven.terraformersmc.com/" }
}
configurations {
shadowMe
compileOnly.extendsFrom(embed)
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
// Fabric API
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
// Mod Menu
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
implementation 'org.tukaani:xz:1.9'
shadowMe 'org.tukaani:xz:1.9'
implementation 'org.apache.commons:commons-compress:1.21'
shadowMe 'org.apache.commons:commons-compress:1.21'
}
shadowJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
configurations = [project.configurations.getByName("shadowMe")]
relocate 'org.tukaani', 'shaded.tukaani'
relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress'
archiveClassifier = 'unmapped'
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
jar {
archiveClassifier = 'unmapped'
}
remapJar {
dependsOn(shadowJar)
mustRunAfter(shadowJar)
input = shadowJar.archiveFile
archiveBaseName = "${project.name}"
archiveVersion = "${project.version}"
archiveClassifier = ''
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
//// add Distant Horizon's Core source folders
//sourceSets {
// main {
// java {
// srcDirs("core/src/main/java");
// srcDirs("core/src/main/resources")
// }
// }
//}