Skip to content

Commit 3baf42a

Browse files
authored
Update to gradle 7.5.1 (#415)
* Update to gradle 7.5.1 * Update to 7.5.1 * Fix * Fix
1 parent e7d07fd commit 3baf42a

File tree

8 files changed

+152
-104
lines changed

8 files changed

+152
-104
lines changed
Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
22

33
plugins {
4-
`java-platform`
4+
`java-platform`
55

6-
id("com.github.ben-manes.versions")
6+
id("com.github.ben-manes.versions")
77
}
88

99
data class DependencySet(val group: String, val version: String, val modules: List<String>)
@@ -15,103 +15,103 @@ rootProject.extra["versions"] = dependencyVersions
1515
val otelVersion = "1.17.0"
1616

1717
val DEPENDENCY_BOMS = listOf(
18-
"com.fasterxml.jackson:jackson-bom:2.13.2.20220328",
19-
"com.google.guava:guava-bom:31.0.1-jre",
20-
"com.linecorp.armeria:armeria-bom:1.14.0",
21-
"org.junit:junit-bom:5.8.2",
22-
"com.linecorp.armeria:armeria-bom:1.9.1",
23-
"io.grpc:grpc-bom:1.42.1",
24-
"io.opentelemetry:opentelemetry-bom:$otelVersion",
25-
"io.opentelemetry:opentelemetry-bom-alpha:${otelVersion}-alpha",
26-
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${otelVersion}-alpha",
27-
"org.testcontainers:testcontainers-bom:1.16.3"
18+
"com.fasterxml.jackson:jackson-bom:2.13.2.20220328",
19+
"com.google.guava:guava-bom:31.0.1-jre",
20+
"com.linecorp.armeria:armeria-bom:1.14.0",
21+
"org.junit:junit-bom:5.8.2",
22+
"com.linecorp.armeria:armeria-bom:1.9.1",
23+
"io.grpc:grpc-bom:1.42.1",
24+
"io.opentelemetry:opentelemetry-bom:$otelVersion",
25+
"io.opentelemetry:opentelemetry-bom-alpha:${otelVersion}-alpha",
26+
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${otelVersion}-alpha",
27+
"org.testcontainers:testcontainers-bom:1.16.3"
2828
)
2929

3030
val DEPENDENCY_SETS = listOf(
31-
DependencySet(
32-
"com.google.auto.service",
33-
"1.0.1",
34-
listOf("auto-service", "auto-service-annotations")
35-
),
36-
DependencySet(
37-
"com.google.auto.value",
38-
"1.9",
39-
listOf("auto-value", "auto-value-annotations")
40-
),
41-
DependencySet(
42-
"com.google.errorprone",
43-
"2.14.0",
44-
listOf("error_prone_annotations", "error_prone_core")
45-
),
46-
DependencySet(
47-
"io.prometheus",
48-
"0.12.0",
49-
listOf("simpleclient", "simpleclient_common", "simpleclient_httpserver")
50-
),
51-
DependencySet(
52-
"org.mockito",
53-
"4.3.1",
54-
listOf("mockito-core", "mockito-junit-jupiter")
55-
),
56-
DependencySet(
57-
"org.slf4j",
58-
"1.7.36",
59-
listOf("slf4j-api", "slf4j-simple", "log4j-over-slf4j", "jcl-over-slf4j", "jul-to-slf4j")
60-
)
31+
DependencySet(
32+
"com.google.auto.service",
33+
"1.0.1",
34+
listOf("auto-service", "auto-service-annotations")
35+
),
36+
DependencySet(
37+
"com.google.auto.value",
38+
"1.9",
39+
listOf("auto-value", "auto-value-annotations")
40+
),
41+
DependencySet(
42+
"com.google.errorprone",
43+
"2.14.0",
44+
listOf("error_prone_annotations", "error_prone_core")
45+
),
46+
DependencySet(
47+
"io.prometheus",
48+
"0.12.0",
49+
listOf("simpleclient", "simpleclient_common", "simpleclient_httpserver")
50+
),
51+
DependencySet(
52+
"org.mockito",
53+
"4.3.1",
54+
listOf("mockito-core", "mockito-junit-jupiter")
55+
),
56+
DependencySet(
57+
"org.slf4j",
58+
"1.7.36",
59+
listOf("slf4j-api", "slf4j-simple", "log4j-over-slf4j", "jcl-over-slf4j", "jul-to-slf4j")
60+
)
6161
)
6262

6363
val DEPENDENCIES = listOf(
64-
"io.opentelemetry.javaagent:opentelemetry-javaagent:$otelVersion",
65-
"com.google.code.findbugs:annotations:3.0.1u2",
66-
"com.google.code.findbugs:jsr305:3.0.2",
67-
"com.squareup.okhttp3:okhttp:4.9.3",
68-
"com.uber.nullaway:nullaway:0.9.5",
69-
"org.assertj:assertj-core:3.22.0",
70-
"org.awaitility:awaitility:4.1.1",
71-
"org.junit-pioneer:junit-pioneer:1.5.0",
72-
"org.skyscreamer:jsonassert:1.5.0"
64+
"io.opentelemetry.javaagent:opentelemetry-javaagent:$otelVersion",
65+
"com.google.code.findbugs:annotations:3.0.1u2",
66+
"com.google.code.findbugs:jsr305:3.0.2",
67+
"com.squareup.okhttp3:okhttp:4.9.3",
68+
"com.uber.nullaway:nullaway:0.9.5",
69+
"org.assertj:assertj-core:3.22.0",
70+
"org.awaitility:awaitility:4.1.1",
71+
"org.junit-pioneer:junit-pioneer:1.7.0",
72+
"org.skyscreamer:jsonassert:1.5.0"
7373
)
7474

7575
javaPlatform {
76-
allowDependencies()
76+
allowDependencies()
7777
}
7878

7979
dependencies {
80-
for (bom in DEPENDENCY_BOMS) {
81-
api(enforcedPlatform(bom))
82-
val split = bom.split(':')
83-
dependencyVersions[split[0]] = split[2]
80+
for (bom in DEPENDENCY_BOMS) {
81+
api(enforcedPlatform(bom))
82+
val split = bom.split(':')
83+
dependencyVersions[split[0]] = split[2]
84+
}
85+
constraints {
86+
for (set in DEPENDENCY_SETS) {
87+
for (module in set.modules) {
88+
api("${set.group}:${module}:${set.version}")
89+
dependencyVersions[set.group] = set.version
90+
}
8491
}
85-
constraints {
86-
for (set in DEPENDENCY_SETS) {
87-
for (module in set.modules) {
88-
api("${set.group}:${module}:${set.version}")
89-
dependencyVersions[set.group] = set.version
90-
}
91-
}
92-
for (dependency in DEPENDENCIES) {
93-
api(dependency)
94-
val split = dependency.split(':')
95-
dependencyVersions[split[0]] = split[2]
96-
}
92+
for (dependency in DEPENDENCIES) {
93+
api(dependency)
94+
val split = dependency.split(':')
95+
dependencyVersions[split[0]] = split[2]
9796
}
97+
}
9898
}
9999

100100
fun isNonStable(version: String): Boolean {
101-
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
102-
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
103-
val isGuava = version.endsWith("-jre")
104-
val isStable = stableKeyword || regex.matches(version) || isGuava
105-
return isStable.not()
101+
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
102+
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
103+
val isGuava = version.endsWith("-jre")
104+
val isStable = stableKeyword || regex.matches(version) || isGuava
105+
return isStable.not()
106106
}
107107

108108
tasks {
109-
named<DependencyUpdatesTask>("dependencyUpdates") {
110-
revision = "release"
111-
checkConstraints = true
109+
named<DependencyUpdatesTask>("dependencyUpdates") {
110+
revision = "release"
111+
checkConstraints = true
112112

113-
rejectVersionIf {
114-
isNonStable(candidate.version)
115-
}
113+
rejectVersionIf {
114+
isNonStable(candidate.version)
116115
}
116+
}
117117
}

gradle/wrapper/gradle-wrapper.jar

1.19 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
54
zipStoreBase=GRADLE_USER_HOME
65
zipStorePath=wrapper/dists

gradlew

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ set -- \
205205
org.gradle.wrapper.GradleWrapperMain \
206206
"$@"
207207

208+
# Stop when "xargs" is not available.
209+
if ! command -v xargs >/dev/null 2>&1
210+
then
211+
die "xargs is not available"
212+
fi
213+
208214
# Use "xargs" to parse quoted args.
209215
#
210216
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
43+
if %ERRORLEVEL% equ 0 goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7575

7676
:end
7777
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
78+
if %ERRORLEVEL% equ 0 goto mainEnd
7979

8080
:fail
8181
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8282
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
83+
set EXIT_CODE=%ERRORLEVEL%
84+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
85+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
86+
exit /b %EXIT_CODE%
8587

8688
:mainEnd
8789
if "%OS%"=="Windows_NT" endlocal

runtime-attach/runtime-attach/build.gradle.kts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@ dependencies {
2020
testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent")
2121
testImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations")
2222
testImplementation("org.junit.jupiter:junit-jupiter-api")
23-
testImplementation("org.junit-pioneer:junit-pioneer")
2423
testImplementation("org.assertj:assertj-core")
2524
}
2625

27-
tasks.test {
28-
useJUnitPlatform()
29-
setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class
30-
}
31-
3226
tasks {
3327
jar {
3428
inputs.files(agent)
@@ -37,4 +31,36 @@ tasks {
3731
})
3832
rename { "otel-agent.jar" }
3933
}
34+
35+
withType<Test>().configureEach {
36+
setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class
37+
}
38+
39+
val testAgentDisabledByEnvironmentVariable by registering(Test::class) {
40+
filter {
41+
includeTestsMatching("AgentDisabledByEnvironmentVariableTest")
42+
}
43+
include("**/AgentDisabledByEnvironmentVariableTest.*")
44+
environment("OTEL_JAVAAGENT_ENABLED", "false")
45+
}
46+
47+
val testAgentDisabledBySystemProperty by registering(Test::class) {
48+
filter {
49+
includeTestsMatching("AgentDisabledBySystemPropertyTest")
50+
}
51+
include("**/AgentDisabledBySystemPropertyTest.*")
52+
jvmArgs("-Dotel.javaagent.enabled=false")
53+
}
54+
55+
test {
56+
filter {
57+
excludeTestsMatching("AgentDisabledByEnvironmentVariableTest")
58+
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
59+
}
60+
}
61+
62+
check {
63+
dependsOn(testAgentDisabledByEnvironmentVariable)
64+
dependsOn(testAgentDisabledBySystemProperty)
65+
}
4066
}

runtime-attach/runtime-attach/src/test/java/io/opentelemetry/contrib/attach/AgentDisabledTest.java renamed to runtime-attach/runtime-attach/src/test/java/io/opentelemetry/contrib/attach/AgentDisabledByEnvironmentVariableTest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99

1010
import io.opentelemetry.instrumentation.annotations.WithSpan;
1111
import org.junit.jupiter.api.Test;
12-
import org.junitpioneer.jupiter.SetEnvironmentVariable;
13-
import org.junitpioneer.jupiter.SetSystemProperty;
1412

15-
public class AgentDisabledTest extends AbstractAttachmentTest {
13+
public class AgentDisabledByEnvironmentVariableTest extends AbstractAttachmentTest {
1614

17-
@SetEnvironmentVariable(key = "OTEL_JAVAAGENT_ENABLED", value = "false")
1815
@Test
1916
void shouldNotAttachWhenAgentDisabledWithEnvVariable() {
2017
RuntimeAttach.attachJavaagentToCurrentJVM();
@@ -25,11 +22,4 @@ void shouldNotAttachWhenAgentDisabledWithEnvVariable() {
2522
void verifyNoAttachment() {
2623
assertThat(isAttached()).as("Agent should not be attached").isFalse();
2724
}
28-
29-
@SetSystemProperty(key = "otel.javaagent.enabled", value = "false")
30-
@Test
31-
void shouldNotAttachWhenAgentDisabledWithProperty() {
32-
RuntimeAttach.attachJavaagentToCurrentJVM();
33-
verifyNoAttachment();
34-
}
3525
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.contrib.attach;
7+
8+
import static org.assertj.core.api.Assertions.assertThat;
9+
10+
import io.opentelemetry.instrumentation.annotations.WithSpan;
11+
import org.junit.jupiter.api.Test;
12+
13+
public class AgentDisabledBySystemPropertyTest extends AbstractAttachmentTest {
14+
15+
@Test
16+
void shouldNotAttachWhenAgentDisabledWithProperty() {
17+
RuntimeAttach.attachJavaagentToCurrentJVM();
18+
verifyNoAttachment();
19+
}
20+
21+
@WithSpan
22+
void verifyNoAttachment() {
23+
assertThat(isAttached()).as("Agent should not be attached").isFalse();
24+
}
25+
}

0 commit comments

Comments
 (0)