1
1
buildscript {
2
2
repositories {
3
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.2-SNAPSHOT'
4
+ maven { url = " http://files.minecraftforge.net/maven" }
5
+ maven { url = " https://oss.sonatype.org/content/repositories/snapshots/" }
15
6
}
7
+ dependencies { classpath ' net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' }
16
8
}
17
9
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'
22
12
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' )
25
16
else
26
- logger. lifecycle " SETTING BUILDNUMBER TO 0"
17
+ logger. lifecycle " No build number detected, setting to 0"
27
18
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 } "
31
22
32
- minecraft {
33
- version = " 1.7.10-10.13.0.1180 "
23
+ if (project . hasProperty( ' mod_appendix ' ))
24
+ version + = " _ ${ project.mod_appendix } "
34
25
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'
36
29
37
- // replacing stuff in the source
38
30
replace " @VERSION@" , project. version
39
31
replaceIn " EnderIO.java"
40
32
}
@@ -44,90 +36,85 @@ configurations {
44
36
}
45
37
46
38
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/" }
56
42
}
57
43
58
44
dependencies {
59
45
exportedCompile ' cglib:cglib-nodep:3.1'
46
+ exportedCompile " com.mod-buildcraft:buildcraft:${ buildcraft_version} :api"
60
47
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} "
68
49
}
69
50
70
- // configure the source folders
71
51
sourceSets {
72
52
main {
73
53
java {
74
54
srcDir ' src/main/java'
75
- exclude ' **/enderio/trigger/**'
76
- // exclude 'some exclusion'
77
- // include 'some inclusion'
55
+ exclude ' **/enderio/trigger/**'
78
56
}
79
57
resources {
80
- srcDir ' resources'
81
- // exclude 'some exclusion'
82
- // include 'some inclusion'
58
+ srcDir ' resources'
83
59
}
84
60
}
85
61
}
86
62
87
- processResources
88
- {
89
- // this will ensure that this task is redone when the versions change.
63
+ processResources {
90
64
inputs. property " version" , project. version
91
65
inputs. property " mcversion" , project. minecraft. version
92
66
93
- // replace stuff in mcmod.info, nothing else
94
67
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
100
72
}
101
-
102
- // copy everything else, that's not the mcmod.info
73
+
103
74
from(sourceSets. main. resources. srcDirs) {
104
- exclude ' mcmod.info'
75
+ exclude ' **/*.info'
76
+ exclude ' **/*.properties'
105
77
}
106
78
}
107
79
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
+ }
114
83
115
- // add a source jar
116
84
task sourceJar (type : Jar ) {
117
85
from sourceSets. main. allSource
118
86
classifier = ' sources'
119
87
}
120
88
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
+
122
95
task deobfJar (type : Jar ) {
123
96
from sourceSets. main. output
124
97
from { configurations. exportedCompile. collect { it. isDirectory() ? it : zipTree(it) } }
125
98
classifier = ' dev'
126
99
}
127
100
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
131
108
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
+ }
0 commit comments