-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
94 lines (81 loc) · 3.18 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
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.octopusden.task.MigrateMockData
plugins {
java
idea
id("io.spring.dependency-management")
id("org.jetbrains.kotlin.jvm")
id("io.github.gradle-nexus.publish-plugin")
signing
}
allprojects {
group = "org.octopusden.octopus.release-management-service"
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("MAVEN_USERNAME"))
password.set(System.getenv("MAVEN_PASSWORD"))
}
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "idea")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "signing")
repositories {
mavenCentral()
}
idea.module {
isDownloadJavadoc = true
isDownloadSources = true
}
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
suppressWarnings = true
jvmTarget = "21"
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging{
info.events = setOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
}
systemProperties["release-management-service.version"] = version
}
val migrateMockData by tasks.creating(MigrateMockData::class) {
this.testDataDir = rootDir.toString() + File.separator + "test-data"
}
ext {
System.getenv().let {
set("signingRequired", it.containsKey("ORG_GRADLE_PROJECT_signingKey") && it.containsKey("ORG_GRADLE_PROJECT_signingPassword"))
set("dockerRegistry", it.getOrDefault("DOCKER_REGISTRY", properties["docker.registry"]))
set("octopusGithubDockerRegistry", it.getOrDefault("OCTOPUS_GITHUB_DOCKER_REGISTRY", properties["octopus.github.docker.registry"]))
}
set("validateFun", { properties: List<String> ->
val emptyProperties = properties.filter { (project.ext[it] as? String).isNullOrBlank() }
if (emptyProperties.isNotEmpty()) {
throw IllegalArgumentException(
"Start gradle build with" +
(if (emptyProperties.contains("dockerRegistry")) " -Pdocker.registry=..." else "") +
(if (emptyProperties.contains("octopusGithubDockerRegistry")) " -Poctopus.github.docker.registry=..." else "") +
" or set env variable(s):" +
(if (emptyProperties.contains("dockerRegistry")) " DOCKER_REGISTRY" else "") +
(if (emptyProperties.contains("octopusGithubDockerRegistry")) " OCTOPUS_GITHUB_DOCKER_REGISTRY" else "")
)
}
})
}
}