-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
218 lines (156 loc) · 4.96 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
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.7"
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: "maven"
apply plugin: "com.matthewprenger.cursegradle"
apply plugin: 'net.minecraftforge.gradle.forge'
group = "org.epoxide.gybh"
archivesBaseName = "GYBH"
version = getVersionFromJava(file("src/main/java/org/epoxide/gybh/libs/Constants.java"))
sourceCompatibility = 1.8
targetCompatibility = 1.8
//Defines the MC environment information.
minecraft {
version = "${version_forge}"
mappings = "${version_mcp}"
runDir = "run"
useDepAts = true
}
repositories {
maven {
url = "http://maven.epoxide.org"
}
maven {
url "http://maven.tterrag.com/"
}
maven {
url "http://tehnut.info/maven"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
maven {
url "http://maven.blamejared.com"
}
}
dependencies {
deobfCompile "net.darkhax.bookshelf:Bookshelf:${version_bookshelf}"
deobfCompile "MineTweaker3:MineTweaker3-MC1102-Main:${version_crt}"
deobfCompile "mcp.mobius.waila:Hwyla:${version_hwyla}"
deobfCompile "mezz.jei:jei_1.10.2:${version_jei}"
deobfCompile "mcjty.theoneprobe:TheOneProbe:${version_top}"
}
//Handles basic resources such as mcmod.info
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
//Pulls the build version from a Java file.
String getVersionFromJava(File file) {
String release = "0";
String update = "0";
String patch = "0";
String build = System.getenv("BUILD_NUMBER") ? System.getenv("BUILD_NUMBER") : "0";
def outfile = "";
def ln = System.getProperty("line.separator")
String prefix = "public static final String VERSION = \"";
file.eachLine {
String s ->
String v = s.trim();
if (v.startsWith(prefix)) {
v = v.substring(prefix.length(), v.length() - 2);
String[] pts = v.split("\\.");
release = pts[0];
update = pts[1];
patch = pts[2];
s = s.replaceAll(".0\";", ".${build}\";");
}
outfile += (s + ln);
}
file.write(outfile);
return "1.10.2-$release.$update.$patch.$build";
}
//Creates the source jar.
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier = 'sources'
}
//Creates the JavaDoc jar.
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
//Creates the deobfuscated jar.
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = "deobf"
}
//Adds the deobf, source and javadoc jars to the build artifacts.
artifacts {
archives deobfJar
archives sourcesJar
archives javadocJar
}
//Uploads the artifacts to the maven server.
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///var/www/html/maven")
}
}
}
//Prevents incomplete JavaDocs from preventing a build on Java 8.
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
//Provides the basic CurseForge upload details
curseforge {
//Sets the API from the system environment, if available.
apiKey = System.getenv("curseForgeApiKey") ? System.getenv("curseForgeApiKey") : "0";
project {
//Sets the Project ID from the system environment, if available.
id = System.getenv("projectId") ? System.getenv("projectId") : "0";
releaseType = "alpha";
changelog = "All changes can be found here: https://github.com/Epoxide-Software/GYBH/commits/master";
addGameVersion "1.10.2"
//Adds main jar, deobf jar, source jar, and javadoc jar to the upload.
mainArtifact(jar) {
relations {
//Adds the file relations to the upload.
requiredLibrary 'bookshelf'
optionalLibrary 'waila'
optionalLibrary 'the-one-probe'
optionalLibrary 'just-enough-items-jei'
optionalLibrary 'minetweaker3'
}
}
addArtifact(deobfJar)
addArtifact(sourcesJar)
addArtifact(javadocJar)
}
}