-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.gradle
100 lines (86 loc) · 2.73 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
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
plugins {
id 'org.jetbrains.kotlin.jvm' version '2.1.0'
id 'org.jetbrains.dokka' version '1.9.20' apply false
id 'org.jlleitschuh.gradle.ktlint' version '12.1.1' apply false
id 'com.vanniktech.maven.publish' version '0.25.3' apply false
id 'com.gradle.plugin-publish' version '1.3.0' apply false
id 'com.github.ben-manes.versions' version '0.51.0'
id 'java-gradle-plugin'
id 'java-library'
id 'groovy'
}
apply from: 'gradle/dependencies.gradle'
configurations.configureEach {
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
resolutionStrategy {
eachDependency { details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion versions.kotlin
}
if (details.requested.group == 'org.jacoco') {
details.useVersion versions.jacoco
}
}
}
}
subprojects {
tasks.withType(Jar).configureEach {
def dateFile = new File(buildDir, 'jar-manifest-date.txt')
if (!dateFile.exists()) {
def date = DateTimeFormatter.ofPattern('EEE MMM dd HH:mm:ss zzz yyyy').
format(ZonedDateTime.now())
dateFile.parentFile.mkdirs()
dateFile.text = date.trim()
}
manifest {
attributes(
'Created-By': POM_DEVELOPER_NAME,
'Implementation-Title': POM_NAME,
'Implementation-Version': VERSION_NAME,
'Implementation-Vendor': POM_DEVELOPER_NAME,
'Built-By': System.getProperty('user.name'),
'Built-Date': dateFile.text.trim(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion)
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
fork = true
}
}
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
fork = true
}
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging {
exceptionFormat 'full'
showCauses true
showExceptions true
showStackTraces true
events 'failed', 'skipped'
}
def maxWorkerCount = gradle.startParameter.maxWorkerCount
maxParallelForks = (maxWorkerCount < 2) ? 1 : maxWorkerCount / 2
}
}