-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
185 lines (163 loc) · 6.73 KB
/
build.gradle.kts
File metadata and controls
185 lines (163 loc) · 6.73 KB
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
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import com.github.vlsi.gradle.git.dsl.gitignore
import org.jetbrains.gradle.ext.copyright
import org.jetbrains.gradle.ext.settings
plugins {
alias(libs.plugins.rat)
alias(libs.plugins.version.catalog.update)
alias(libs.plugins.versions)
alias(libs.plugins.crlf) apply false
alias(libs.plugins.idea.ext)
alias(libs.plugins.spotless) apply false // workaround for https://github.com/diffplug/spotless/issues/2877
`maven-publish`
signing
}
versionCatalogUpdate {
sortByKey = false
keep {
keepUnusedVersions.set(true)
}
}
tasks.named<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask>("dependencyUpdates") {
outputFormatter = "html"
rejectVersionIf {
val nonStable = candidate.version.contains("alpha") || candidate.version.contains("beta") || candidate.version.contains("rc")
// OpenTelemetry publishes stable releases with -alpha suffix for some modules
val isOpenTelemetry = candidate.group.startsWith("io.opentelemetry")
nonStable && !(isOpenTelemetry && candidate.version.contains("alpha"))
}
}
val pulsarVersion = version.toString()
// ── Apache RAT (Release Audit Tool) ─────────────────────────────────────────
tasks.named<org.nosphere.apache.rat.RatTask>("rat").configure {
// Honour .gitignore exclusions so RAT skips untracked/generated files.
// Register .gitignore files as inputs so the task re-runs when they change.
inputs.files(fileTree(rootDir) {
include("**/.gitignore")
exclude("**/build/**")
exclude("**/.gradle/**")
})
// use crlf plugin's gitignore dsl
gitignore(rootDir)
// Apply additional RAT-specific exclusions from .ratignore.
val ratignoreFile = rootDir.resolve(".ratignore")
inputs.file(ratignoreFile)
exclude(ratignoreFile.readLines().map { it.trim() }.filter { it.isNotBlank() && !it.startsWith("#") })
}
apply(from = "gradle/verify-test-groups.gradle.kts")
idea {
project {
settings {
// add ASL2 copyright profile to IntelliJ
copyright {
useDefault = "ASL2"
profiles {
create("ASL2") {
notice = rootProject.file("src/license-header.txt").readText().trimEnd()
keyword = "Copyright"
}
}
}
}
}
}
// ── Root lifecycle tasks ────────────────────────────────────────────────────
tasks.register("serverDistTar") {
dependsOn(":distribution:pulsar-server-distribution:serverDistTar")
}
tasks.register("docker") {
description = "Build the Pulsar Docker image"
group = "docker"
dependsOn(":docker:pulsar-docker-image:dockerBuild")
}
// ── Parent POM publication ──────────────────────────────────────────────────
// Publishes org.apache.pulsar:pulsar as a POM-only parent artifact.
// Child modules reference this via <parent> in their POMs, inheriting
// shared ASF metadata (license, SCM, organization, etc.).
publishing {
publications {
create<MavenPublication>("maven") {
pom {
packaging = "pom"
name.set("Apache Pulsar")
description.set(
"Pulsar is a distributed pub-sub messaging platform with a very " +
"flexible messaging model and an intuitive client API."
)
url.set("https://pulsar.apache.org")
inceptionYear.set("2017")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
organization {
name.set("Apache Software Foundation")
url.set("https://www.apache.org/")
}
issueManagement {
system.set("GitHub Issues")
url.set("https://github.com/apache/pulsar/issues")
}
scm {
connection.set("scm:git:https://github.com/apache/pulsar.git")
developerConnection.set("scm:git:https://github.com/apache/pulsar.git")
url.set("https://github.com/apache/pulsar")
tag.set("HEAD")
}
mailingLists {
mailingList {
name.set("Apache Pulsar developers list")
subscribe.set("dev-subscribe@pulsar.apache.org")
unsubscribe.set("dev-unsubscribe@pulsar.apache.org")
post.set("dev@pulsar.apache.org")
archive.set("https://lists.apache.org/list.html?dev@pulsar.apache.org")
}
}
developers {
developer {
organization.set("Apache Pulsar developers")
organizationUrl.set("https://pulsar.apache.org/")
}
}
}
}
}
repositories {
maven {
name = "localDeploy"
url = uri(layout.buildDirectory.dir("local-deploy-repo"))
}
}
}
signing {
isRequired = !pulsarVersion.endsWith("-SNAPSHOT")
val useGpgCmd = providers.gradleProperty("useGpgCmd").orNull?.toBoolean() ?: false
if (useGpgCmd) {
useGpgCmd()
}
sign(publishing.publications)
}
tasks.withType<Sign>().configureEach {
enabled = providers.gradleProperty("signing.keyId").isPresent ||
providers.gradleProperty("signing.gnupg.keyName").isPresent
}