forked from NucleusPowered/Nucleus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
178 lines (146 loc) · 4.93 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
plugins {
id 'idea'
id 'eclipse'
id 'com.github.hierynomus.license' version '0.12.1'
id 'ninja.miserable.blossom' version '1.0.1'
id 'maven'
id 'com.github.johnrengelman.shadow' version '1.2.3'
id 'java'
// id "com.qixalite.spongestart" version "1.4.3"
}
project.ext.versionno = '1.2.0'
project.ext.spongeapiversion = '7.0'
project.ext.suffix = '-SNAPSHOT'
allprojects {
apply plugin: 'java'
version = rootProject.versionno + rootProject.suffix + '-S' + rootProject.spongeapiversion
repositories {
jcenter()
maven {
name 'Sponge maven repo'
url 'http://repo.spongepowered.org/maven'
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
archiveName = "Nucleus-${version}-api-javadocs.jar"
}
}
description = 'The Ultimate Essentials Plugin.'
ext.url = 'http://nucleuspowered.org'
group 'io.github.nucleuspowered'
ext.spongeapi = '7.0.0-SNAPSHOT'
def qsmlDep = "uk.co.drnaylor:quickstart-moduleloader:0.8.1"
def geoIpDep = 'com.maxmind.geoip2:geoip2:2.8.0'
def neutrinoDep = 'io.github.nucleuspowered:neutrino:1.0.0'
defaultTasks 'licenseFormat build'
repositories {
jcenter()
maven {
name 'Sponge maven repo'
url 'http://repo.spongepowered.org/maven'
}
maven {
name 'drnaylor-minecraft'
url 'http://repo.drnaylor.co.uk/artifactory/list/minecraft'
}
maven {
name 'drnaylor'
url 'http://repo.drnaylor.co.uk/artifactory/list/quickstart'
}
maven {
url 'https://jitpack.io'
}
}
dependencies {
compile project(":nucleus-api", {
ext.versionno = versionno
ext.suffix = suffix
})
compile "org.spongepowered:spongeapi:" + project.ext.spongeapi
compile qsmlDep
compile neutrinoDep
// For Geo IP
compile geoIpDep
testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-all:1.10.19"
testCompile "org.powermock:powermock-module-junit4:1.6.4"
testCompile "org.powermock:powermock-api-mockito:1.6.4"
testCompile "org.hamcrest:hamcrest-junit:2.0.0.0"
}
license {
ext.name = project.name
exclude "**/*.info"
exclude "assets/**"
exclude "*.properties"
exclude "*.txt"
header file('HEADER.txt')
sourceSets = project.sourceSets
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
blossom {
def location = 'src/main/java/io/github/nucleuspowered/nucleus/PluginInfo.java'
replaceToken '@name@', project.name, location
replaceToken '@version@', project.version, location
replaceToken '@gitHash@', getGitHash(), location
replaceToken '@description@', project.description, location
replaceToken '@url@', project.url, location
}
jar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': version,
'SpongeAPI-Version': project.spongeapi,
'Git-Hash': getGitHash()
}
}
shadowJar {
dependencies {
include(project(":nucleus-api"))
include(dependency(qsmlDep))
include(dependency(geoIpDep))
include(dependency(neutrinoDep))
include(dependency("com.maxmind.db:maxmind-db"))
include(dependency("com.fasterxml.jackson.core:jackson-core"))
include(dependency("com.fasterxml.jackson.core:jackson-databind"))
include(dependency("com.fasterxml.jackson.core:jackson-annotations"))
include(dependency("io.github.lukehutch:fast-classpath-scanner"))
}
relocate 'com.maxmind.geoip2', 'io.github.nucleuspowered.relocate.com.maxmind.geoip2'
relocate 'com.maxmind.db', 'io.github.nucleuspowered.relocate.com.maxmind.db'
relocate 'com.fasterxml.jackson', 'io.github.nucleuspowered.relocate.com.fasterxml.jackson'
if (!project.hasProperty('norelocate')) {
relocate 'uk.co.drnaylor', 'io.github.nucleuspowered.relocate.uk.co.drnaylor'
relocate 'io.github.nucleuspowered.neutrino', 'io.github.nucleuspowered.relocate.nucleus.neutrino'
relocate 'io.github.lukehutch', 'io.github.nucleuspowered.relocate.io.github.lukehutch'
}
exclude "io/github/nucleuspowered/nucleus/api/NucleusAPIMod.class"
archiveName = "Nucleus-${version}-plugin.jar"
}
shadowJar.dependsOn([':nucleus-api:build'])
task cleanJars() {
project.file('output').listFiles().each {
x -> if (x.name.endsWith("jar")) { x.delete() }
}
}
task copyJars(type: Copy, dependsOn: ':nucleus-api:build') {
from([subprojects.jar, subprojects.javadocJar, shadowJar])
into project.file('output')
}
artifacts {
archives shadowJar
}
static String getGitHash() {
def process = 'git rev-parse --short HEAD'.execute()
process.waitFor()
return process.exitValue() ? 'unknown' : process.text.trim()
}
clean.dependsOn(cleanJars)
copyJars.mustRunAfter(cleanJars)
build.dependsOn(shadowJar)
build.dependsOn(copyJars)