buildscript { repositories { mavenCentral() maven { name = "forge" url = "https://maven.minecraftforge.net/" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') { changing = true } } } apply plugin: 'forge' apply plugin: 'java' apply plugin: "maven-publish" defaultTasks 'fullBuild' repositories { maven { url 'https://maven.tilera.xyz' } maven { url = "https://s3.tilera.xyz/cdn/minecraft/libs/" metadataSources { artifact() } } maven { name "central" url "https://nexus.covers1624.net/repository/maven-hosted/" } maven { url = "https://gregtech.overminddl1.com/" metadataSources { artifact() } } } idea { module { // For some reason this is necessary for IDEA 2014 workspaces to recognize assets inheritOutputDirs = true } } // Define properties file ext.configFile = file "build.properties" configFile.withReader { // Load config. It shall from now be referenced as simply config or project.config def prop = new Properties() prop.load(it) project.ext.config = new ConfigSlurper().parse prop } dependencies { compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.CCLIB_version}:dev" compile "codechicken:ForgeMultipart:${config.minecraft_version}-${config.FMP_version}:dev" compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev" compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.CCC_version}:dev" compile "inventorytweaks:InventoryTweaks:1.59-dev:api" compile "net.industrial-craft:industrialcraft-2:2.2.827-experimental:dev" compile "mcp.mobius.waila:Waila:1.5.10_1.7.10:dev" compile "universalelectricity:basiccomponents:2.0.0:deobf" compile "universalelectricity:universalelectricity:5.1.0:deobf" compile "com.hbm:HBM-NTM:1.0.27_X5000:deobf" } version = "${config.minecraft_version}-${config.mod_version}" group= "mekanism" archivesBaseName = "Mekanism" libsDirName = "../output" distsDirName = "../output" sourceCompatibility = '1.8' targetCompatibility = '1.8' minecraft { version = config.minecraft_version + "-" + config.forge_version replaceIn "mekanism/common/Mekanism.java" replaceIn "mekanism/generators/common/MekanismGenerators.java" replaceIn "mekanism/tools/common/MekanismTools.java" replace "GRADLE_MODVERSION", config.mod_version } processResources { // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' exclude '**/*.blend*' } } task coreJar(type: Jar) { classifier = 'Core' manifest { attributes 'FMLCorePlugin': 'mekanism.common.asm.LoadingHook' attributes 'FMLCorePluginContainsFMLMod': 'true' } from('etc/core') { include '*.info' expand 'version': config.mod_version, 'mc_version': config.minecraft_version, 'fmp_version': config.FMP_version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { exclude 'mekanism/tools/**', 'mekanism/generators/**', 'mcmod.info' } } task alltJar(type: Jar) { classifier = 'ALL' manifest { attributes 'FMLCorePlugin': 'mekanism.common.asm.LoadingHook' attributes 'FMLCorePluginContainsFMLMod': 'true' } from('etc/all') { include '*.info' expand 'version': config.mod_version, 'mc_version': config.minecraft_version, 'fmp_version': config.FMP_version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { exclude 'mcmod.info' } } task toolsJar(type: Jar) { classifier = 'Tools' from('etc/tools') { include '*.info' expand 'version':config.mod_version,'mc_version':config.minecraft_version,'fmp_version':config.FMP_version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { include 'mekanism/tools/**' exclude 'mcmod.info' } } task generatorsJar(type: Jar) { classifier = 'Generators' from('etc/generators') { include '*.info' expand 'version':config.mod_version,'mc_version':config.minecraft_version,'fmp_version':config.FMP_version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { include 'mekanism/generators/**' exclude 'mcmod.info' } } task deobfJar(type: Jar) { dependsOn processResources from sourceSets.main.output classifier = 'deobf' } task sourcesJar(type: Jar) { from sourceSets.main.allSource classifier = 'sources' } coreJar.dependsOn('reobf') toolsJar.dependsOn('reobf') generatorsJar.dependsOn('reobf') alltJar.dependsOn('reobf') task apiJar(type: Jar) { classifier = 'API' dependsOn processResources from sourceSets.main.java.srcDirs from sourceSets.main.output include 'mekanism/api/**' } task fullBuild(type: Delete) { delete jar } fullBuild.dependsOn('toolsJar', 'coreJar', 'generatorsJar', 'sourcesJar', 'alltJar', 'apiJar') publishing { tasks.publish.dependsOn 'build' publications { mavenJava(MavenPublication) { artifactId = project.archivesBaseName artifact deobfJar artifact sourcesJar artifact jar } } repositories { if (project.hasProperty('mvnURL')) { maven { credentials { username findProperty("mvnUsername") password findProperty("mvnPassword") } url = findProperty("mvnURL") } } else { mavenLocal() } } }