plugins { id 'fabric-loom' version '0.2.2-SNAPSHOT' } apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 ext.configFile = file "build.properties" configFile.withReader { def prop = new Properties() prop.load(it) project.ext.config = new ConfigSlurper().parse prop } dependencies { minecraft "com.mojang:minecraft:" + config.minecraft_version mappings "net.fabricmc:yarn:" + config.mappings_version modCompile "net.fabricmc:fabric-loader:" + config.fabric_loader_version compile "com.google.code.findbugs:jsr305:3.0.2" // Fabric API. This is technically optional, but you probably want it anyway. modCompile "net.fabricmc:fabric:" + config.fabric_version } minecraft { ext.mod_version = config.mod_version if (mod_version.endsWith('-dev')) { mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss') } //replaceIn "reference/MaLiLibReference.java" //replace "@MOD_VERSION@", mod_version } compileJava { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 options.encoding = 'UTF-8' } group = config.group + "." + config.mod_id archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out version = project.minecraft.mod_version processResources { // this will ensure that this task is redone when the versions change. //inputs.property "mod_version", project.minecraft.mod_version //inputs.property "minecraft_version", project.config.minecraft_version inputs.property "mod_version", project.minecraft.mod_version from(sourceSets.main.resources.srcDirs) { include "fabric.mod.json" expand "mod_version": project.minecraft.mod_version } from(sourceSets.main.resources.srcDirs) { exclude "fabric.mod.json" } } // 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 tasks.withType(JavaCompile) { options.encoding = "UTF-8" } // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. // If you remove this task, sources will not be generated. task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource } task deobfJar(type: Jar) { from sourceSets.main.output // This classifier is standard and should not be changed classifier = 'deobf' } // This section enables the last two tasks artifacts { //archives sourcesJar archives deobfJar } tasks.publish.dependsOn build publishing { publications { mavenJava(MavenPublication) { // old: artifactId project.archivesBaseName from components.java artifact deobfJar artifact sourcesJar // new: // add all the jars that should be included when publishing to maven //artifact(jar) { builtBy remapJar } //artifact(sourcesJar) { builtBy remapSourcesJar } } } repositories { maven { url "$projectDir/../../CommonMaven" } } }