forked from jaredsburrows/gradle-license-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
124 lines (107 loc) · 3.28 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.dokka) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.maven.publish) apply false
alias(libs.plugins.plugin.publish) apply false
alias(libs.plugins.versions)
alias(libs.plugins.license)
id 'java-gradle-plugin'
id 'java-library'
id 'groovy'
id 'idea'
}
allprojects {
configurations.configureEach {
resolutionStrategy {
preferProjectModules()
enableDependencyVerification()
eachDependency { details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion libs.versions.kotlin.get()
}
}
}
}
tasks.withType(Wrapper).configureEach {
distributionType = Wrapper.DistributionType.ALL
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
}
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(KotlinJvmCompile).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
freeCompilerArgs.add("-progressive")
freeCompilerArgs.add("-Xjsr305=strict")
freeCompilerArgs.add("-Xemit-jvm-type-annotations")
freeCompilerArgs.add("-Xassertions=jvm")
freeCompilerArgs.add("-Xproper-ieee754-comparisons")
freeCompilerArgs.add("-Xjvm-default=all")
}
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
fork = true
}
}
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
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
}
}