Skip to content

Commit

Permalink
Build fix amalgamation and dep upgrades (#1150)
Browse files Browse the repository at this point in the history
* update to java 17 for GHA

* upgrade gradle to 8.0.2

* upgrade nexus publish

* upgrade shadow jar version

* update protobuf-bom

* update proto

* Update buildSrc/build.gradle.kts

Co-authored-by: Mateusz Rzeszutek <[email protected]>

* revert

* Remove test sets plugin

* fix khttp test

---------

Co-authored-by: Mateusz Rzeszutek <[email protected]>
  • Loading branch information
breedx-splk and Mateusz Rzeszutek authored Mar 8, 2023
1 parent 3f3aba0 commit 607d270
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 71 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand All @@ -59,11 +59,11 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand All @@ -84,11 +84,11 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand Down Expand Up @@ -122,11 +122,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand All @@ -34,11 +34,11 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand All @@ -59,11 +59,11 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand Down Expand Up @@ -97,11 +97,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand All @@ -56,11 +56,11 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand All @@ -81,11 +81,11 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand Down Expand Up @@ -119,11 +119,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 11 for running Gradle
- name: Set up JDK 17 for running Gradle
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11.0.11+9
distribution: temurin
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ dependencies {
implementation("io.spring.gradle:dependency-management-plugin:1.1.0")

// keep these versions in sync with settings.gradle.kts
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
implementation("gradle.plugin.com.github.johnrengelman:shadow:8.0.0")
}
16 changes: 13 additions & 3 deletions buildSrc/src/main/kotlin/splunk.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ repositories {
}
}
evaluationDependsOn(":dependencyManagement")
val dependencyManagementConf = configurations.create("dependencyManagement") {
isCanBeConsumed = false
isCanBeResolved = false
isVisible = false
}
afterEvaluate {
configurations.configureEach {
if (isCanBeResolved && !isCanBeConsumed) {
extendsFrom(dependencyManagementConf)
}
}
}

dependencies {
for (conf in configurations) {
add(conf.name, platform(project(":dependencyManagement")))
}
add(dependencyManagementConf.name, platform(project(":dependencyManagement")))
add("testImplementation", "org.assertj:assertj-core")
add("testImplementation", "org.awaitility:awaitility")
add("testImplementation", "org.mockito:mockito-core")
Expand Down
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {

// BOMs
api(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.14.2"))
api(enforcedPlatform("com.google.protobuf:protobuf-bom:3.21.12"))
api(enforcedPlatform("com.google.protobuf:protobuf-bom:3.22.0"))
api(enforcedPlatform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
api(enforcedPlatform("io.grpc:grpc-bom:1.53.0"))
api(platform("io.micrometer:micrometer-bom:$micrometerVersion"))
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 7 additions & 0 deletions instrumentation/khttp-0.1/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ dependencies {

testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
}

tasks.withType<Test>().configureEach {
// required on jdk17
jvmArgs("--add-opens=java.base/java.net=ALL-UNNAMED")
jvmArgs("--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED")
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import khttp.responses.Response;
import org.jetbrains.annotations.Nullable;

Expand All @@ -47,8 +49,10 @@ public String getMethod(RequestWrapper requestWrapper) {

@Override
public List<String> getRequestHeader(RequestWrapper requestWrapper, String name) {
String header = requestWrapper.headers.get(name);
return header != null ? singletonList(header) : emptyList();
return requestWrapper.headers.entrySet().stream()
.filter(e -> e.getKey().equalsIgnoreCase(name))
.map(Map.Entry::getValue)
.collect(Collectors.toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientMetrics;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.net.PeerServiceAttributesExtractor;
import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
import khttp.responses.Response;
Expand All @@ -46,8 +45,10 @@ public final class KHttpSingletons {
HttpSpanNameExtractor.create(httpAttributesGetter))
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
.addAttributesExtractor(
HttpClientAttributesExtractor.create(httpAttributesGetter, netAttributesGetter))
.addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter))
HttpClientAttributesExtractor.builder(httpAttributesGetter, netAttributesGetter)
.setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
.setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
.build())
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
Expand Down
52 changes: 32 additions & 20 deletions instrumentation/micrometer-testing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
plugins {
id("splunk.instrumentation-conventions")
id("org.unbroken-dome.test-sets")
}

testSets {
(3..10).forEach { ver ->
create("version1${ver}Test") {
dirName = "test"
}
}
}

dependencies {
testInstrumentation(project(":instrumentation:micrometer-1.3"))
testInstrumentation(project(":instrumentation:micrometer-1.5"))

add("version13TestImplementation", "io.micrometer:micrometer-core:1.3.16")
add("version14TestImplementation", "io.micrometer:micrometer-core:1.4.2")
add("version15TestImplementation", "io.micrometer:micrometer-core:1.5.17")
add("version16TestImplementation", "io.micrometer:micrometer-core:1.6.12")
add("version17TestImplementation", "io.micrometer:micrometer-core:1.7.5")
add("version18TestImplementation", "io.micrometer:micrometer-core:1.8.11")
add("version19TestImplementation", "io.micrometer:micrometer-core:1.9.5")
add("version110TestImplementation", "io.micrometer:micrometer-core:1.10.3")
// use the agent (latest) micrometer version in the default test task
testImplementation("io.micrometer:micrometer-core")
}

tasks {
test {
testing {
suites {
(3..10).forEach { ver ->
dependsOn(named("version1${ver}Test"))
register<JvmTestSuite>("version1_${ver}Test") {
sources {
java {
setSrcDirs(listOf("src/test/java"))
}
}
dependencies {
implementation("io.micrometer:micrometer-core:1.$ver.+")

implementation(project(":testing:common"))
implementation("org.assertj:assertj-core")
}

targets {
all {
testTask.configure {
jvmArgs("-Dsplunk.metrics.enabled=true")

// set some global metrics tags for testing javaagent
jvmArgs("-Dsplunk.testing.metrics.global-tags=food=cheesecake")
}
}
}
}
}
}
}

tasks {
check {
dependsOn(testing.suites)
}

withType<Test> {
jvmArgs("-Dsplunk.metrics.enabled=true")
Expand Down
2 changes: 1 addition & 1 deletion profiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id("com.google.protobuf") version "0.9.2"
}

val protobufVersion = "3.21.12"
val protobufVersion = "3.22.0"

protobuf {
protoc {
Expand Down
5 changes: 2 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
pluginManagement {
plugins {
id("com.bmuschko.docker-remote-api") version "9.2.1"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("io.github.gradle-nexus.publish-plugin") version "1.2.0"
id("com.github.johnrengelman.shadow") version "8.1.0"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("nebula.release") version "17.2.0"
id("org.unbroken-dome.test-sets") version "4.0.0"
}
}

Expand Down

0 comments on commit 607d270

Please sign in to comment.