-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.gradle
More file actions
141 lines (124 loc) · 4.28 KB
/
build.gradle
File metadata and controls
141 lines (124 loc) · 4.28 KB
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
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'de.undercouch:gradle-download-task:3.2.0'
}
}
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://repo1.maven.org/maven2/"
}
}
apply plugin: 'java'
apply plugin: 'de.undercouch.download'
import de.undercouch.gradle.tasks.download.Download
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
def versionObj = new Version(major: 1, minor: 1, revision: 0)
dependencies {
compile 'org.pircbotx:pircbotx:2.1'
compile fileTree(dir: 'lib', includes: ['*.jar'])
compile 'org.unix4j:unix4j-command:0.4'
compile 'org.reflections:reflections:0.10.2'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'org.apache.commons:commons-compress:1.16.1'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile 'com.google.code.gson:gson:2.1'
compile 'xstream:xstream:1.2.2'
compile 'net.objecthunter:exp4j:0.4.0.ALPHA-3'
compile 'com.google.api-client:google-api-client:1.18.0-rc'
compile 'org.xerial:sqlite-jdbc:3.23.1'
compile 'org.twitter4j:twitter4j-core:4.0.3'
// https://mvnrepository.com/artifact/joda-time/joda-time
compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-core
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.1.7'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
compile 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'
compile 'com.sangupta:imgur-client:0.2.0'
compile 'com.github.kevinsawicki:timeago:1.0.1'
compile 'io.github.firemaples:microsoft-translator-java-api:0.8.3'
compile 'com.maxmind.geoip2:geoip2:2.11.0'
compile 'mysql:mysql-connector-java:8.0.13'
compile group: 'net.java.dev.inflector', name: 'inflector', version: '0.7.0'
implementation 'org.jetbrains:annotations:15.0'
}
version = "${versionObj.toString()}"
sourceCompatibility = 1.8
targetCompatibility = 1.8
if (System.getenv().BUILD_NUMBER != null)
ext.buildNumber = System.getenv().BUILD_NUMBER?.toInteger()
else
ext.buildNumber = 0
archivesBaseName = "LanteaBot"
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") : "0"
}
String toString() {
"${getMajor()}.${getMinor()}.${getRevision()}"
}
}
def filteredSourceDir = file("${buildDir}/filtered")
sourceSets {
// This source set will contain all sources that we filter
filtered {
java {
srcDirs = [
filteredSourceDir,
]
}
}
}
// copy the main sources and filter any '@buildVersion@' occurences.
task processVersion (type: Copy) {
filteringCharset = 'UTF-8'
from sourceSets.main.java
into filteredSourceDir
filter(ReplaceTokens, tokens: [
versionMajor: versionObj.getMajor(),
versionMinor: versionObj.getMinor(),
versionRevision: versionObj.getRevision(),
versionBuild: versionObj.getBuild()
])
println versionObj.getBuild()
}
task downloadMultipleFiles(type: Download) {
src([
'https://raw.githubusercontent.com/Vexatos/Selene/master/selene/lib/selene/init.lua',
'https://raw.githubusercontent.com/Vexatos/Selene/master/selene/lib/selene/parser.lua'
])
dest "src/main/resources/jnlua/selene"
}
processVersion.dependsOn downloadMultipleFiles
// tell the compileJava task to compile the filtered source
compileJava.source = sourceSets.filtered.java
compileJava.dependsOn processVersion
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes 'Implementation-Version': version
attributes 'Main-Class': 'AppStub'
}
}