-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
121 lines (101 loc) · 2.86 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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
def versionObj = new Version(major: 1, minor: 5, revision: 0)
group = 'net.dv8tion'
archivesBaseName = 'Yui'
mainClassName = 'net.dv8tion.discord.Yui'
version = "${versionObj.toString()}"
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
def filteredSourceDir = file("${buildDir}/filtered")
sourceSets {
// This source set will contain all sources that we filter
filtered {
java {
srcDirs = [
filteredSourceDir,
'src/test/java',
]
}
}
}
// copy the main sources and filter any '@buildVersion@' occurrences.
task processVersion (type: Copy) {
from sourceSets.main.java
into filteredSourceDir
filter(ReplaceTokens, tokens: [
versionMajor: versionObj.getMajor(),
versionMinor: versionObj.getMinor(),
versionRevision: versionObj.getRevision(),
versionBuild: versionObj.getBuild()
])
}
jar {
baseName = project.name
manifest {
attributes 'Implementation-Version': version
attributes 'Main-Class': 'net.dv8tion.discord.Yui'
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.filtered.java
}
task instrument(type: JavaExec) {
main = 'com.ea.async.instrumentation.Main'
classpath = sourceSets.main.compileClasspath
args "$buildDir"
}
artifacts {
archives javadocJar, sourcesJar
}
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
shadowJar {
archiveFileName = "Yui-${version}-withDependencies.jar"
}
dependencies {
implementation 'net.dv8tion:JDA:4.4.1_353'
implementation 'com.github.walkyst:lavaplayer-fork:0727f9792c'
implementation 'net.lingala.zip4j:zip4j:1.3.2'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'org.xerial:sqlite-jdbc:3.20.0'
implementation 'org.pircbotx:pircbotx:2.1'
implementation 'commons-io:commons-io:2.5'
implementation 'org.json:json:20180813'
implementation 'com.ea.async:ea-async:1.2.3'
}
class Version {
int major, minor, revision
String getMajor() {
"${major}"
}
String getMinor() {
"${minor}"
}
String getRevision() {
"${revision}"
}
String getBuild() {
System.getenv('BUILD_NUMBER') ? System.getenv('BUILD_NUMBER') : 'DEV'
}
String toString() {
"${getMajor()}.${getMinor()}.${getRevision()}_${getBuild()}"
}
}
// tell the compileJava task to compile the filtered source
compileJava.source = sourceSets.filtered.java
compileJava.dependsOn processVersion
//Creates the w/ dependencies jar.
assemble.dependsOn shadowJar