This repository has been archived by the owner on Jun 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle.kts
149 lines (128 loc) · 4.58 KB
/
build.gradle.kts
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
/*
* Votebot - A feature-rich bot to create votes on Discord guilds.
*
* Copyright (C) 2019 Michael Rittmeister & Yannick Seeger & Daniel Scherf
*
* This program 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.
*
* This program 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 this program. If not, see https://www.gnu.org/licenses/.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
pmd
checkstyle
id("com.github.spotbugs") version "2.0.0"
id("com.github.johnrengelman.shadow") version "5.1.0"
id("io.gitlab.arturbosch.detekt") version "1.0.1"
java
application
kotlin("jvm") version "1.3.50"
}
group = "wtf.votebot"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation("com.google.flogger", "flogger", "0.4")
implementation("com.google.flogger", "flogger-system-backend", "0.4")
runtime("com.google.flogger", "flogger-slf4j-backend", "0.4")
implementation("ch.qos.logback", "logback-classic", "1.2.3")
implementation("com.google.inject", "guice", "4.1.0")
implementation("dev.misfitlabs.kotlinguice4", "kotlin-guice", "1.4.0")
implementation("com.orbitz.consul", "consul-client", "1.3.7")
implementation("com.bettercloud", "vault-java-driver", "5.0.0")
implementation("com.configcat", "configcat-java-client", "1.2.0")
implementation("commons-cli", "commons-cli", "1.4")
implementation("com.discord4j", "discord4j-core", "3.0.9")
implementation("io.sentry", "sentry", "1.7.27")
implementation("io.sentry", "sentry-logback", "1.7.27")
implementation("io.github.cdimascio", "java-dotenv", "5.1.1")
implementation("io.ktor:ktor-server-netty:1.2.3")
implementation("io.prometheus", "simpleclient", "0.6.0")
implementation("io.prometheus", "simpleclient_httpserver", "0.6.0")
detektPlugins("io.gitlab.arturbosch.detekt", "detekt-formatting", "1.0.1")
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
testCompile("junit", "junit", "4.12")
}
tasks {
val replaceTokens = task<Copy>("replaceTokens") {
from("src/main/java") {
include("**/ApplicationInfo.java")
val tokens = mapOf(
"releaseVersion" to (project.version as? String ?: "UnknownVersion")
)
filter<ReplaceTokens>(mapOf("tokens" to tokens))
}
into("build/filteredSrc")
includeEmptyDirs = false
}
val replaceTokensInSource = task<SourceTask>("replaceTokensInSource") {
val javaSources = sourceSets["main"].allJava.filter {
it.name != "ApplicationInfo.java"
}
.asFileTree
source = javaSources + fileTree(replaceTokens.destinationDir)
dependsOn(replaceTokens)
}
compileJava {
source = replaceTokensInSource.source
dependsOn(replaceTokensInSource)
}
"shadowJar"(ShadowJar::class) {
archiveFileName.set("bot.jar")
// archiveBaseName.set("shadow")
//archiveVersion.set(project.version as? String ?: "UnknownVersion")
}
checkstyle {
checkstyleTest.get().enabled = false
}
checkstyleMain {
configFile = file("$rootDir/config/checkstyle/google_checks.xml")
configProperties = mapOf("config_loc" to "${rootProject.projectDir}/config/checkstyle")
}
spotbugs {
toolVersion = "4.0.0-beta1"
isIgnoreFailures = true
}
spotbugsMain {
reports {
html.isEnabled = true
xml.isEnabled = false
}
}
pmd {
pmdTest.get().enabled = false
}
pmdMain {
ignoreFailures = true
ruleSetConfig =
resources.text.fromFile(file("${rootProject.projectDir}/config/pmd/ruleset.xml"))
}
}
detekt {
input = files("src/main/kotlin")
autoCorrect = true
}
application {
mainClassName = "wtf.votebot.bot.LauncherKt"
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_12
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "12"
}