forked from MinecraftForge/ForgeGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
263 lines (224 loc) · 8.06 KB
/
build.gradle
File metadata and controls
263 lines (224 loc) · 8.06 KB
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
263
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven'
project.ext {
GIT_INFO = gitInfo(rootProject.file('.'))
}
group = 'net.minecraftforge.gradle'
//version = "${project.ext.GIT_INFO.tag}.${project.ext.GIT_INFO.offset}"
//TODO fix stub version as 1.2.4 forge now for dependency management purposes
version = '1.2.4'
archivesBaseName = 'ForgeGradle'
targetCompatibility = '1.6'
sourceCompatibility = '1.6'
repositories {
mavenLocal()
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
// because Srg2Source needs an eclipse dependency.
name = "eclipse"
url = "https://repo.eclipse.org/content/groups/eclipse/"
}
maven {
name = "central"
url = "https://repo1.maven.org/maven2"
}
maven {
name = "mojang"
url = "https://libraries.minecraft.net/"
}
}
configurations {
deployerJars
shade
compileOnly.extendsFrom shade
}
dependencies {
compile gradleApi()
// moved to the beginning to be the overrider
compile 'org.ow2.asm:asm-debug-all:5.0.3'
compile 'com.google.guava:guava:18.0'
compile 'net.sf.opencsv:opencsv:2.3' // reading CSVs.. also used by SpecialSource
compile 'com.cloudbees:diff4j:1.1' // for difing and patching
compile 'com.github.abrarsyed.jastyle:jAstyle:1.2' // formatting
compile 'net.sf.trove4j:trove4j:2.1.0' // because its awesome.
compile 'com.github.jponge:lzma-java:1.3' // replaces the LZMA binary
compile 'com.nothome:javaxdelta:2.0.1' // GDIFF implementation for BinPatches
compile 'com.google.code.gson:gson:2.2.4' // Used instead of Argo for buuilding changelog.
compile 'com.github.tony19:named-regexp:0.2.3' // 1.7 Named regexp features
compile 'net.md-5:SpecialSource:1.7.3' // deobf and reobs
// because curse
compile 'org.apache.httpcomponents:httpclient:4.3.3'
compile 'org.apache.httpcomponents:httpmime:4.3.3'
// mcp stuff
compile 'de.oceanlabs.mcp:RetroGuard:3.6.6'
compile 'de.oceanlabs.mcp:mcinjector:3.2-SNAPSHOT'
shade 'net.minecraftforge.srg2source:Srg2Source:3.2-SNAPSHOT'
// The old version used by S2S is gone, so we need to force the latest build of that minor release
shade('org.eclipse.jdt:org.eclipse.jdt.core:3.10.0.v20140604-1726') {
force = true
}
// stupid maven
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
//Stuff used in the GradleStart classes
compileOnly 'com.mojang:authlib:1.5.16'
compileOnly "net.minecraft:launchwrapper:1.11"
// Google FindBugs JSR305
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
}
compileJava {
options.deprecation = true
//options.compilerArgs += ["-Werror", "-Xlint:unchecked"]
}
javadoc {
classpath += configurations.compileOnly
// linked javadoc urls.. why not...
options.addStringOption 'link', 'https://gradle.org/docs/current/javadoc/'
options.addStringOption 'link', 'http://docs.guava-libraries.googlecode.com/git-history/v18.0/javadoc'
options.addStringOption 'link', 'http://asm.ow2.org/asm50/javadoc/user/'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc
classifier = "javadoc"
}
artifacts {
archives jar
archives javadocJar
}
//These should add a compile time only dependancies to eclipse, ide, and javac, but NOT to the generated POM on maven.
sourceSets {
main.compileClasspath += configurations.shade;
main.runtimeClasspath += configurations.shade;
test.compileClasspath += configurations.shade;
test.runtimeClasspath += configurations.shade;
}
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)){
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes 'version':project.version, 'javaCompliance': project.targetCompatibility
attributes 'group':project.group
attributes 'Implementation-Version': project.version + "-" + GIT_INFO.hash
}
}
test {
// These tests are outdated, and I can't be arsed to fix them
exclude "*"
// if (project.hasProperty("filesmaven")) // disable this test when on the forge jenkins
// {
// exclude "**/ExtensionMcpMappingTest*"
// exclude "**/ExtensionForgeVersionTest*"
// }
}
uploadArchives {
repositories.mavenDeployer {
dependsOn 'build'
if (System.env.MAVEN_USER)
{
repository(url: "https://maven.minecraftforge.net/") {
authentication(userName: System.env.MAVEN_USER, password: System.env.MAVEN_PASSWORD)
}
}
else
{
// local repo folder. Might wanna juset use gradle install if you wanans end it to maven-local
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Gradle plugin for Forge'
url 'https://github.com/MinecraftForge/ForgeGradle'
scm {
url 'https://github.com/MinecraftForge/ForgeGradle'
connection 'scm:git:git://github.com/MinecraftForge/ForgeGradle.git'
developerConnection 'scm:git:git@github.com:MinecraftForge/ForgeGradle.git'
}
issueManagement {
system 'github'
url 'https://github.com/MinecraftForge/ForgeGradle/issues'
}
licenses {
license {
name 'Lesser GNU Public License, Version 2.1'
url 'https://www.gnu.org/licenses/lgpl-2.1.html'
distribution 'repo'
}
}
developers {
developer {
id 'AbrarSyed'
name 'Abrar Syed'
roles { role 'developer' }
}
developer {
id 'LexManos'
name 'Lex Manos'
roles { role 'developer' }
}
}
}
}
}
}
// write out version so its convenient for doc deployment
file('build').mkdirs()
file('build/version.txt').text = version;
def gitInfo(dir) {
String.metaClass.rsplit = { String del, int limit = -1 ->
def lst = new ArrayList()
def x = 0, idx
def tmp = delegate
while ((idx = tmp.lastIndexOf(del)) != -1 && (limit == -1 || x++ < limit)) {
lst.add(0, tmp.substring(idx + del.length(), tmp.length()))
tmp = tmp.substring(0, idx)
}
lst.add(0, tmp)
return lst
}
def git = null
try {
git = org.eclipse.jgit.api.Git.open(dir)
} catch (org.eclipse.jgit.errors.RepositoryNotFoundException e) {
return [
tag: '0.0',
offset: '0',
hash: '00000000',
branch: 'master',
commit: '0000000000000000000000',
abbreviatedId: '00000000'
]
}
def desc = git.describe().setLong(true).setTags(true).call().rsplit('-', 2)
def head = git.repository.exactRef('HEAD')
def longBranch = head.symbolic ? head?.target?.name : null // matches Repository.getFullBranch() but returning null when on a detached HEAD
def ret = [:]
ret.tag = desc[0]
ret.offset = desc[1]
ret.hash = desc[2]
ret.branch = longBranch != null ? org.eclipse.jgit.lib.Repository.shortenRefName(longBranch) : null
ret.commit = org.eclipse.jgit.lib.ObjectId.toString(head.objectId)
ret.abbreviatedId = head.objectId.abbreviate(8).name()
return ret
}