This repository has been archived by the owner on Feb 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
161 lines (136 loc) · 4.29 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
/*
* Copyright (C) 2016-2020 David Rubio Escares / Kodehawa
*
* Mantaro is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Mantaro is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mantaro. If not, see http://www.gnu.org/licenses/
*/
import org.apache.tools.ant.filters.ReplaceTokens
//Plugins
plugins {
//Compiles Java
id 'java'
//Adds an Executable Manifest
id 'application'
//Creates FatJars
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
archivesBaseName = 'MantaroAPI'
group 'kodehawa'
def ver = new Version(major: 2, minor: 2, revision: 1)
version ver.toString()
sourceCompatibility = 17
targetCompatibility = 17
mainClassName = "net.kodehawa.mantaroapi.MantaroAPI"
def lint = [
"auxiliaryclass",
"cast",
"classfile",
"deprecation",
"dep-ann",
"divzero",
"empty",
"exports",
"fallthrough",
"finally",
"module",
"opens",
"options",
"overloads",
"overrides",
"path",
//removed because of "No processor claimed any of these annotations: ..."
//"processing",
"rawtypes",
"removal",
"requires-automatic",
"requires-transitive-automatic",
"serial",
"static",
"try",
"unchecked",
"varargs",
"preview"
]
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
options.encoding = 'UTF-8'
}
dependencies {
implementation 'com.sparkjava:spark-core:2.9.4'
implementation 'ch.qos.logback:logback-classic:1.2.11'
implementation ('com.github.adamint:patreon-java:417322b') { exclude group: 'org.slf4j' }
implementation group: 'org.json', name: 'json', version: '20220320'
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.15'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.1'
implementation group: 'redis.clients', name: 'jedis', version: '4.2.3'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.10.0'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
}
build.dependsOn shadowJar
artifacts {
archives shadowJar
}
def gitRevision() {
def gitVersion = new ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = gitVersion
}
return gitVersion.toString().trim()
}
task sourcesForRelease(type: Copy) {
from ('src/main/java') {
include '**/APIInfo.java'
filter(ReplaceTokens, tokens: [
version: ver.toString(),
revision: gitRevision().toString()
])
}
into 'build/filteredSrc'
includeEmptyDirs = false
}
task generateJavaSources(type: SourceTask) {
def javaSources = sourceSets.main.allJava.filter {
it.name != 'APIInfo.java'
}
source = javaSources + sourcesForRelease.destinationDir
dependsOn sourcesForRelease
}
compileJava {
source = generateJavaSources.source
classpath = sourceSets.main.compileClasspath
options.compilerArgs += ["-Xlint:${lint.join(",")}"]
dependsOn generateJavaSources
}
task cleanDistTar(type: Delete) { delete files(distTar) }
distTar { archiveClassifier.set("trash") }
distTar.finalizedBy cleanDistTar
task cleanDistZip(type: Delete) { delete files(distZip) }
distZip { archiveClassifier.set("trash") }
distZip.finalizedBy cleanDistZip
task cleanUnshadedJar(type: Delete) { delete files(jar) }
jar { archiveClassifier.set("trash") }
jar.finalizedBy cleanUnshadedJar
shadowJar {
archiveClassifier.set(null)
}
class Version {
String major, minor, revision
String toString() {
"${major}.${minor}.${revision}"
}
}