Skip to content

Commit 0e98927

Browse files
author
matthewprenger
committed
Update gradle setup
1 parent 874e9ab commit 0e98927

File tree

5 files changed

+73
-75
lines changed

5 files changed

+73
-75
lines changed

build.gradle

Lines changed: 60 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,32 @@
11
buildscript {
22
repositories {
33
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.2-SNAPSHOT'
4+
maven { url = "http://files.minecraftforge.net/maven" }
5+
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
156
}
7+
dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' }
168
}
179

18-
apply plugin: 'forge' // adds the forge dependency
19-
20-
// grab buildNumber
21-
ext.buildnumber = 0 // this will be referenced as simply project.buildnumber from now on.
10+
apply plugin: 'forge'
11+
apply plugin: 'maven-publish'
2212

23-
if (System.getenv().BUILD_NUMBER)
24-
project.buildnumber = System.getenv().BUILD_NUMBER
13+
ext.buildnumber = 0
14+
if (System.getenv('BUILD_NUMBER') != null)
15+
project.buildnumber = System.getenv('BUILD_NUMBER')
2516
else
26-
logger.lifecycle "SETTING BUILDNUMBER TO 0"
17+
logger.lifecycle "No build number detected, setting to 0"
2718

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

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

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

37-
// replacing stuff in the source
3830
replace "@VERSION@", project.version
3931
replaceIn "EnderIO.java"
4032
}
@@ -44,90 +36,85 @@ configurations {
4436
}
4537

4638
repositories {
47-
mavenCentral()
48-
maven {
49-
name "Mobius Repo"
50-
url "http://mobiusstrip.eu/maven"
51-
}
52-
maven {
53-
name = "chickenbones"
54-
url = "http://chickenbones.net/maven/"
55-
}
39+
mavenCentral()
40+
maven { url "http://mobiusstrip.eu/maven" }
41+
maven { url = "http://chickenbones.net/maven/" }
5642
}
5743

5844
dependencies {
5945
exportedCompile 'cglib:cglib-nodep:3.1'
46+
exportedCompile "com.mod-buildcraft:buildcraft:${buildcraft_version}:api"
6047

61-
compile "mcp.mobius.waila:Waila:1.5.3_1.7.10"
62-
// These will be included automatically
63-
//compile "codechicken:NotEnoughItems:1.7.10-1.0.2.31:dev"
64-
//compile "codechicken:CodeChickenLib:1.7.10-1.1.1.95:dev"
65-
//compile "codechicken:CodeChickenCore:1.7.10-1.0.2.11:dev"
66-
67-
exportedCompile 'com.mod-buildcraft:buildcraft:6.0.17:api'
48+
compile "mcp.mobius.waila:Waila:${waila_version}"
6849
}
6950

70-
// configure the source folders
7151
sourceSets {
7252
main {
7353
java {
7454
srcDir 'src/main/java'
75-
exclude '**/enderio/trigger/**'
76-
// exclude 'some exclusion'
77-
// include 'some inclusion'
55+
exclude '**/enderio/trigger/**'
7856
}
7957
resources {
80-
srcDir 'resources'
81-
// exclude 'some exclusion'
82-
// include 'some inclusion'
58+
srcDir 'resources'
8359
}
8460
}
8561
}
8662

87-
processResources
88-
{
89-
// this will ensure that this task is redone when the versions change.
63+
processResources {
9064
inputs.property "version", project.version
9165
inputs.property "mcversion", project.minecraft.version
9266

93-
// replace stuff in mcmod.info, nothing else
9467
from(sourceSets.main.resources.srcDirs) {
95-
include 'mcmod.info'
96-
97-
// replace version and mcversion
98-
// ${version} and ${mcversion} are the exact strings being replaced
99-
expand 'version':project.version, 'mcversion':project.minecraft.version, 'buildnumber':project.buildnumber
68+
include '**/*.info'
69+
include '**/*.properties'
70+
71+
expand 'version': project.version, 'mcversion': project.minecraft.version, 'buildnumber': project.buildnumber
10072
}
101-
102-
// copy everything else, that's not the mcmod.info
73+
10374
from(sourceSets.main.resources.srcDirs) {
104-
exclude 'mcmod.info'
75+
exclude '**/*.info'
76+
exclude '**/*.properties'
10577
}
10678
}
10779

108-
// --------------------
109-
// extra jar section
110-
// -------------------
111-
112-
// for the benefit of the jars, we will now now add the buildnumber to the jars
113-
project.version += '.' + project.buildnumber
80+
jar {
81+
from { configurations.exportedCompile.collect { it.isDirectory() ? it : zipTree(it) } }
82+
}
11483

115-
// add a source jar
11684
task sourceJar(type: Jar) {
11785
from sourceSets.main.allSource
11886
classifier = 'sources'
11987
}
12088

121-
// because the normal output has been made to be obfuscated
89+
task javadocJar(type: Jar, dependsOn: javadoc) {
90+
from javadoc.destinationDir
91+
classifier = 'javadoc'
92+
}
93+
[javadocJar, javadoc]*.enabled = false; // TODO: Remove when javadocs are fixed
94+
12295
task deobfJar(type: Jar) {
12396
from sourceSets.main.output
12497
from { configurations.exportedCompile.collect { it.isDirectory() ? it : zipTree(it) } }
12598
classifier = 'dev'
12699
}
127100

128-
jar {
129-
from { configurations.exportedCompile.collect { it.isDirectory() ? it : zipTree(it) } }
130-
}
101+
build.dependsOn sourceJar, deobfJar, javadocJar
102+
103+
publishing {
104+
tasks.publish.dependsOn 'build'
105+
publications {
106+
mavenJava(MavenPublication) {
107+
from components.java
131108

132-
// make sure all of these happen when we run build
133-
build.dependsOn sourceJar, deobfJar
109+
artifact sourceJar
110+
// artifact javadocJar // TODO: Uncomment when javadocs are fixed
111+
artifact deobfJar
112+
}
113+
}
114+
115+
repositories {
116+
if (project.hasProperty('mavendir')) {
117+
maven { url mavendir }
118+
}
119+
}
120+
}

gradle.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
minecraft_version=1.7.10
2+
forge_version=10.13.0.1180
3+
4+
mod_version=2.0
5+
6+
#Comment out this line to get rid of the appendix
7+
mod_appendix=beta
8+
9+
buildcraft_version=6.0.17
10+
waila_version=1.5.3_1.7.10

gradle/wrapper/gradle-wrapper.jar

503 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Oct 29 18:00:54 CDT 2013
1+
#Tue Aug 19 17:12:51 CDT 2014
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'EnderIO'

0 commit comments

Comments
 (0)