This repository has been archived by the owner on Sep 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
118 lines (94 loc) · 2.73 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
plugins {
`java-library`
pmd
checkstyle
id("com.github.spotbugs") version "1.7.1"
}
group = "com.github.stupremee"
version = "1.0.0"
subprojects {
apply(plugin = "java-library")
apply(plugin = "pmd")
apply(plugin = "checkstyle")
apply(plugin = "com.github.spotbugs")
group = "com.github.stupremee"
version = "1.0.0"
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile("com.discord4j:discord4j-core:3.0.6")
compile("com.google.inject:guice:4.2.2")
compile("com.google.guava:guava:27.1-jre")
testCompile("org.junit.jupiter:junit-jupiter-api:5.3.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1")
testCompile("org.assertj:assertj-core:3.11.1")
spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0")
}
tasks {
val sourceSets: SourceSetContainer by project
val sourcesJar by registering(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val javadocJar by registering(Jar::class) {
dependsOn(JavaPlugin.JAVADOC_TASK_NAME)
archiveClassifier.set("javadoc")
from(javadoc)
}
val fatJar by registering(Jar::class) {
dependsOn(jar)
archiveClassifier.set("shaded")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get()
.onEach { println("Add from dependencies: ${it.name}") }
.map { if (it.isDirectory) it else zipTree(it) })
val sourcesMain = sourceSets.main.get()
sourcesMain.allSource.forEach { println("Add from sources: ${it.name}") }
from(sourcesMain.output)
}
artifacts {
add("archives", javadocJar)
add("archives", sourcesJar)
}
build {
dependsOn(jar)
dependsOn(sourcesJar)
dependsOn(javadocJar)
jar.get().mustRunAfter(clean)
sourcesJar.get().mustRunAfter(jar)
}
test {
useJUnitPlatform()
}
checkstyle {
checkstyleTest.get().enabled = false
toolVersion = "8.19"
}
checkstyleMain {
configFile = file("$rootDir/config/checkstyle/google_checks.xml")
configProperties = mapOf("config_loc" to "${rootProject.projectDir}/config/checkstyle")
}
spotbugs {
toolVersion = "4.0.0-beta1"
}
spotbugsMain {
reports {
html.isEnabled = true
xml.isEnabled = false
}
}
pmd {
pmdTest.get().enabled = false
}
pmdMain {
ignoreFailures = true
ruleSetConfig = [email protected](file("${rootProject.projectDir}/config/pmd/ruleset.xml"))
}
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
}
}