-
Notifications
You must be signed in to change notification settings - Fork 95
/
build.gradle.kts
94 lines (78 loc) · 2.76 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
plugins {
alias(libs.plugins.kotlin)
id("com.diffplug.spotless")
}
repositories {
mavenCentral()
mavenLocal()
}
val quarkusPluginId: String by project
val quarkusPlatformGroupId: String by project
val quarkusPlatformArtifactId: String by project
val quarkusPlatformVersion: String by project
val projectGroup: String by project
val projectVersion: String by project
group = projectGroup
version = projectVersion
subprojects {
repositories {
mavenCentral()
mavenLocal()
}
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "com.diffplug.spotless")
dependencies {
implementation(platform("$quarkusPlatformGroupId:$quarkusPlatformArtifactId:$quarkusPlatformVersion"))
implementation(platform("$quarkusPlatformGroupId:quarkus-camel-bom:$quarkusPlatformVersion"))
}
group = project.group
version = projectVersion
spotless {
kotlin {
// Target all Kotlin files in the project
target("**/*.kt", "**/*.kts")
// Exclude generated files
targetExclude("**/build/**/*.kt", "**/build/**/*.kts", "**/bin/**/*.kt", "**/bin/**/*.kts", "**/generated/**")
// Use ktlint for code formatting
ktlint("1.5.0")
.setEditorConfigPath("${rootProject.projectDir.resolve(".editorconfig").absolutePath}")
// Apply additional formatting rules
// trimTrailingWhitespace()
// indentWithSpaces(4)
// endWithNewline()
// License header configuration
licenseHeader(
"""
/*
* Copyright 2024 Soybean Admin Backend
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
""".trimIndent(),
)
}
}
plugins.withId(quarkusPluginId) {
val kubernetesDir = layout.buildDirectory.dir("kubernetes")
kubernetesDir.get().asFile.let { dir ->
if (dir.exists()) {
val targetDir = project.projectDir.resolve("kubernetes")
val copyKubernetesDir by tasks.registering(Copy::class) {
from(dir)
into(targetDir)
doFirst {
if (!targetDir.exists()) {
targetDir.mkdirs()
}
}
doLast {
println("Kubernetes directory has been copied to: $targetDir")
}
}
tasks.named("quarkusBuild") {
finalizedBy(copyKubernetesDir)
}
}
}
}
}