Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plugins {
- id "net.minecraftforge.gradle.forge" version "2.0.2"
- }
- //apply plugin: 'forge'
- //apply plugin: 'java'
- // Fixes bug in IDEA 14 that wasn't putting resources into build/classes
- sourceSets {
- main { output.resourcesDir = output.classesDir }
- }
- ext {
- configFile = file "project.properties"
- srcWebDir = "src/main/resources/assets/journeymap/web/"
- implSrc = "build/resources/java/journeymap/feature/impl/"
- }
- configFile.withReader {
- def prop = new Properties()
- prop.load(it)
- project.ext.config = new ConfigSlurper().parse prop
- }
- version = "${config.minecraft_version}-${config.jm_major}.${config.jm_minor}.${config.jm_micro}${config.jm_patch}"
- group = "${config.group_id}"
- archivesBaseName = "${config.mod_id}".toLowerCase()
- minecraft {
- version = "${config.minecraft_version}-${config.forge_version}"
- runDir = "run"
- replace "@JMVERSION@", "${config.jm_major}.${config.jm_minor}.${config.jm_micro}${config.jm_patch}"
- replace "@MCVERSION@", config.minecraft_version
- replace "@FORGEVERSION@", config.forge_version
- replace "@MAJOR@", config.jm_major
- replace "@MINOR@", config.jm_minor
- replace "@MICRO@", config.jm_micro
- replace "@PATCH@", config.jm_patch
- mappings = "${config.snapshot}"
- }
- dependencies {
- compile fileTree(dir: 'libs', include: '*.*');
- }
- processResources {
- // // this will ensure that this task is redone when the versions change.
- // inputs.property "version", project.version
- // inputs.property "mcversion", project.minecraft.version
- //
- // from(sourceSets.main.resources.srcDirs) {
- // include 'license.txt'
- // expand 'version': project.version, 'mcversion': project.minecraft.version, 'date' : getDate()
- // }
- // // copy everything else, thats not the mcmod.info
- // from(sourceSets.main.resources.srcDirs) {
- // exclude 'mcmod.info'
- // exclude 'license.txt'
- // }
- }
- task copyJs(type: Copy) {
- from 'tmp'
- into 'build/resources/main/assets/journeymap/web/css'
- include 'journeymap.css'
- }
- task copyCss(type: Copy, dependsOn: copyJs) {
- from 'tmp'
- into 'build/resources/main/assets/journeymap/web/js'
- include 'journeymap.js'
- }
- task filter() {
- def subdir = new File("tmp")
- if( !subdir.exists() ) {
- subdir.mkdirs()
- }
- }
- task minifyJs(type: JavaExec, dependsOn: filter) {
- ant.java(jar:"libs/yuicompressor-2.4.7.jar",fork:true)
- {
- arg(value: "${srcWebDir}js/journeymap.js")
- arg(value: "-o")
- arg(value: "tmp/journeymap.js")
- }
- }
- task minifyCss(type: JavaExec, dependsOn: filter) {
- ant.java(jar:"libs/yuicompressor-2.4.7.jar",fork:true)
- {
- arg(value: "${srcWebDir}css/journeymap.css")
- arg(value: "-o")
- arg(value: "tmp/journeymap.css")
- }
- }
- task deleteNoRadar(type: Delete) {
- delete '${implSrc}NoRadar.java'
- }
- task deleteUnlimited(type: Delete) {
- delete '${implSrc}Unlimited.java'
- }
- task unlimitedJar(type: Jar, dependsOn: ['copyCss', 'deleteNoRadar']) {
- version = "${version}-${config.unlimited}".toLowerCase()
- from(sourceSets.main.output) {
- exclude("journeymap/client/feature/impl/NoRadar.class")
- }
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
- expand 'version': project.version, 'mcversion': project.minecraft.version, 'forgeversion' : config.forge_version, jmedition : config.unlimited
- }
- }
- task fairPlayJar(type: Jar, dependsOn: ['copyCss', 'deleteNoRadar', 'deleteUnlimited']) {
- version = "${version}-${config.fairPlay}".toLowerCase()
- from(sourceSets.main.output) {
- exclude("journeymap/client/feature/impl/Unlimited.class")
- exclude("journeymap/client/feature/impl/NoRadar.class")
- }
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
- expand 'version': project.version, 'mcversion': project.minecraft.version, 'forgeversion' : config.forge_version, jmedition : config.fairPlay
- }
- }
- artifacts.archives unlimitedJar, fairPlayJar
- reobf {
- unlimitedJar {}
- fairPlayJar {}
- }
- /*
- def reobf {
- reobf (unlimitedJar) { spec ->
- spec.classpath = sourceSets.main.compileClasspath;
- }
- reobf (fairPlayJar) { spec ->
- spec.classpath = sourceSets.main.compileClasspath;
- }
- }
- */
- task makePretty(type: Delete) {
- delete "build/libs/${archivesBaseName}-${version}.jar"
- delete '/tmp/'
- }
- def getDate() {
- def date = new Date()
- def formattedDate = date.format(config.dateFormat)
- return formattedDate
- }
- build.dependsOn makePretty
Advertisement
Add Comment
Please, Sign In to add comment