-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
122 lines (107 loc) · 3.36 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
plugins {
java
application
id("com.github.ben-manes.versions")
id("io.franzbecker.gradle-lombok")
}
val mainClass: String by project
val akkaVersion: String by project
val vavrVersion: String by project
val slf4jVersion: String by project
val lombokVersion: String by project
val springVersion: String by project
val junit4Version: String by project
val logbackVersion: String by project
val assertkVersion: String by project
val assertjVersion: String by project
val javaVersion = JavaVersion.VERSION_11
val junitJupiterVersion: String by project
val gradleWrapperVersion: String by project
tasks.withType(Wrapper::class.java) {
gradleVersion = gradleWrapperVersion
distributionType = Wrapper.DistributionType.BIN
}
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
repositories {
mavenCentral()
}
lombok {
version = lombokVersion
}
dependencies {
implementation("com.typesafe.akka:akka-actor_2.12:$akkaVersion")
implementation(platform("org.springframework:spring-framework-bom:$springVersion"))
implementation("org.springframework:spring-context-support")
implementation("io.vavr:vavr:$vavrVersion")
implementation("org.slf4j:slf4j-api:$slf4jVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
testImplementation("org.assertj:assertj-core:$assertjVersion")
testImplementation(platform("org.junit:junit-bom:$junitJupiterVersion"))
testRuntime("org.junit.platform:junit-platform-launcher")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
testImplementation("junit:junit:$junit4Version")
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showExceptions = true
showStandardStreams = true
events(
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
)
}
}
application {
mainClassName = mainClass
}
tasks {
register<Jar>("fatJar") {
//archiveAppendix.set("all")
archiveClassifier.set("all")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes("Main-Class" to mainClass)
}
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)
}
register<Zip>("sources") {
dependsOn("clean")
shouldRunAfter("clean", "assemble")
description = "Archives sources in a zip file"
group = "Archive"
from("src") {
into("src")
}
from(".gitignore")
from(".java-version")
from(".travis.yml")
from("build.gradle.kts")
from("pom.xml")
from("README.md")
from("settings.gradle.kts")
archiveFileName.set("${project.buildDir}/sources-${project.version}.zip")
}
named("clean") {
doLast {
delete(
project.buildDir,
"${project.projectDir}/out"
)
}
}
}
defaultTasks("clean", "sources", "fatJar", "test")
//defaultTasks("clean", "sources", "fatJar", "installDist", "distZip")