Skip to content

Commit

Permalink
Merge pull request #1819 from newrelic/java-22
Browse files Browse the repository at this point in the history
First pass of J22 support
  • Loading branch information
jtduffy authored Apr 15, 2024
2 parents a844a91 + 35552b8 commit e758975
Show file tree
Hide file tree
Showing 41 changed files with 194 additions and 119 deletions.
6 changes: 4 additions & 2 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ runs:
with:
distribution: 'temurin'
java-version: |
22
21
17
11
Expand All @@ -29,7 +30,8 @@ runs:
sed -i -e "s|jdk8=8|jdk8=${JAVA_HOME_8_X64}|
s|jdk11=11|jdk11=${JAVA_HOME_11_X64}|
s|jdk17=17|jdk17=${JAVA_HOME_17_X64}|
s|jdk21=21|jdk21=${JAVA_HOME_21_X64}|" gradle.properties.gha
s|jdk21=21|jdk21=${JAVA_HOME_21_X64}|
s|jdk22=22|jdk22=${JAVA_HOME_22_X64}|" gradle.properties.gha
cat gradle.properties.gha >> gradle.properties
- name: Setup Gradle
Expand All @@ -39,7 +41,7 @@ runs:

- name: Setup Gradle options
shell: bash
run: echo "GRADLE_OPTIONS=--console=plain --parallel -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64,JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64" >> $GITHUB_ENV
run: echo "GRADLE_OPTIONS=--console=plain --parallel -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64,JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64,JAVA_HOME_22_X64" >> $GITHUB_ENV

- name: Download S3 instrumentation jar zip
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/GHA-Functional-Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
##max-parallel: 1 ## used to force sequential
fail-fast: false
matrix:
java-version: [8, 11, 17, 21]
java-version: [8, 11, 17, 21, 22]
steps:
- name: Checkout Java agent
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/GHA-Unit-Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# max-parallel: 1 ## used to force sequential vs. concurrent
fail-fast: false
matrix:
java-version: [8, 11, 17, 21]
java-version: [8, 11, 17, 21, 22]
steps:
- name: Checkout Java agent
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Java-Instrumentation-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java-version: [8, 11, 17, 21]
java-version: [8, 11, 17, 21, 22]
name: Java ${{ matrix.java-version }}
timeout-minutes: 120
# needs: install-all-java
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/Test-AITs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ jobs:
with:
distribution: 'zulu'
java-version: |
22
21
17
11
Expand All @@ -209,12 +210,14 @@ jobs:
echo "JDK_zulu_11=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
echo "JDK_zulu_17=${JAVA_HOME_17_X64}" >> $GITHUB_ENV
echo "JDK_zulu_21=${JAVA_HOME_21_X64}" >> $GITHUB_ENV
echo "JDK_zulu_22=${JAVA_HOME_22_X64}" >> $GITHUB_ENV
- name: Set up Javas
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
22
21
17
11
Expand Down Expand Up @@ -264,6 +267,15 @@ jobs:
<jdkHome>${JAVA_HOME_21_X64}</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>22</version>
</provides>
<configuration>
<jdkHome>${JAVA_HOME_22_X64}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
Expand Down Expand Up @@ -298,10 +310,12 @@ jobs:
ZULU11=${JDK_zulu_11} \
ZULU17=${JDK_zulu_17} \
ZULU21=${JDK_zulu_21} \
ZULU22=${JDK_zulu_22} \
JAVA8JRE=${JAVA_HOME_8_X64} \
JAVA11JRE=${JAVA_HOME_11_X64} \
JAVA17JRE=${JAVA_HOME_17_X64} \
JAVA21JRE=${JAVA_HOME_21_X64} \
JAVA22JRE=${JAVA_HOME_22_X64} \
conf/autoconfigure
. conf/testenv java
cat conf/java_local_config.yml
Expand Down
1 change: 1 addition & 0 deletions agent-bridge-datastore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
}

apply from: '../gradle/script/spotbugs-config.gradle'
apply from: '../gradle/script/jacoco.gradle'

jar {
from("$rootDir/LICENSE")
Expand Down
1 change: 1 addition & 0 deletions agent-bridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
}

apply from: '../gradle/script/spotbugs-config.gradle'
apply from: '../gradle/script/jacoco.gradle'

