forked from GTNewHorizons/ForestryMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·263 lines (218 loc) · 5.81 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
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'
// https://github.com/ajoberstar/gradle-git
classpath 'org.ajoberstar:gradle-git:0.8.0'
}
}
apply plugin: 'forge'
apply plugin: 'maven'
apply plugin: 'java'
version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
if (project.hasProperty('buildQualifier')) {
version = project.version + '-' + project.buildQualifier
}
group= "net.sengir.forestry" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "forestry_" + mcversion
ext.dirDest = './build/dist'
ext.dirLang = "./lang"
ext.apiForestry = "./api/forestry"
ext.apiRedstoneFlux = "./api/redstoneflux"
// java version
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft {
version = mcversion + "-" + forgeversion
runDir = "run"
replace '@VERSION@', project.version
replace '@BUILD_NUMBER@', getBuildNumber()
srgExtra "PK: chylex/javacheck forestry/shade/javacheck"
}
sourceSets {
main {
java {
srcDir project.apiForestry
srcDir project.apiRedstoneFlux + "/src/main/java"
}
resources {
srcDir project.dirLang
}
}
}
repositories {
maven {
name = "ic2"
url = "http://maven.ic2.player.to/"
}
ivy {
name "BuildCraft"
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]"
}
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
maven{
name "tterrag Repo"
url "http://maven.tterrag.com/"
}
}
configurations {
api
compile.extendsFrom api
//shade
//compile.extendsFrom shade
}
dependencies {
api 'net.industrial-craft:industrialcraft-2:2.2.790-experimental:api'
api name: "buildcraft", version: "7.1.12", classifier: "api"
// http://files.minecraftforge.net/CodeChickenLib/
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
// http://chickenbones.net/maven
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.111:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.111:src"
// http://maven.tterrag.com/
//shade "chylex.javacheck:JavaChecker:v1.2-b1"
testCompile 'junit:junit:4.12'
}
processResources {
// this will ensure that this task is redone when the versions change.
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
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude '**/*.md'
}
}
runClient {
if (project.hasProperty('mcUsername')) {
args "--username=" + project.mcUsername
}
if (project.hasProperty('mcPassword')) {
args "--password=" + project.mcPassword
}
}
debugClient {
if (project.hasProperty('mcUsername')) {
args "--username=" + project.mcUsername
}
if (project.hasProperty('mcPassword')) {
args "--password=" + project.mcPassword
}
}
jar {
destinationDir = file("build/tmp")
archiveName = "main.jar"
// Copy various READMEs and Licensing files into the jar
into ('forestry/api') {
from project.apiForestry + "/LICENSE.txt"
}
into ('cofh/api') {
from project.apiRedstoneFlux + "/LICENSE - LGPLv3.txt"
}
into ('invtweaks/api') {
from "./src/main/java/invtweaks/LICENSE.txt"
}
//configurations.shade.each{ dep ->
// from(project.zipTree(dep)){
// exclude 'META-INF', 'META-INF/**', 'mcmod.info'
// }
//}
}
task mainJar(type: Jar, dependsOn: 'reobf') {
from (zipTree(jar.getArchivePath())) {
include '**'
exclude '**/codechicken/**'
exclude '**/uristqwerty/**'
}
destinationDir = file(dirDest)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
includeEmptyDirs = false
manifest{
//attributes 'TweakClass': 'forestry.shade.javacheck.Java7Checker'
}
}
task devJar(type: Jar, dependsOn: 'classes') {
from (sourceSets.main.output) {
exclude '**/codechicken/**'
exclude '**/uristqwerty/**'
}
destinationDir = file(dirDest)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
includeEmptyDirs = false
classifier = 'dev'
}
task apiJar(type: Jar, dependsOn: 'classes') {
from project.apiForestry
from(sourceSets.main.output) {
include 'forestry/api/**'
}
destinationDir = file(dirDest)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
includeEmptyDirs = false
classifier = 'api'
}
task sourceJar(type: Jar, dependsOn: 'classes') {
from (sourceSets.main.allSource) {
exclude '**/codechicken/**'
exclude '**/uristqwerty/**'
}
destinationDir = file(dirDest)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
includeEmptyDirs = false
classifier = 'sources'
}
task release (dependsOn: [mainJar, apiJar, devJar, sourceJar]) {
}
artifacts {
archives apiJar
archives devJar
archives sourceJar
}
uploadArchives {
repositories {
if (project.hasProperty('mavenDir')) {
mavenDeployer {
repository(url: "file://"+mavenDir)
addFilter('api') { artifact, file ->
file == apiJar.archivePath
}
addFilter('dev') { artifact, file ->
file == devJar.archivePath
}
addFilter('source') { artifact, file ->
file == sourceJar.archivePath
}
}
} else {
println 'Archives upload disabled, gradle.properties is missing.'
}
}
}
def getBuildNumber() {
return "$System.env.BUILD_NUMBER" != "null" ? "$System.env.BUILD_NUMBER" : "0"
}
sourceSets {
main { output.resourcesDir = output.classesDir }
}