forked from ChachyDev/ForgeGradle
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.gradle
250 lines (210 loc) · 7.24 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
plugins {
id "java"
id "idea"
id "maven-publish"
id "com.gradle.plugin-publish" version "0.14.0"
// id "com.github.hierynomus.license" version "0.15.0"
}
group = 'net.minecraftforge.gradle'
version = '2.1'
archivesBaseName = 'ForgeGradle'
targetCompatibility = sourceCompatibility = 1.8
repositories {
mavenLocal()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
mavenCentral()
// because SS and its snapshot
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
// because of the GradleStart stuff
maven {
name = "mojang"
url = "https://libraries.minecraft.net/"
}
maven {
url "https://jitpack.io"
}
}
configurations {
deployerJars
shade
compileOnly.extendsFrom shade
}
// Required because Srg2Source depends on a snapshot of JDT that is no longer published on forge maven
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.eclipse.jdt' && details.requested.name == 'org.eclipse.jdt.core') {
details.useVersion '3.10.0'
}
}
}
dependencies {
implementation gradleApi()
// moved to the beginning to be the overrider
implementation 'org.ow2.asm:asm-debug-all:5.0.3'
implementation 'com.google.guava:guava:18.0'
implementation 'net.sf.opencsv:opencsv:2.3' // reading CSVs.. also used by SpecialSource
implementation 'com.cloudbees:diff4j:1.1' // for difing and patching
implementation 'com.github.abrarsyed.jastyle:jAstyle:1.3' // formatting
implementation 'net.sf.trove4j:trove4j:2.1.0' // because its awesome.
implementation 'com.github.jponge:lzma-java:1.3' // replaces the LZMA binary
implementation 'com.nothome:javaxdelta:2.0.1' // GDIFF implementation for BinPatches
implementation 'com.google.code.gson:gson:2.2.4' // Used instead of Argo for buuilding changelog.
implementation 'com.github.tony19:named-regexp:0.2.3' // 1.7 Named regexp features
implementation 'net.minecraftforge:fernflower:2.0-SNAPSHOT' // Fernflower Forge edition
shade 'net.md-5:SpecialSource:1.7.4' // deobf and reobs
// compile 'net.md-5:SpecialSource:1.7.4' // when md5 publishes
// because curse
implementation 'org.apache.httpcomponents:httpclient:4.3.3'
implementation 'org.apache.httpcomponents:httpmime:4.3.3'
// mcp stuff
shade 'de.oceanlabs.mcp:RetroGuard:3.6.6'
shade('de.oceanlabs.mcp:mcinjector:3.4-SNAPSHOT') {
exclude group: 'org.ow2.asm'
}
shade('net.minecraftforge.srg2source:Srg2Source:3.3-SNAPSHOT') {
exclude group: 'org.ow2.asm'
exclude group: 'org.eclipse.equinox', module: 'org.eclipse.equinox.common'
}
//Stuff used in the GradleStart classes
compileOnly 'com.mojang:authlib:1.5.16'
compileOnly "net.minecraft:launchwrapper:1.11"
testImplementation 'junit:junit:4.12'
}
sourceSets {
main.compileClasspath += configurations.shade
main.runtimeClasspath += configurations.shade
test.compileClasspath += configurations.shade
test.runtimeClasspath += configurations.shade
}
compileJava {
options.deprecation = true
//options.compilerArgs += ["-Werror"]
//options.compilerArgs += ["-Werror", "-Xlint:unchecked"]
}
processResources {
from(sourceSets.main.resources.srcDirs) {
include 'forgegradle.version.txt'
expand 'version': project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'forgegradle.version.txt'
}
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes 'version': project.version
attributes 'javaCompliance': project.targetCompatibility
attributes 'group': project.group
attributes 'Implementation-Version': project.version + getGitHash()
}
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
javadoc {
classpath += configurations.compileOnly
// linked javadoc urls.. why not...
options.addStringOption 'link', 'https://gradle.org/docs/7.0.0/javadoc/'
options.addStringOption 'link', 'https://guava.dev/releases/18.0/api/docs/'
options.addStringOption 'link', 'https://javadoc.io/doc/org.ow2.asm/asm/5.0.3/index.html'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc
}
artifacts {
archives jar
}
test {
if (project.hasProperty("filesmaven")) // disable this test when on the forge jenkins
exclude "**/ExtensionMcpMappingTest*"
}
//license {
// ext {
// description = 'A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.'
// year = '2021'
// fullname = 'MinecraftForge'
// }
// header rootProject.file('HEADER')
// include '**net/minecraftforge/gradle/**/*.java'
// excludes([
// '**net/minecraftforge/gradle/util/ZipFileTree.java',
// '**net/minecraftforge/gradle/util/json/version/*',
// '**net/minecraftforge/gradle/util/patching/Base64.java',
// '**net/minecraftforge/gradle/util/patching/ContextualPatch.java'
// ])
// ignoreFailures false
// strictCheck true
// mapping('java', 'SLASHSTAR_STYLE')
//}
pluginBundle {
website = 'https://github.com/asbyth/ForgeGradle'
vcsUrl = 'https://github.com/asbyth/ForgeGradle'
description = 'Gradle plugin for all Minecraft mod development needs'
tags = ['forge', 'minecraft', 'minecraftforge', 'sponge', 'mcp']
plugins {
patcher {
id = 'net.minecraftforge.gradle.patcher'
displayName = 'Minicraft Patcher Plugin'
}
tweakerClient {
id = 'net.minecraftforge.gradle.tweaker-client'
displayName = 'Mincraft Client Tweaker Plugin'
}
tweakerServer {
id = 'net.minecraftforge.gradle.tweaker-server'
displayName = 'Mincraft Server Tweaker Plugin'
}
forge {
id = 'net.minecraftforge.gradle.forge'
displayName = 'MincraftForge Mod Development Plugin'
}
launch4j {
id = 'net.minecraftforge.gradle.launch4j'
displayName = 'Specialized Launch4J Gradle Plugin'
}
}
}
// write out version so its convenient for doc deployment
file('build').mkdirs()
file('build/version.txt').text = version
static def getGitHash() {
def process = 'git rev-parse --short HEAD'.execute()
process.waitFor()
return '-' + (process.exitValue() ? 'unknown' : process.text.trim())
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
publishing {
repositories {
maven {
url = "$buildDir/repository"
}
}
publications {
//noinspection GroovyAssignabilityCheck
mavenJava(MavenPublication) {
from components.java
pom {
name = 'ForgeGradle'
url = 'https://github.com/asbyth/ForgeGradle'
developers {
developer {
id = 'forgegradle'
name = 'asbyth'
}
}
}
}
}
}