generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
122 lines (107 loc) · 3.88 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 com.gorylenko.GenerateGitPropertiesTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.noarg.gradle.NoArgExtension
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfo
import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.run.BootRun
import uk.gov.justice.digital.hmpps.plugins.ClassPathPlugin
import uk.gov.justice.digital.hmpps.plugins.JibConfigPlugin
plugins {
kotlin("jvm") version "2.1.0"
kotlin("plugin.spring") version "2.1.0" apply false
kotlin("plugin.jpa") version "2.1.0" apply false
id("org.springframework.boot") version "3.3.7" apply false
id("io.spring.dependency-management") version "1.1.7" apply false
id("com.gorylenko.gradle-git-properties") version "2.4.2" apply false
id("com.google.cloud.tools.jib") apply false
id("base")
id("org.sonarqube")
id("idea")
}
val agentDeps: Configuration by configurations.creating
dependencies {
agentDeps("com.microsoft.azure:applicationinsights-agent:3.6.2")
}
val copyAgentTask = project.tasks.register<Copy>("copyAgent") {
from(agentDeps)
into("${project.layout.buildDirectory.dir("agent").get().asFile}")
rename("applicationinsights-agent(.+).jar", "agent.jar")
}
allprojects {
group = "uk.gov.justice.digital"
repositories {
mavenLocal()
mavenCentral()
}
apply {
plugin("org.jetbrains.kotlin.jvm")
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
freeCompilerArgs.add("-Xjsr305=strict") // to make use of Spring's null-safety annotations
}
}
tasks {
withType<JavaCompile> {
sourceCompatibility = "21"
}
withType<BootJar> {
enabled = false
}
}
}
subprojects {
apply {
plugin("org.springframework.boot")
plugin("io.spring.dependency-management")
plugin("org.jetbrains.kotlin.jvm")
plugin("org.jetbrains.kotlin.plugin.jpa")
plugin("org.jetbrains.kotlin.plugin.spring")
plugin("jacoco")
plugin("test-report-aggregation")
plugin("jacoco-report-aggregation")
plugin("org.sonarqube")
plugin("com.gorylenko.gradle-git-properties")
plugin("idea")
plugin(JibConfigPlugin::class.java)
plugin(ClassPathPlugin::class.java)
}
tasks {
withType<BootRun> {
val profiles = System.getProperty("spring.profiles.active", System.getenv("SPRING_PROFILES_ACTIVE"))
if (profiles?.split(",")?.contains("dev") == true) {
classpath = sourceSets.getByName("dev").runtimeClasspath
}
}
withType<Jar> {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
archiveFileName.set("${archiveBaseName.get()}-${archiveClassifier.get()}.${archiveExtension.get()}")
}
named<GenerateGitPropertiesTask>("generateGitProperties") { enabled = false }
register<GenerateGitPropertiesTask>("gitInfo") {
gitProperties.gitPropertiesResourceDir = projectDir
}
register<BuildInfo>("buildInfo") {
destinationDir = projectDir
}
}
extensions.configure<NoArgExtension> {
annotation("org.springframework.ldap.odm.annotations.Entry")
}
if (!path.startsWith(":libs")) {
tasks.named("check") {
dependsOn(rootProject.subprojects.filter { it.path.startsWith(":libs") }
.map { it.tasks.getByName("check") })
}
}
idea {
module {
testSources.from(sourceSets["dev"].allSource.srcDirs)
testResources.from(sourceSets["dev"].resources.srcDirs)
testSources.from(sourceSets["integrationTest"].allSource.srcDirs)
testResources.from(sourceSets["integrationTest"].resources.srcDirs)
}
}
}