Skip to content

Commit

Permalink
Update gradle setup
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewprenger committed Aug 19, 2014
1 parent 874e9ab commit 0e98927
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 75 deletions.
133 changes: 60 additions & 73 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' }
}

apply plugin: 'forge' // adds the forge dependency

// grab buildNumber
ext.buildnumber = 0 // this will be referenced as simply project.buildnumber from now on.
apply plugin: 'forge'
apply plugin: 'maven-publish'

if (System.getenv().BUILD_NUMBER)
project.buildnumber = System.getenv().BUILD_NUMBER
ext.buildnumber = 0
if (System.getenv('BUILD_NUMBER') != null)
project.buildnumber = System.getenv('BUILD_NUMBER')
else
logger.lifecycle "SETTING BUILDNUMBER TO 0"
logger.lifecycle "No build number detected, setting to 0"

version = "2.0_beta"
group= "com.enderio"
archivesBaseName = "enderio" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]
group = "com.enderio"
archivesBaseName = "EnderIO"
version = "${minecraft_version}-${mod_version}.${buildnumber}"

minecraft {
version = "1.7.10-10.13.0.1180"
if (project.hasProperty('mod_appendix'))
version += "_${project.mod_appendix}"

//assetDir = "run/assets" // the place for ForgeGradle to download the assets. The assets that the launcher gets and stuff
minecraft {
version = "${minecraft_version}-${forge_version}"
runDir = 'run'

// replacing stuff in the source
replace "@VERSION@", project.version
replaceIn "EnderIO.java"
}
Expand All @@ -44,90 +36,85 @@ configurations {
}

repositories {
mavenCentral()
maven {
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
mavenCentral()
maven { url "http://mobiusstrip.eu/maven" }
maven { url = "http://chickenbones.net/maven/" }
}

dependencies {
exportedCompile 'cglib:cglib-nodep:3.1'
exportedCompile "com.mod-buildcraft:buildcraft:${buildcraft_version}:api"

compile "mcp.mobius.waila:Waila:1.5.3_1.7.10"
// These will be included automatically
//compile "codechicken:NotEnoughItems:1.7.10-1.0.2.31:dev"
//compile "codechicken:CodeChickenLib:1.7.10-1.1.1.95:dev"
//compile "codechicken:CodeChickenCore:1.7.10-1.0.2.11:dev"

exportedCompile 'com.mod-buildcraft:buildcraft:6.0.17:api'
compile "mcp.mobius.waila:Waila:${waila_version}"
}

// configure the source folders
sourceSets {
main {
java {
srcDir 'src/main/java'
exclude '**/enderio/trigger/**'
// exclude 'some exclusion'
// include 'some inclusion'
exclude '**/enderio/trigger/**'
}
resources {
srcDir 'resources'
// exclude 'some exclusion'
// include 'some inclusion'
srcDir 'resources'
}
}
}

processResources
{
// this will ensure that this task is redone when the versions change.
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
// ${version} and ${mcversion} are the exact strings being replaced
expand 'version':project.version, 'mcversion':project.minecraft.version, 'buildnumber':project.buildnumber
include '**/*.info'
include '**/*.properties'

expand 'version': project.version, 'mcversion': project.minecraft.version, 'buildnumber': project.buildnumber
}

// copy everything else, that's not the mcmod.info

from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude '**/*.info'
exclude '**/*.properties'
}
}

// --------------------
// extra jar section
// -------------------

// for the benefit of the jars, we will now now add the buildnumber to the jars
project.version += '.' + project.buildnumber
jar {
from { configurations.exportedCompile.collect { it.isDirectory() ? it : zipTree(it) } }
}

// add a source jar
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}

// because the normal output has been made to be obfuscated
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
[javadocJar, javadoc]*.enabled = false; // TODO: Remove when javadocs are fixed

task deobfJar(type: Jar) {
from sourceSets.main.output
from { configurations.exportedCompile.collect { it.isDirectory() ? it : zipTree(it) } }
classifier = 'dev'
}

jar {
from { configurations.exportedCompile.collect { it.isDirectory() ? it : zipTree(it) } }
}
build.dependsOn sourceJar, deobfJar, javadocJar

publishing {
tasks.publish.dependsOn 'build'
publications {
mavenJava(MavenPublication) {
from components.java

// make sure all of these happen when we run build
build.dependsOn sourceJar, deobfJar
artifact sourceJar
// artifact javadocJar // TODO: Uncomment when javadocs are fixed
artifact deobfJar
}
}

repositories {
if (project.hasProperty('mavendir')) {
maven { url mavendir }
}
}
}
10 changes: 10 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
minecraft_version=1.7.10
forge_version=10.13.0.1180

mod_version=2.0

#Comment out this line to get rid of the appendix
mod_appendix=beta

buildcraft_version=6.0.17
waila_version=1.5.3_1.7.10
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 29 18:00:54 CDT 2013
#Tue Aug 19 17:12:51 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'EnderIO'

0 comments on commit 0e98927

Please sign in to comment.