-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
111 lines (87 loc) · 3.24 KB
/
build.gradle.kts
File metadata and controls
111 lines (87 loc) · 3.24 KB
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
import com.diffplug.spotless.LineEnding
import internal.getBooleanProperty
plugins {
id("internal.errorprone-convention")
id("internal.idea-convention")
id("internal.jacoco-convention")
id("internal.java-library-convention")
id("internal.mrjar-module-info-convention")
id("internal.publishing-convention")
alias(libs.plugins.nmcp)
alias(libs.plugins.spotless)
}
dependencies {
api(libs.jspecify)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junit.platform.launcher)
testImplementation(libs.assertj.core)
errorprone(libs.errorprone.core)
errorprone(libs.nullaway)
}
// see buildSrc/src/main/kotlin/internal.publishing-convention.gradle.kts
internalPublishing {
displayName = "Problem4J Core"
description = "Core library implementing Problem model according to RFC7807 (aka RFC9457)."
}
nmcp {
publishAllPublicationsToCentralPortal {
username = System.getenv("PUBLISHING_USERNAME")
password = System.getenv("PUBLISHING_PASSWORD")
publishingType = "USER_MANAGED"
}
}
spotless {
val licenseHeader = "${rootProject.rootDir}/gradle/license-header.java"
val updateLicenseYear = project.getBooleanProperty("spotless.license-year-enabled")
java {
target("**/src/**/*.java")
licenseHeaderFile(licenseHeader).updateYearWithLatest(updateLicenseYear)
// NOTE: decided not to upgrade Google Java Format, as versions 1.29+ require running it on Java 21
googleJavaFormat("1.28.0")
forbidWildcardImports()
endWithNewline()
lineEndings = LineEnding.UNIX
}
format("javaMisc") {
target("**/src/**/package-info.java", "**/src/**/module-info.java")
// License headers in these files are not formatted with standard java group, so we need to use custom settings.
// The regex is designed to find out where the code starts in these files, so the license header can be placed
// before it.
//
// The code starts with either:
//
// - any annotation (ex. @NullMarked before package declaration),
// - package, module or import declaration,
// - "/**" in case of a pre-package (or pre-module) JavaDoc.
val delimiter = "^(@|package|import|module|/\\*\\*)"
licenseHeaderFile(licenseHeader, delimiter).updateYearWithLatest(updateLicenseYear)
}
kotlin {
target("**/src/**/*.kt")
ktfmt("0.60").metaStyle()
endWithNewline()
lineEndings = LineEnding.UNIX
}
kotlinGradle {
target("*.gradle.kts", "buildSrc/*.gradle.kts", "buildSrc/src/**/*.gradle.kts")
ktlint("1.8.0").editorConfigOverride(mapOf("max_line_length" to "120"))
endWithNewline()
lineEndings = LineEnding.UNIX
}
format("yaml") {
target("**/*.yml", "**/*.yaml")
trimTrailingWhitespace()
leadingTabsToSpaces(2)
endWithNewline()
lineEndings = LineEnding.UNIX
}
format("misc") {
target("**/.gitattributes", "**/.gitignore")
trimTrailingWhitespace()
leadingTabsToSpaces(4)
endWithNewline()
lineEndings = LineEnding.UNIX
}
}
defaultTasks("spotlessApply", "build")