1
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2
+ import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
2
3
3
4
val mockkVersion = " 1.13.16"
4
5
val tokenSupportVersion = " 5.0.16"
5
6
val springdocVersion = " 1.8.0"
6
7
val navFoedselsnummerVersion = " 1.0-SNAPSHOT.6"
7
8
val kontrakterVersion = " 3.0_20250113155636_bb71360"
8
9
val mainClass = " no.nav.familie.ef.infotrygd.Main"
9
- val ktlint by configurations.creating
10
10
11
11
plugins {
12
12
val kotlinVersion = " 2.1.10"
@@ -17,6 +17,7 @@ plugins {
17
17
kotlin(" plugin.spring" ) version kotlinVersion
18
18
kotlin(" plugin.jpa" ) version kotlinVersion
19
19
id(" org.cyclonedx.bom" ) version " 2.1.0"
20
+ id(" org.jlleitschuh.gradle.ktlint" ) version " 12.1.2"
20
21
}
21
22
22
23
group = " no.nav"
@@ -35,21 +36,14 @@ repositories {
35
36
name = " Github"
36
37
url = uri(" https://maven.pkg.github.com/navikt/nav-foedselsnummer" )
37
38
credentials {
38
- username = " x-access-token" // project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USER")
39
+ username = " x-access-token" // project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USER")
39
40
password = System .getenv(" GPR_API_KEY" ) ? : System .getenv(" GITHUB_TOKEN" ) ? : project.findProperty(" gpr.key" ) as String?
40
41
}
41
42
}
42
43
}
43
44
44
-
45
45
dependencies {
46
46
47
-
48
- ktlint(" com.pinterest:ktlint:0.51.0-FINAL" ) {
49
- attributes {
50
- attribute(Bundling .BUNDLING_ATTRIBUTE , objects.named(Bundling .EXTERNAL ))
51
- }
52
- }
53
47
implementation(" nav-foedselsnummer:core:$navFoedselsnummerVersion " )
54
48
testImplementation(" nav-foedselsnummer:testutils:$navFoedselsnummerVersion " )
55
49
implementation(" org.springframework.boot:spring-boot-starter-actuator" )
@@ -81,40 +75,31 @@ dependencies {
81
75
testImplementation(" com.h2database:h2" )
82
76
testImplementation(" org.flywaydb:flyway-core" )
83
77
testImplementation(" io.mockk:mockk-jvm:$mockkVersion " )
84
-
85
-
86
78
}
87
79
88
80
val inputFiles = project.fileTree(mapOf (" dir" to " src" , " include" to " **/*.kt" ))
89
81
90
- val ktlintCheck by tasks.creating( JavaExec :: class ) {
91
- inputs.files(inputFiles )
92
- // outputs.dir(outputDir)
82
+ allprojects {
83
+ apply (plugin = " org.jlleitschuh.gradle.ktlint " )
84
+ }
93
85
94
- description = " Check Kotlin code style."
95
- classpath = ktlint
96
- mainClass.set(" com.pinterest.ktlint.Main" )
97
- args = listOf (" src/**/*.kt" )
86
+ ktlint {
87
+ version = " 1.5.0"
98
88
}
99
89
100
- val ktlintFormat by tasks.creating( JavaExec :: class ) {
101
- inputs.files(inputFiles)
102
- // outputs.dir(outputDir)
90
+ tasks.ktlintMainSourceSetCheck {
91
+ enabled = false
92
+ }
103
93
104
- description = " Fix Kotlin code style deviations."
105
- classpath = ktlint
106
- mainClass.set(" com.pinterest.ktlint.Main" )
107
- args = listOf (" -F" , " src/**/*.kt" )
108
- jvmArgs = listOf (" --add-opens" , " java.base/java.lang=ALL-UNNAMED" )
94
+ tasks.ktlintKotlinScriptCheck {
95
+ enabled = false
109
96
}
110
97
111
- tasks.withType<KotlinCompile > {
112
- dependsOn(" ktlintFormat" )
113
- dependsOn(" ktlintCheck" )
114
- tasks.findByName(" ktlintCheck" )?.mustRunAfter(" ktlintFormat" )
115
- kotlinOptions {
98
+ tasks.withType<KotlinJvmCompile > {
99
+ dependsOn(tasks.ktlintFormat)
100
+ compilerOptions {
116
101
freeCompilerArgs = listOf (" -Xjsr305=strict" )
117
- jvmTarget = " 21 "
102
+ jvmTarget.set( JvmTarget . JVM_21 )
118
103
}
119
104
}
120
105
@@ -130,4 +115,3 @@ tasks.test {
130
115
tasks.cyclonedxBom {
131
116
setIncludeConfigs(listOf (" runtimeClasspath" , " compileClasspath" ))
132
117
}
133
- // tasks.findByName('publish').mustRunAfter 'build'
0 commit comments