Skip to content

Commit 86a0f8b

Browse files
author
Anuraag Agrawal
authored
Bring in publish-conventions from other repos. (#59)
* Bring in publish-conventions from other repos. * Remove RELEASE.md for now
1 parent 2332851 commit 86a0f8b

File tree

10 files changed

+142
-178
lines changed

10 files changed

+142
-178
lines changed

RELEASE.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

aws-xray/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id("otel.java-conventions")
3+
id("otel.publish-conventions")
34

45
id("org.unbroken-dome.test-sets")
56
}

aws-xray/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
otel.stable=true

build.gradle

Lines changed: 0 additions & 14 deletions
This file was deleted.

build.gradle.kts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import nebula.plugin.release.git.opinion.Strategies
2+
import java.time.Duration
3+
4+
plugins {
5+
id("idea")
6+
7+
id("com.diffplug.spotless")
8+
id("com.github.ben-manes.versions")
9+
id("io.github.gradle-nexus.publish-plugin")
10+
id("nebula.release")
11+
}
12+
13+
release {
14+
defaultVersionStrategy = Strategies.getSNAPSHOT()
15+
}
16+
17+
nebulaRelease {
18+
addReleaseBranchPattern("""v\d+\.\d+\.x""")
19+
}
20+
21+
nexusPublishing {
22+
packageGroup.set("io.opentelemetry")
23+
24+
repositories {
25+
sonatype {
26+
username.set(System.getenv("SONATYPE_USER"))
27+
password.set(System.getenv("SONATYPE_KEY"))
28+
}
29+
}
30+
31+
connectTimeout.set(Duration.ofMinutes(5))
32+
clientTimeout.set(Duration.ofMinutes(5))
33+
34+
transitionCheckOptions {
35+
// We have many artifacts so Maven Central takes a long time on its compliance checks. This sets
36+
// the timeout for waiting for the repository to close to a comfortable 50 minutes.
37+
maxRetries.set(300)
38+
delayBetween.set(Duration.ofSeconds(10))
39+
}
40+
}
41+
42+
description = "OpenTelemetry Contrib libraries and utilities for the JVM"
43+
44+
spotless {
45+
// this formatting is applied at the root level, as some of these files are not in a submodules
46+
// and would be missed otherwise
47+
format("misc") {
48+
target(".gitignore", "*.md", "docs/**/*.md")
49+
indentWithSpaces()
50+
trimTrailingWhitespace()
51+
endWithNewline()
52+
}
53+
}

buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ plugins {
88
}
99

1010
group = "io.opentelemetry.contrib"
11-
version = "1.3.0-alpha"
1211

13-
base.archivesBaseName = "opentelemetry-${project.name}"
12+
base.archivesName.set("opentelemetry-${project.name}")
1413

1514
java {
1615
toolchain {
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
plugins {
2+
`maven-publish`
3+
signing
4+
}
5+
6+
publishing {
7+
publications {
8+
register<MavenPublication>("maven") {
9+
plugins.withId("java-platform") {
10+
from(components["javaPlatform"])
11+
}
12+
plugins.withId("java-library") {
13+
from(components["java"])
14+
}
15+
16+
versionMapping {
17+
allVariants {
18+
fromResolutionResult()
19+
}
20+
}
21+
22+
if (findProperty("otel.stable") != "true") {
23+
val versionParts = version.split('-').toMutableList()
24+
versionParts[0] += "-alpha"
25+
version = versionParts.joinToString("-")
26+
}
27+
28+
afterEvaluate {
29+
val mavenGroupId: String? by project
30+
if (mavenGroupId != null) {
31+
groupId = mavenGroupId
32+
}
33+
artifactId = base.archivesName.get()
34+
35+
if (!groupId.startsWith("io.opentelemetry.contrib")) {
36+
throw GradleException("groupId is not set for this project or its parent ${project.parent}")
37+
}
38+
39+
pom.description.set(project.description)
40+
}
41+
42+
pom {
43+
name.set("OpenTelemetry Java Contrib")
44+
url.set("https://github.com/open-telemetry/opentelemetry-java-contrib")
45+
46+
licenses {
47+
license {
48+
name.set("The Apache License, Version 2.0")
49+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
50+
}
51+
}
52+
53+
developers {
54+
developer {
55+
id.set("opentelemetry")
56+
name.set("OpenTelemetry")
57+
url.set("https://github.com/open-telemetry/opentelemetry-java-contrib/discussions")
58+
}
59+
}
60+
61+
scm {
62+
connection.set("scm:git:[email protected]:open-telemetry/opentelemetry-java-contrib.git")
63+
developerConnection.set("scm:git:[email protected]:open-telemetry/opentelemetry-java-contrib.git")
64+
url.set("[email protected]:open-telemetry/opentelemetry-java-contrib.git")
65+
}
66+
}
67+
}
68+
}
69+
}
70+
71+
rootProject.tasks.named("release").configure {
72+
finalizedBy(tasks["publishToSonatype"])
73+
}
74+
75+
// Sign only if we have a key to do so
76+
val signingKey: String? = System.getenv("GPG_PRIVATE_KEY")
77+
// Stub out entire signing block off of CI since Gradle provides no way of lazy configuration of
78+
// signing tasks.
79+
if (System.getenv("CI") != null && signingKey != null) {
80+
signing {
81+
useInMemoryPgpKeys(signingKey, System.getenv("GPG_PASSWORD"))
82+
sign(publishing.publications["maven"])
83+
}
84+
}

gradle/publish.gradle

Lines changed: 0 additions & 105 deletions
This file was deleted.

jmx-metrics/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ plugins {
33
id "com.github.johnrengelman.shadow"
44

55
id("otel.groovy-conventions")
6+
id("otel.publish-conventions")
67
}
78

8-
apply from: "$rootDir/gradle/publish.gradle"
9-
10-
ext.shadowPublish = true
11-
12-
ext.libraryName = 'OpenTelemetry Java Contrib JMX Metric Gatherer'
139
description = 'JMX metrics gathering Groovy script runner'
1410

1511
// we are joint compiling so rely on groovy plugin entirely

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pluginManagement {
44
id("com.github.johnrengelman.shadow") version "7.0.0"
55
id("org.unbroken-dome.test-sets") version "4.0.0"
66
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
7+
id("nebula.release") version "15.3.1"
78
}
89
}
910

0 commit comments

Comments
 (0)