-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
190 lines (169 loc) · 5.55 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
* Copyright 2023-2024 Broadcom. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.google.cloud.storage.BlobId
import com.google.cloud.storage.BlobInfo
import com.google.cloud.storage.StorageOptions
buildscript {
dependencies {
classpath("com.google.cloud:google-cloud-storage:2.30.2")
}
}
plugins {
id("java-library")
id("gemfire-repo-artifact-publishing")
id("commercial-repositories")
alias(libs.plugins.ben.manes.versions)
alias(libs.plugins.littlerobots.version.catalog.update)
id("gemfire-artifactory")
}
java {
toolchain { languageVersion = JavaLanguageVersion.of(17) }
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.named<Javadoc>("javadoc") {
title =
"Spring Integration ${getSpringIntegrationBaseVersion()} for VMware GemFire ${getGemFireBaseVersion()} Java API Reference"
isFailOnError = false
}
publishingDetails {
artifactName.set("spring-integration-6.1-gemfire-${getGemFireBaseVersion()}")
longName.set("Spring Integration for VMware GemFire")
description.set("Spring Integration For VMware GemFire")
}
dependencies {
implementation(platform(libs.spring.integration.bom))
api("org.springframework.integration:spring-integration-core")
api(libs.spring.data.gemfire) {
exclude(group = "org.springframework")
exclude(module = "shiro-event")
exclude(module = "shiro-lang")
exclude(module = "shiro-crypto-hash")
exclude(module = "shiro-crypto-cipher")
exclude(module = "shiro-config-ogdl")
exclude(module = "shiro-config-core")
exclude(module = "shiro-cache")
exclude(module = "commons-logging")
}
api(libs.commons.io)
compileOnly(libs.gemfire.core) {
exclude(module = "commons-logging")
}
compileOnly(libs.gemfire.cq)
testImplementation(platform(libs.junit.bom))
testImplementation("org.springframework.integration:spring-integration-test-support") {
exclude(module = "mockito-core")
}
testImplementation(libs.gemfire.core) {
exclude(module = "commons-logging")
}
testImplementation(libs.gemfire.cq)
testImplementation("junit:junit")
testImplementation(libs.assertj.core)
testImplementation(libs.spring.test)
testImplementation(libs.mockito.core)
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.junit.vintage:junit-vintage-engine")
testImplementation(libs.log4j.over.slf4j)
testImplementation(libs.logback.classic)
testImplementation(libs.gemfire.testcontainers)
}
tasks.all {
when (this) {
is JavaForkOptions -> {
jvmArgs("--add-opens", "jdk.management/com.sun.management.internal=ALL-UNNAMED")
}
}
}
tasks {
test {
useJUnitPlatform()
val springTestGemfireDockerImage: String by project
systemProperty("spring.test.gemfire.docker.image", springTestGemfireDockerImage)
}
}
repositories {
mavenCentral()
val additionalMavenRepoURLs = project.findProperty("additionalMavenRepoURLs").toString()
if (!additionalMavenRepoURLs.isNullOrBlank() && additionalMavenRepoURLs.isNotEmpty()) {
additionalMavenRepoURLs.split(",").forEach {
project.repositories.maven {
this.url = uri(it)
}
}
}
}
private fun getSpringIntegrationBaseVersion(): String {
return getBaseVersion(property("springIntegrationVersion").toString())
}
private fun getGemFireBaseVersion(): String {
return getBaseVersion(property("gemfireVersion").toString())
}
private fun getBaseVersion(version: String): String {
val split = version.split(".")
if (split.size < 2) {
throw RuntimeException("version is malformed")
}
return "${split[0]}.${split[1]}"
}
tasks.getByName<Test>("test") {
forkEvery = 1
maxParallelForks = 4
val springTestGemfireDockerImage: String by project
systemProperty("spring.test.gemfire.docker.image", springTestGemfireDockerImage)
}
tasks.register("copyJavadocsToBucket") {
val javadocJarTask = tasks.named("javadocJar")
dependsOn(javadocJarTask)
doLast {
val storage = StorageOptions.newBuilder().setProjectId(project.properties["docsGCSProject"].toString())
.build().getService()
val javadocJarFiles = javadocJarTask.get().outputs.files
val blobId = BlobId.of(
project.properties["docsGCSBucket"].toString(),
"${publishingDetails.artifactName.get()}/${project.version}/${javadocJarFiles.singleFile.name}"
)
val blobInfo = BlobInfo.newBuilder(blobId).build()
storage.createFrom(blobInfo, javadocJarFiles.singleFile.toPath())
}
}
versionCatalogUpdate {
// These options will be set as default for all version catalogs
sortByKey = true
// Referenced that are pinned are not automatically updated.
// They are also not automatically kept however (use keep for that).
pin {
}
keep {
keepUnusedVersions = true
// keep all libraries that aren't used in the project
keepUnusedLibraries = true
// keep all plugins that aren't used in the project
keepUnusedPlugins = true
}
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
!isPatch(candidate.version, currentVersion)
}
}
fun isPatch(candidateVersion: String, currentVersion: String): Boolean {
val candidateSplit = candidateVersion.split(".")
val currentSplit = currentVersion.split(".")
if (candidateSplit.size == currentSplit.size && currentSplit.size == 3) {
if (candidateSplit[0] != currentSplit[0]) {
return false
}
if (candidateSplit[1] != currentSplit[1]) {
return false
}
}
return true
}