forked from SpongePowered/SpongeForge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
245 lines (215 loc) · 6.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
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
// Gradle repositories and dependencies
buildscript {
repositories {
mavenCentral()
maven {
name = 'sonatype-nexus-public'
url = 'https://oss.sonatype.org/content/repositories/public/'
}
maven {
name = 'forge-repo'
url = 'http://files.minecraftforge.net/maven/'
}
jcenter()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
}
}
// for multiproject fun
evaluationDependsOn('Mixin')
evaluationDependsOn('SpongeAPI')
// Default tasks
defaultTasks 'build', 'licenseFormat'
// Apply plugin
apply plugin: 'forge'
apply plugin: 'license'
apply plugin: 'maven'
apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow'
// Basic project information
group = 'org.spongepowered'
archivesBaseName = 'sponge'
// Version -> Minecraft-MinecraftForge-Ours(If any?)
version = '1.8-11.14.0.1273-SNAPSHOT'
// Define variables
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
// Minimum version of Java required
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
repositories {
mavenCentral()
maven {
name = 'sonatype-nexus'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
// MinecraftForge version
minecraft {
version = "1.8-11.14.0.1273-1.8"
}
configurations {
deployerJars // maven deployment
}
// Project dependencies
dependencies {
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.0-beta9'
compile 'com.google.inject:guice:4.0-beta5'
compile project('Mixin')
compile project('SpongeAPI')
testCompile 'junit:junit:4.11'
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.7'
}
shadowJar {
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
dependencies {
include(dependency('org.slf4j:slf4j-api'))
include(dependency('org.apache.logging.log4j:log4j-slf4j-impl'))
include(dependency('com.google.inject:guice'))
}
classifier = ''
}
build.dependsOn(shadowJar)
// Filter, process, and include resources
processResources {
inputs.property "version", version
inputs.property "mcversion", project.minecraft.version
// Include in final JAR
from 'LICENSE.txt'
// Replace variables
from('src/main/resources/mcmod.info') {
expand 'modid': project.name.toLowerCase(),
'name': project.name,
'description': project.description,
'version': version,
'buildNumber': buildNumber,
'mcversion': minecraft.version,
'url': url,
'authorList': organization
}
}
// License header formatting
license {
ext.name = project.name
ext.organization = project.organization
ext.url = project.url
ext.year = project.inceptionYear
exclude "**/*.info"
exclude "**/*.json"
exclude "**/*_at.cfg"
exclude "assets/**"
header new File(project("SpongeAPI").getProjectDir(), "HEADER.txt")
sourceSets = project.sourceSets
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
checkstyle {
configProperties = [
"name" : project.name,
"organization" : project.organization,
"url" : project.url,
"year" : project.inceptionYear
]
configFile = new File(project("SpongeAPI").getProjectDir(),"checkstyle.xml")
}
tasks.reobf.dependsOn "check"
// Source compiler configuration
tasks.withType(JavaCompile) {
options.compilerArgs += [ '-Xlint:all', '-Xlint:-path' ]
options.deprecation = true
options.encoding = 'utf8'
}
def manifestEntries = [
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": name,
"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
"Implementation-Vendor": url,
"FMLCorePlugin": "org.spongepowered.mod.SpongeCoremod"
]
jar {
// Jar shading and packaging configuration
from { project("Mixin").sourceSets.main.output }
from { project("SpongeAPI").sourceSets.main.output }
// JAR manifest configuration
manifest.mainAttributes(manifestEntries)
// classifier
classifier = 'release'
}
task deobfJar(type: Jar) {
from { project("Mixin").sourceSets.main.output }
from { project("SpongeAPI").sourceSets.main.output }
from sourceSets.main.output
}
task sourceJar(type: Jar, dependsOn: sourceMainJava) {
from "build/sources/java"
from "build/resources/main/java"
from project("Mixin").sourceSets.main.java
from project("Mixin").sourceSets.main.resources
from project("SpongeAPI").sourceSets.main.java
from project("SpongeAPI").sourceSets.main.resources
classifier = "sources"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
from project("Mixin").tasks.javadoc.destinationDir
from project("SpongeAPI").tasks.javadoc.destinationDir
classifier = "javadoc"
dependsOn "Mixin:javadoc"
dependsOn "SpongeAPI:javadoc"
}
artifacts {
archives deobfJar
archives sourceJar
archives javadocJar
}
uploadArchives {
dependsOn reobf
repositories {
mavenDeployer {
configuration = configurations.deployerJars
if (project.hasProperty("chRepo"))
{
repository(url: project.chRepo) {
authentication(userName: project.chUsername, password: project.chPassword)
}
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Sponge'
url 'http://www.spongepowered.org/'
scm {
url 'https://github.com/SpongePowered/SpongeAPI'
connection 'scm:git:git://github.com/SpongePowered/Sponge.git'
developerConnection 'scm:git:[email protected]:SpongePowered/Sponge.git'
}
issueManagement {
system 'youtrack'
url 'https://issues.spongepowered.org/'
}
licenses {
license {
name 'MIT license'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
}
}
}
}
}