-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
122 lines (106 loc) · 3.75 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
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
plugins {
idea
id("fr.brouillard.oss.gradle.jgitver")
id("io.spring.dependency-management")
id("org.springframework.boot") apply false
id("name.remal.sonarlint") apply false
id("com.diffplug.spotless") apply false
}
idea {
project {
languageLevel = IdeaLanguageLevel(17)
}
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
allprojects {
group = "ru.otus"
repositories {
mavenLocal()
mavenCentral()
}
val testcontainersBom: String by project
val protobufBom: String by project
val guava: String by project
apply(plugin = "io.spring.dependency-management")
dependencyManagement {
dependencies {
imports {
mavenBom(BOM_COORDINATES)
mavenBom("org.testcontainers:testcontainers-bom:$testcontainersBom")
mavenBom("com.google.protobuf:protobuf-bom:$protobufBom")
}
dependency("com.google.guava:guava:$guava")
}
}
configurations.all {
resolutionStrategy {
failOnVersionConflict()
force("javax.servlet:servlet-api:2.4")
force("commons-logging:commons-logging:1.1.1")
force("commons-lang:commons-lang:2.5")
force("org.codehaus.jackson:jackson-core-asl:1.8.8")
force("org.codehaus.jackson:jackson-mapper-asl:1.8.3")
force("org.codehaus.jettison:jettison:1.1")
force("net.java.dev.jna:jna:5.8.0")
force("com.google.errorprone:error_prone_annotations:2.7.1")
force("org.sonarsource.analyzer-commons:sonar-analyzer-commons:2.3.0.1263")
force("com.google.code.findbugs:jsr305:3.0.2")
force("org.sonarsource.sslr:sslr-core:1.24.0.633")
force("org.eclipse.platform:org.eclipse.osgi:3.18.400")
force("org.eclipse.platform:org.eclipse.equinox.common:3.18.0")
}
}
}
subprojects {
plugins.apply(JavaPlugin::class.java)
extensions.configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf("-Xlint:all,-serial,-processing", "-Werror"))
}
apply<name.remal.gradle_plugins.sonarlint.SonarLintPlugin>()
apply<com.diffplug.gradle.spotless.SpotlessPlugin>()
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
googleJavaFormat("1.16.0").aosp()
}
}
plugins.apply(fr.brouillard.oss.gradle.plugins.JGitverPlugin::class.java)
extensions.configure<fr.brouillard.oss.gradle.plugins.JGitverPluginExtension> {
strategy("PATTERN")
nonQualifierBranches("main,master")
tagVersionPattern("\${v}\${<meta.DIRTY_TEXT}")
versionPattern(
"\${v}\${<meta.COMMIT_DISTANCE}\${<meta.GIT_SHA1_8}" +
"\${<meta.QUALIFIED_BRANCH_NAME}\${<meta.DIRTY_TEXT}-SNAPSHOT"
)
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging.showExceptions = true
reports {
junitXml.required.set(true)
html.required.set(true)
}
}
}
tasks {
val managedVersions by registering {
doLast {
project.extensions.getByType<DependencyManagementExtension>()
.managedVersions
.toSortedMap()
.map { "${it.key}:${it.value}" }
.forEach(::println)
}
}
}