SHOW:
|
|
- or go back to the newest paste.
| 1 | buildscript {
| |
| 2 | repositories {
| |
| 3 | mavenCentral() | |
| 4 | maven {
| |
| 5 | name = "forge" | |
| 6 | url = "http://files.minecraftforge.net/maven" | |
| 7 | } | |
| 8 | maven {
| |
| 9 | name = "sonatype" | |
| 10 | url = "https://oss.sonatype.org/content/repositories/snapshots/" | |
| 11 | } | |
| 12 | } | |
| 13 | dependencies {
| |
| 14 | classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT' | |
| 15 | } | |
| 16 | } | |
| 17 | ENV = System.getenv() | |
| 18 | ||
| 19 | // define the properties file | |
| 20 | ext.configFile = file "build.properties" | |
| 21 | ||
| 22 | configFile.withReader {
| |
| 23 | // read config. it shall from now on be referenced as simply config or as project.config | |
| 24 | def prop = new Properties() | |
| 25 | prop.load(it) | |
| 26 | ext.config = new ConfigSlurper().parse prop | |
| 27 | } | |
| 28 | ||
| 29 | // Drone.io Support | |
| 30 | if(ENV.DRONE_BUILD_NUMBER) | |
| 31 | buildNum = ENV.DRONE_BUILD_NUMBER + " - drone" | |
| 32 | ||
| 33 | // Jenkins and TeamCity Support | |
| 34 | else if (ENV.BUILD_NUMBER) | |
| 35 | buildNum = ENV.BUILD_NUMBER + " - CI" | |
| 36 | ||
| 37 | // Travis Support | |
| 38 | else if (ENV.TRAVIS_BUILD_NUMBER) | |
| 39 | buildNum = ENV.TRAVIS_BUILD_NUMBER + " - travis" | |
| 40 | ||
| 41 | // Codeship.io Support | |
| 42 | else if (ENV.CI_BUILD_NUMBER) | |
| 43 | buildNum = ENV.CI_BUILD_NUMBER + " - codeship" | |
| 44 | ||
| 45 | else | |
| 46 | buildNum = config.build_number | |
| 47 | ||
| 48 | apply plugin: 'java' | |
| 49 | apply plugin: 'forge' | |
| 50 | ||
| 51 | version = config.mod_version + "." + buildNum | |
| 52 | group= "com.tgame" // http://maven.apache.org/guides/mini/guide-naming-conventions.html | |
| 53 | archivesBaseName = "apptherm" | |
| 54 | ||
| 55 | minecraft {
| |
| 56 | version = config.minecraft_version + "-" + config.forge_version | |
| 57 | ||
| 58 | replace "@VERSION@", project.version | |
| 59 | replace "@AUTHOR@", config.author_name | |
| 60 | } | |
| 61 | ||
| 62 | processResources | |
| 63 | {
| |
| 64 | // replace stuff in mcmod.info, nothing else | |
| 65 | from(sourceSets.main.resources.srcDirs) {
| |
| 66 | include 'mcmod.info' | |
| 67 | ||
| 68 | expand 'version' : project.version, 'mcversion' : project.minecraft.version | |
| 69 | } | |
| 70 | ||
| 71 | // copy everything else, thats not the mcmod.info | |
| 72 | from(sourceSets.main.resources.srcDirs) {
| |
| 73 | exclude '**/*.lang' | |
| 74 | exclude '**/*.info' | |
| 75 | exclude '**/*.properties' | |
| 76 | } | |
| 77 | } | |
| 78 | ||
| 79 | task deobfJar(type: Jar) {
| |
| 80 | from sourceSets.main.output | |
| 81 | appendix = 'deobf' | |
| 82 | } | |
| 83 | ||
| 84 | // creates an API jar | |
| 85 | task apiJar(type: Jar) {
| |
| 86 | from(sourceSets.main.java) | |
| 87 | {
| |
| 88 | include "com/tgame/apptherm/api/*" | |
| 89 | } | |
| 90 | appendix = 'api' | |
| 91 | } | |
| 92 | ||
| 93 | artifacts {
| |
| 94 | archives deobfJar | |
| 95 | } | |
| 96 | ||
| 97 | // Used in my Private Build of Actual releases, increments the build number on build.properties, Unneeded in jenkins or any other CI. | |
| 98 | ||
| 99 | // task incrementBuildNumber() {
| |
| 100 | // dependsOn "reobf" | |
| 101 | // doLast {
| |
| 102 | // increment | |
| 103 | // config.build_number = (config.build_number.toString().toInteger()) + 1 | |
| 104 | ||
| 105 | // write back to the file | |
| 106 | // configFile.withWriter {
| |
| 107 | // config.toProperties().store(it, "") | |
| 108 | // } | |
| 109 | // } | |
| 110 | //} | |
| 111 | ||
| 112 | // tasks.build.dependsOn "incrementBuildNumber" |