jar {
from("$rootDir/LICENSE")
Expand Down
1 change: 1 addition & 0 deletions agent-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

apply from: '../gradle/script/spotbugs-config.gradle'
apply from: '../gradle/script/jacoco.gradle'

dependencies {
api 'com.googlecode.json-simple:json-simple:1.1'
Expand Down
1 change: 1 addition & 0 deletions discovery/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apply from: '../gradle/script/jacoco.gradle'

dependencies {
implementation("com.googlecode.json-simple:json-simple:1.1")
Expand Down
2 changes: 1 addition & 1 deletion functional_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ test {
//testLogging.showStandardStreams = true

// when using an early access Java version, we need to pass an extra param to the agent
if (project.hasProperty("test22")) {
if (project.hasProperty("test23")) {
jvmArgs += ["-Dnewrelic.config.experimental_runtime=true"]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.newrelic.test.marker.IBMJ9IncompatibleTest;
import com.newrelic.test.marker.Java17IncompatibleTest;
import com.newrelic.test.marker.Java21IncompatibleTest;
import com.newrelic.test.marker.Java22IncompatibleTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand Down Expand Up @@ -68,7 +69,7 @@ public void testMissingNewRelicClass() throws ClassNotFoundException {

// Java 12 no longer lets us access the declared field
@Test
@Category({ IBMJ9IncompatibleTest.class, Java17IncompatibleTest.class, Java21IncompatibleTest.class })
@Category({ IBMJ9IncompatibleTest.class, Java17IncompatibleTest.class, Java21IncompatibleTest.class, Java22IncompatibleTest.class })
public void testSetSystemClassLoader() throws Exception {

final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
import com.newrelic.test.marker.Java11IncompatibleTest;
import com.newrelic.test.marker.Java17IncompatibleTest;
import com.newrelic.test.marker.Java21IncompatibleTest;
import com.newrelic.test.marker.Java22IncompatibleTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import javax.activation.MimeType;
import java.util.HashMap;
import java.util.Map;

@Category({ Java11IncompatibleTest.class, Java17IncompatibleTest.class, Java21IncompatibleTest.class })
@Category({ Java11IncompatibleTest.class, Java17IncompatibleTest.class, Java21IncompatibleTest.class, Java22IncompatibleTest.class })
public class ClassRetransformBootstrapTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import com.newrelic.test.marker.Java11IncompatibleTest;
import com.newrelic.test.marker.Java17IncompatibleTest;
import com.newrelic.test.marker.Java21IncompatibleTest;
import com.newrelic.test.marker.Java22IncompatibleTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.Mockito;

import javax.activation.MimeType;

@Category({ Java11IncompatibleTest.class, Java17IncompatibleTest.class, Java21IncompatibleTest.class })
@Category({ Java11IncompatibleTest.class, Java17IncompatibleTest.class, Java21IncompatibleTest.class, Java22IncompatibleTest.class })
public class CustomExtensionTestAddition {

@Test
Expand Down
1 change: 1 addition & 0 deletions gradle.properties.gha
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ jdk8=8
jdk11=11
jdk17=17
jdk21=21
jdk22=22
74 changes: 74 additions & 0 deletions gradle/script/jacoco.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apply plugin: 'java'
apply plugin: 'jacoco'

jacoco{
toolVersion = "0.8.11"
}

test {
jacoco {
enabled = true
destinationFile = layout.buildDirectory.file('jacoco/test.exec').get().asFile
classDumpDir = layout.buildDirectory.dir('jacoco/classpathdumps').get().asFile
destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile

}
finalizedBy jacocoTestReport // report is always generated after tests run
}

jacocoTestReport {

dependsOn test
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['**/*NoOp*.class',
'**/*Exception.class',
'**/*Error.class',
'**/Dummy*.class',
'**/*Type.class',
'**/*Type$*.class',
'**/*Parameters.class',
'**/*Parameters$*.class',
'com/newrelic/agent/InternalLimitExceeded.class',
'com/newrelic/agent/PrivateApiImpl.class',
'com/newrelic/agent/introspec/*.class',
'com/newrelic/agent/jmx/metrics/*Generator.class',
'com/newrelic/agent/jmx/metrics/*Generator$*.class',
'com/newrelic/agent/bridge/external/ExternalParametersFactory.class',
'com/newrelic/agent/instrumentation/tracing/TraceDetailsBuilder*.class',
'com/newrelic/agent/model/ApdexPerfZone.class',
'com/newrelic/agent/model/CountedDuration.class',
'com/newrelic/agent/model/PathHashes.class',
'com/newrelic/agent/model/SpanCategory.class',
'com/newrelic/agent/model/SyntheticsIds.class',
'com/newrelic/agent/model/TimeoutCause.class',
'com/newrelic/agent/model/TransactionTiming.class',
'com/newrelic/agent/model/TransactionTiming$*.class',
'com/newrelic/api/agent/NewRelic.class',
'com/newrelic/weave/verification/*.class',
'com/newrelic/agent/bridge/datastore/DatastoreMetrics.class',
'com/newrelic/api/agent/ApplicationNamePriority.class',
'com/newrelic/agent/bridge/TransactionNamePriority.class',
'com/newrelic/weave/utils/Synchronized*.class',
'com/newrelic/agent/introspec/internal/IgnoringJarCollectorService.class',
'com/newrelic/agent/introspec/internal/FailingWeavePackageListener.class',
'com/newrelic/agent/tracers/UltraLightTracer.class',
'com/newrelic/agent/core/CoreServiceImpl.class',
'com/newrelic/agent/Deployments.class',
'com/newrelic/agent/LifecycleObserver$*.class',
'com/newrelic/agent/LifecycleObserver.class',
'com/newrelic/agent/InitProblemClasses.class',
'com/newrelic/agent/reinstrument/ReinstrumentUtils.class',
'com/newrelic/agent/AsyncApiImpl.class',
'com/newrelic/agent/tracers/jasper/JasperClassFactory.class',
'com/newrelic/agent/tracers/jasper/GeneratorVisitTracerFactory.class'
])
}))
}
reports {
xml.required = true
html.outputLocation = layout.buildDirectory.dir('reports/jacoco')
}

}
88 changes: 16 additions & 72 deletions gradle/script/java.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'jacoco'

jacoco{
toolVersion = "0.8.10"
}
configurations {
includeInJar
}
Expand Down Expand Up @@ -117,6 +113,22 @@ test {
configuration.call()
}

if (project.hasProperty("test22")) {
configureTest("jdk22") {
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/java.net=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/sun.net.spi=ALL-UNNAMED',
'--add-exports=java.base/sun.net.spi=ALL-UNNAMED',
'--add-exports=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED'
useJUnit {
excludeCategories 'com.newrelic.test.marker.Java22IncompatibleTest'
}
}
// mockito uses a version of bytebuddy that has experimental support for Java 21
systemProperty("net.bytebuddy.experimental", "true")
}
if (project.hasProperty("test21")) {
configureTest("jdk21") {
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED',
Expand Down Expand Up @@ -210,74 +222,6 @@ test {
events "FAILED" // additional events for more verbose logging: "PASSED", "SKIPPED", "STANDARD_OUT", "STANDARD_ERROR", "STARTED"
exceptionFormat "short"
}

jacoco {
enabled = true
destinationFile = layout.buildDirectory.file('jacoco/test.exec').get().asFile
classDumpDir = layout.buildDirectory.dir('jacoco/classpathdumps').get().asFile
destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile

}
finalizedBy jacocoTestReport // report is always generated after tests run

}


jacocoTestReport {

dependsOn test
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['**/*NoOp*.class',
'**/*Exception.class',
'**/*Error.class',
'**/Dummy*.class',
'**/*Type.class',
'**/*Type$*.class',
'**/*Parameters.class',
'**/*Parameters$*.class',
'com/newrelic/agent/InternalLimitExceeded.class',
'com/newrelic/agent/PrivateApiImpl.class',
'com/newrelic/agent/introspec/*.class',
'com/newrelic/agent/jmx/metrics/*Generator.class',
'com/newrelic/agent/jmx/metrics/*Generator$*.class',
'com/newrelic/agent/bridge/external/ExternalParametersFactory.class',
'com/newrelic/agent/instrumentation/tracing/TraceDetailsBuilder*.class',
'com/newrelic/agent/model/ApdexPerfZone.class',
'com/newrelic/agent/model/CountedDuration.class',
'com/newrelic/agent/model/PathHashes.class',
'com/newrelic/agent/model/SpanCategory.class',
'com/newrelic/agent/model/SyntheticsIds.class',
'com/newrelic/agent/model/TimeoutCause.class',
'com/newrelic/agent/model/TransactionTiming.class',
'com/newrelic/agent/model/TransactionTiming$*.class',
'com/newrelic/api/agent/NewRelic.class',
'com/newrelic/weave/verification/*.class',
'com/newrelic/agent/bridge/datastore/DatastoreMetrics.class',
'com/newrelic/api/agent/ApplicationNamePriority.class',
'com/newrelic/agent/bridge/TransactionNamePriority.class',
'com/newrelic/weave/utils/Synchronized*.class',
'com/newrelic/agent/introspec/internal/IgnoringJarCollectorService.class',
'com/newrelic/agent/introspec/internal/FailingWeavePackageListener.class',
'com/newrelic/agent/tracers/UltraLightTracer.class',
'com/newrelic/agent/core/CoreServiceImpl.class',
'com/newrelic/agent/Deployments.class',
'com/newrelic/agent/LifecycleObserver$*.class',
'com/newrelic/agent/LifecycleObserver.class',
'com/newrelic/agent/InitProblemClasses.class',
'com/newrelic/agent/reinstrument/ReinstrumentUtils.class',
'com/newrelic/agent/AsyncApiImpl.class',
'com/newrelic/agent/tracers/jasper/JasperClassFactory.class',
'com/newrelic/agent/tracers/jasper/GeneratorVisitTracerFactory.class'
])
}))
}
reports {
xml.required = true
html.outputLocation = layout.buildDirectory.dir('reports/jacoco')
}

}

dependencies {
Expand Down
2 changes: 2 additions & 0 deletions instrumentation-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
evaluationDependsOn(":newrelic-agent")

apply from: '../gradle/script/jacoco.gradle'

dependencies {
// Instrumentation-test (this project) serves as a consolidation point for
// multiple types of dependencies. Beyond the introspector, many of these dependencies
Expand Down
Loading

0 comments on commit e758975

Please sign in to comment.