-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.gradle
163 lines (137 loc) · 3.97 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
buildscript {
repositories {
jcenter()
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'minecrell'
url = 'http://repo.minecrell.net/releases'
}
}
dependencies {
classpath 'net.minecrell:VanillaGradle:2.0.3_1'
classpath 'org.javalite:activejdbc-gradle-plugin:1.4.13'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'org.javalite.activejdbc'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.minecrell.vanilla.server.library'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
defaultTasks 'clean', 'build'
def getProjectVersion = {
return 'git describe --abbrev=0 --tags'.execute().text.trim().substring(1) // drop the 'v' prefix
}
def getProjectGitHash = {
return 'git rev-parse --short HEAD'.execute().text.trim()
}
def getProjectReleaseDate = {
// noinspection UnnecessaryQualifiedReference
return new java.util.Date(Long.valueOf('git show -s --format=%ct'.execute().text.trim()) * 1000)
}
repositories {
jcenter()
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
maven {
name = 'jitpack'
url = 'https://jitpack.io'
}
}
version = getProjectVersion()
group = 'com.github.ustc_zzzz'
archivesBaseName = 'VirtualChest'
minecraft {
version = '1.12.2'
mappings = 'snapshot_20171003'
replace '@version@', project.version
replace '@git_hash@', getProjectGitHash()
replace '@release_date@', getProjectReleaseDate().with {
// noinspection UnnecessaryQualifiedReference
def format = new java.text.SimpleDateFormat('yyyy-MM-dd', Locale.ENGLISH) // RFC 3339
format.setTimeZone(TimeZone.getTimeZone('GMT+08:00')) // the author comes from China
return format.format(it)
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:all' // << '-Werror'
}
task apiJar(type: Jar, dependsOn: sourceJar) {
baseName = 'VirtualChestAPI'
from sourceSets.api.allSource
from sourceSets.api.output
from 'LICENSE'
}
artifacts {
archives apiJar
archives shadowJar
archives sourceJar
}
dependencies {
compile 'org.javalite:activejdbc:1.4.13'
compile 'org.spongepowered:spongeapi:7.2.0'
compile 'org.spongepowered:spongecommon:1.12.2-7.2.0:dev'
compile 'com.github.ronaldburns:PlaceholderAPI:4.5.1'
compile 'com.github.randombyte-developer:byte-items:v2.4.1'
}
sourceSets {
main {
java.srcDir 'src/'
java.srcDir 'api/'
resources.srcDir 'resources/'
}
api {
java.srcDir 'api/'
}
}
publishing {
publications {
maven(MavenPublication).artifact apiJar
maven(MavenPublication).artifactId 'VirtualChestAPI'
}
}
bintray {
user = 'zzzz'
publications = ['maven']
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
pkg {
repo = 'VirtualChest'
licenses = ['LGPL-3.0']
name = 'VirtualChestAPI'
vcsUrl = 'https://github.com/ustc-zzzz/VirtualChest.git'
version {
name = project.version
vcsTag = 'v' + project.version
released = getProjectReleaseDate()
desc = 'VirtualChestAPI v' + project.version
}
}
}
jar {
classifier = 'pure'
}
shadowJar {
minimize()
classifier = null
dependencies {
it.include it.dependency('org.javalite:.*')
}
relocate 'org.javalite', project.group.toString() + '.virtualchest.util.repackage.org.javalite'
}
reobf {
jar {
mappingType = 'SEARGE'
}
}
reobfJar.dependsOn shadowJar