forked from greatman/craftconomy3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
253 lines (222 loc) · 8.06 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
251
252
253
// Tasks to perform when no task is specified
defaultTasks 'clean', 'build', 'shadow'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.github.johnrengelman.shadow' // Provides dependency shading
apply plugin: 'license'
group = 'com.greatmancode'
version = '3.3.1-SNAPSHOT'
//archiveBaseName = "craftconomy3"
description = "Craftconomy3"
sourceCompatibility = 1.7
targetCompatibility = 1.7
ext.version = version;
//Variables for signing & other stuff
ext.url = 'https://github.com/greatman/craftconomy3'
ext.bukkitVersion = '1.7.9-R0.2'
ext."signing.keyId" = System.getenv("keyId")
ext."signing.secretKeyRingFile" = System.getenv("secretKeyRingFile")
ext."signing.password" = System.getenv("keyPassword")
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
if (ext.isReleaseVersion) {
apply plugin: 'signing'
signing {
required = { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
}
def gitDescribe() {
try {
// determine git-describe output
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--always', '--dirty=*'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (e) {
return "unknown"
}
}
def getVersionName() {
try {
// determine git-describe output
def version = gitDescribe()
// add on jenkins or travis build information
def jenkins_build = System.getenv("BUILD_NUMBER")
def travis_build = System.getenv("TRAVIS_BUILD_NUMBER")
if (jenkins_build != null) {
version += "-b" + jenkins_build
} else if (travis_build != null) {
version += "-trv" + travis_build
} else {
version += "-dev"
}
return version
} catch (e) {
return "unknown-version"
}
}
compileJava {
options.encoding = 'UTF-8'
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.1'
classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.12.1'
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://hub.spigotmc.org/nexus/content/groups/public/" }
maven { url "http://repo.visualillusionsent.net/repository/public/" }
maven { url "http://repo.larry1123.net/content/groups/public/" }
maven { url "https://libraries.minecraft.net" }
maven { url "http://repo.spongepowered.org/maven" }
maven { url "http://repo.mcstats.org/content/repositories/releases/" }
}
dependencies {
compile group: 'com.greatmancode', name: 'tools', version:'1.3-SNAPSHOT'
compile group: 'com.zaxxer', name: 'HikariCP', version:'2.4.3'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.12'
compile group: 'com.h2database', name: 'h2', version:'1.4.187'
compile group: 'org.xerial', name: 'sqlite-jdbc', version:'3.7.15-M1'
testCompile group: 'junit', name: 'junit', version:'4.11'
testCompile group: 'org.bukkit', name: 'bukkit', version:'1.8.3-R0.1-SNAPSHOT'
testCompile group: 'org.reflections', name: 'reflections', version:'0.9.9-RC1'
compile group: 'org.projectlombok', name: 'lombok', version:'1.12.6'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
}
shadowJar {
dependencies {
include(dependency('com.greatmancode:tools:1.3-SNAPSHOT'))
include(dependency('com.zaxxer:HikariCP:2.4.3'))
include(dependency('org.slf4j:slf4j-api:1.7.12'))
include(dependency('com.h2database:h2:1.4.187'))
include(dependency('com.googlecode.json-simple:json-simple:1.1'))
}
relocate 'com.greatmancode.tools', 'com.greatmancode.craftconomy3.tools'
relocate 'com.zaxxer.hikari', 'com.greatmancode.com.zaxxer.libs.hikari'
//relocate 'javassist', 'com.greatmancode.libs.javassist'
relocate 'org.slf4j', 'com.greatmancode.libs.org.slf4j'
//baseName = 'craftconomy3'
classifier = ''
}
task filter(type: Copy) {
from ('src/main/resources') {
exclude 'config.yml'
exclude 'loader.yml'
}
into 'build/resources/main'
def versionFinal = version + "-" + getVersionName()
expand(version: versionFinal)
}
jar.dependsOn filter
license {
header rootProject.file('HEADER.txt')
ext.copyright = 'Copyright (c) 2011-2016, Greatman'
ext.url = 'http://github.com/greatman'
ext.name = 'Craftconomy3'
}
// child script to publish to a maven repo
apply plugin: 'maven-publish'
apply plugin: 'maven'
// allow javadoc archive on Java 8 even if the javadoc isn't complete
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
// source jar
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
// javadoc jar
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives shadowJar, javadocJar, sourcesJar
}
uploadArchives {
repositories {
mavenDeployer {
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
if (ext.isReleaseVersion) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository( url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: System.getenv("sonatypeUsername"), password: System.getenv("sonatypePassword"))
}
snapshotRepository( url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: System.getenv("sonatypeUsername"), password: System.getenv("sonatypePassword"))
}
pom.project {
name 'Craftconomy3'
packaging 'jar'
description 'Economy plugin for multiple Minecraft server implementation.'
url 'https://github.com/greatman/craftconomy3'
scm {
connection 'https://github.com/greatman/craftconomy3.git'
developerConnection 'https://github.com/greatman/craftconomy3.git'
url 'https://github.com/greatman/craftconomy3'
}
licenses {
license {
name 'LGPL v3'
url 'https://www.gnu.org/licenses/lgpl.html'
}
}
developers {
developer {
id 'greatman'
name 'William Lebel'
email '[email protected]'
}
}
repositories {
repository {
id 'spigot-repo'
url 'https://hub.spigotmc.org/nexus/content/groups/public/'
}
repository {
id 'canary-repo'
url 'http://repo.visualillusionsent.net/repository/public/'
}
repository {
id 'larry-repo'
url 'http://repo.larry1123.net/content/groups/public/'
}
repository {
id 'minecraft-repo'
url 'https://libraries.minecraft.net'
}
repository {
id 'sponge-repo'
url 'http://repo.spongepowered.org/maven'
}
repository {
id 'metrics-repo'
url 'http://repo.mcstats.org/content/repositories/releases/'
}
}
}
}
}
}