-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
121 lines (103 loc) · 3.25 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.BufferedReader
plugins {
java
idea
`maven-publish`
id("com.adarshr.test-logger") version Versions.gradleTestLoggerPlugin apply false
id("com.diffplug.spotless") version Versions.gradleSpotlessPlugin
id("com.gorylenko.gradle-git-properties") version Versions.gradleGitPropertiesPlugin apply false
id("com.apollographql.apollo") version Versions.apollo apply false
id("com.github.johnrengelman.shadow") version Versions.gradleShadowPlugin apply false
id("io.micronaut.application") version Versions.gradleMicronautPlugin apply false
id("io.micronaut.library") version Versions.gradleMicronautPlugin apply false
kotlin("jvm") version Versions.kotlin apply false
kotlin("kapt") version Versions.kotlin apply false
kotlin("plugin.allopen") version Versions.kotlin apply false
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
allprojects {
apply(plugin = "idea")
apply(plugin = "com.diffplug.spotless")
apply(from = "${project.rootDir}/gradle/dependencyUpdates.gradle.kts")
idea {
module {
isDownloadJavadoc = false
isDownloadSources = false
}
}
spotless {
java {
licenseHeaderFile("$rootDir/gradle/licenseHeader.txt")
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
targetExclude("**/generated/**")
}
kotlin {
licenseHeaderFile("$rootDir/gradle/licenseHeader.txt")
}
kotlinGradle {
ktlint()
}
}
tasks.withType<JavaCompile> {
options.release.set(11)
}
}
// TODO
var gitVersion = "0.1.0"
if (gitVersion == "") {
val process = Runtime.getRuntime().exec("git rev-parse --verify --short HEAD")
val content = process.inputStream.bufferedReader().use(BufferedReader::readText)
gitVersion = "git-${content.trim().strip()}"
println("Git version: $gitVersion")
}
val publishingProjects = setOf(
"dumper-share",
"dumper-test"
)
subprojects {
apply(plugin = "java")
apply(plugin = "com.adarshr.test-logger")
if (publishingProjects.contains(project.name)) {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
}
version = gitVersion
group = "com.zhokhov.dumper"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}
if (publishingProjects.contains(project.name)) {
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
versionMapping {
allVariants {
fromResolutionResult()
}
}
}
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform {
includeEngines = setOf("junit-jupiter")
excludeEngines = setOf("junit-vintage")
}
}
}