Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 21 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ save_cache_paths: &save_cache_paths

test_matrix: &test_matrix
parameters:
testTask: [ "7", "IBM8", "ZULU8","ORACLE8", "11", "ZULU11", "ZULU13", "15" ]
testJvm: [ "7", "IBM8", "ZULU8","ORACLE8", "11", "ZULU11", "ZULU13", "15" ]

parameters:
gradle_flags:
Expand Down Expand Up @@ -172,9 +172,10 @@ jobs:
parameters:
testTask:
type: string
prefixTestTask:
default: false
type: boolean
default: "test"
testJvm:
type: string
default: ""

steps:
- setup_code
Expand All @@ -187,7 +188,8 @@ jobs:
command: >-
MAVEN_OPTS="-Xms64M -Xmx512M"
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx1940M -Xms512M -XX:ErrorFile=/tmp/hs_err_pid%p.log' -Ddatadog.forkedMaxHeapSize=512M -Ddatadog.forkedMinHeapSize=128M"
./gradlew <<# parameters.prefixTestTask>>testJava<</ parameters.prefixTestTask>><< parameters.testTask >> -PskipInstTests -PskipSmokeTests
./gradlew << parameters.testTask >> -PskipInstTests -PskipSmokeTests
<<# parameters.testJvm >>-PtestJvm=<< parameters.testJvm >><</ parameters.testJvm >>
<< pipeline.parameters.gradle_flags >>
--max-workers=8
--continue
Expand Down Expand Up @@ -245,13 +247,6 @@ jobs:
POSTGRES_PASSWORD: sa
POSTGRES_DB: jdbcUnitTest

parameters:
testTask:
type: string
prefixTestTask:
default: false
type: boolean

steps:
- setup_code

Expand All @@ -263,7 +258,8 @@ jobs:
command: >-
MAVEN_OPTS="-Xms64M -Xmx512M"
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx1940M -Xms512M -XX:ErrorFile=/tmp/hs_err_pid%p.log' -Ddatadog.forkedMaxHeapSize=512M -Ddatadog.forkedMinHeapSize=128M"
./gradlew :dd-java-agent:instrumentation:<<# parameters.prefixTestTask>>testJava<</ parameters.prefixTestTask>><< parameters.testTask >>
./gradlew :dd-java-agent:instrumentation:<< parameters.testTask >>
<<# parameters.testJvm >>-PtestJvm=<< parameters.testJvm >><</ parameters.testJvm >>
<< pipeline.parameters.gradle_flags >>
--max-workers=6
--continue
Expand Down Expand Up @@ -304,13 +300,6 @@ jobs:
# This is used by mongodb smoke tests
- image: mongo

parameters:
testTask:
type: string
prefixTestTask:
default: false
type: boolean

steps:
- setup_code

Expand All @@ -322,7 +311,8 @@ jobs:
command: >-
MAVEN_OPTS="-Xms64M -Xmx512M"
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx1750M -Xms512M -XX:ErrorFile=/tmp/hs_err_pid%p.log' -Ddatadog.forkedMaxHeapSize=512M -Ddatadog.forkedMinHeapSize=128M"
./gradlew stageMainDist :dd-smoke-test:<<# parameters.prefixTestTask>>testJava<</ parameters.prefixTestTask>><< parameters.testTask >>
./gradlew stageMainDist :dd-smoke-test:<< parameters.testTask >>
<<# parameters.testJvm >>-PtestJvm=<< parameters.testJvm >><</ parameters.testJvm >>
<< pipeline.parameters.gradle_flags >>
--max-workers=2
--continue
Expand Down Expand Up @@ -362,12 +352,12 @@ jobs:
- image: alpine

parameters:
testTask:
testJvm:
type: string

steps:
- run:
name: All tests for << parameters.testTask >> passed!
name: All tests for << parameters.testJvm >> passed!
command: echo 'All tests passed!'

agent_integration_tests:
Expand Down Expand Up @@ -472,8 +462,7 @@ build_test_jobs: &build_test_jobs
- base_tests:
requires:
- build
prefixTestTask: true
name: z_test_<< matrix.testTask >>_base
name: z_test_<< matrix.testJvm >>_base
matrix:
<<: *test_matrix

Expand All @@ -486,16 +475,14 @@ build_test_jobs: &build_test_jobs
- instrumentation_tests:
requires:
- build
prefixTestTask: true
name: z_test_<< matrix.testTask >>_inst
name: z_test_<< matrix.testJvm >>_inst
matrix:
<<: *test_matrix

- instrumentation_tests:
requires:
- build
name: z_test_8_inst
testTask: test

- instrumentation_tests:
requires:
Expand All @@ -506,23 +493,21 @@ build_test_jobs: &build_test_jobs
- smoke_tests:
requires:
- build
prefixTestTask: true
name: z_test_<< matrix.testTask >>_smoke
name: z_test_<< matrix.testJvm >>_smoke
matrix:
<<: *test_matrix

- smoke_tests:
requires:
- build
name: z_test_8_smoke
testTask: test

- fan_in:
requires:
- z_test_<< matrix.testTask >>_base
- z_test_<< matrix.testTask >>_inst
- z_test_<< matrix.testTask >>_smoke
name: test_<< matrix.testTask >>
- z_test_<< matrix.testJvm >>_base
- z_test_<< matrix.testJvm >>_inst
- z_test_<< matrix.testJvm >>_smoke
name: test_<< matrix.testJvm >>
matrix:
<<: *test_matrix

Expand All @@ -532,7 +517,7 @@ build_test_jobs: &build_test_jobs
- z_test_8_inst
- z_test_8_smoke
name: test_8
testTask: "8"
testJvm: "8"

- agent_integration_tests:
requires:
Expand Down
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ and discuss your ideas or propose the changes you wish to make. After a resoluti

## Requirements

To build the full project from the command line you need to have JDK versions for 7,8,11, and 14 installed on your machine, as well as the following environment variables set up: `JAVA_7_HOME, JAVA_8_HOME, JAVA_11_HOME, JAVA_14_HOME`, pointing to the respective JDK.
To build the full project from the command line you need to have JDK versions for 8 and 11 installed on your machine, as well as the following environment variables set up: `JAVA_8_HOME, JAVA_11_HOME`, pointing to the respective JDK.

In contrast to the [IntelliJ IDEA setup](#intellij-idea) the default JVM to build and run tests from the command line should be Java 8.

Expand Down Expand Up @@ -186,3 +186,13 @@ Suggested plugins and settings:
* IntelliJ Gradle fails to import the project with `JAVA_11_HOME must be set to build Java 11 code`
* A workaround is to run IntelliJ from terminal with `JAVA_11_HOME`
* In order to verify what's visible from IntelliJ use `Add Configuration` bar and go to `Add New` -> `Gradle` -> `Environmental Variables`

## Running tests on another JVM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!


To run tests on a different JVM than the one used for doing the build, you need two things:

1) An environment variable pointing to the JVM to use on the form `JAVA_[JDKNAME]_HOME`, i.e. `JAVA_ZULU15_HOME`

2) A command line option to the gradle task on the form `-PtestJvm=[JDKNAME]`, i.e. `-PtestJvm=ZULU15`

Please note that the JDK name needs to end with the JDK version, i.e. `11`, `ZULU15`, `ORACLE8`, et.c.
3 changes: 0 additions & 3 deletions communication/communication.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
apply from: "$rootDir/gradle/java.gradle"

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
implementation deps.slf4j

Expand Down
12 changes: 6 additions & 6 deletions dd-java-agent/agent-bootstrap/agent-bootstrap.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ sourceSets {
java.srcDirs "${project.projectDir}/src/main/java11"
}
}
compileMain_java11Java.doFirst {
if (!System.env.JAVA_11_HOME) {
throw new GradleException('JAVA_11_HOME must be set to build profiling helpers')
}
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)

compileMain_java11Java.configure {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
setJavaVersion(it, 11)
}

dependencies {
main_java11CompileOnly project(':internal-api:internal-api-8')
}

jar {
from sourceSets.main_java11.output
}

idea {
module {
jdkName = '11'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,11 @@ configurations.all {

[JavaCompile, GroovyCompile].each {
tasks.withType(it).configureEach {
doFirst {
if (!System.env.JAVA_11_HOME) {
throw new GradleException('JAVA_11_HOME must be set to build profiling auxiliary')
}
// Disable '-processing' because some annotations are not claimed.
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
// Disable '-path' because we do not have some of the paths seem to be missing.
options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'/*, '-Werror'*/])
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
}
setJavaVersion(it, 11)
// Disable '-processing' because some annotations are not claimed.
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
// Disable '-path' because we do not have some of the paths seem to be missing.
options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'/*, '-Werror'*/])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,11 @@ targetCompatibility = JavaVersion.VERSION_1_8

[JavaCompile, GroovyCompile].each {
tasks.withType(it).configureEach {
doFirst {
if (!System.env.JAVA_11_HOME) {
throw new GradleException('JAVA_11_HOME must be set to build profiling controller')
}
// Disable '-processing' because some annotations are not claimed.
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
// Disable '-path' because we do not have some of the paths seem to be missing.
options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'/*, '-Werror'*/])
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
}
setJavaVersion(it, 11)
// Disable '-processing' because some annotations are not claimed.
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
// Disable '-path' because we do not have some of the paths seem to be missing.
options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'/*, '-Werror'*/])
}
}

Expand Down
17 changes: 9 additions & 8 deletions dd-java-agent/agent-tooling/agent-tooling.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,27 @@ sourceSets {
java.srcDirs "${project.projectDir}/src/main/java11"
}
}
compileMain_java11Java.doFirst {
if (!System.env.JAVA_11_HOME) {
throw new GradleException('JAVA_11_HOME must be set to build transformer helpers')
}
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9

compileMain_java11Java.configure {
sourceCompatibility = JavaVersion.VERSION_1_8
Comment thread
charliegracie marked this conversation as resolved.
targetCompatibility = JavaVersion.VERSION_1_8
setJavaVersion(it, 11)
}

dependencies {
main_java11CompileOnly deps.bytebuddy
main_java11CompileOnly sourceSets.main.output
runtimeOnly sourceSets.main_java11.output
}

jar {
from sourceSets.main_java11.output
}

forbiddenApisMain_java11 {
failOnMissingClasses = false
}

idea {
module {
jdkName = '11'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply from: "$rootDir/gradle/java.gradle"

sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

dependencies {
api 'javax.servlet:servlet-api:2.4'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Set properties before any plugins get loaded
ext {
minJavaVersionForTests = JavaVersion.VERSION_1_8
lagomTestMaxJavaVersionForTests = JavaVersion.VERSION_1_8
}

apply from: "$rootDir/gradle/java.gradle"
Expand All @@ -23,13 +24,13 @@ testSets {
}

compileLagomTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

compileLagomTestGroovy {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

muzzle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,12 @@ dependencies {
testImplementation deps.mockito
}

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

// Must use Java 11 to build JFR enabled code - there is no JFR in OpenJDK 8 (revisit once JFR in Java 8 is available)
[compileMain_java11Java, compileTestJava].each {
it.sourceCompatibility = JavaVersion.VERSION_1_8
it.targetCompatibility = JavaVersion.VERSION_1_8
it.doFirst {
if (!System.env.JAVA_11_HOME) {
throw new GradleException('JAVA_11_HOME must be set to build profiling instrumentation')
}
// Disable '-processing' because some annotations are not claimed.
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
// Disable '-path' because we do not have some of the paths seem to be missing.
// Compile to 8 compatible byte code
options.compilerArgs.addAll([
'-source',
'8',
'-target',
'8',
'-Xlint:all,-processing,-options,-path'
])
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
}
setJavaVersion(it, 11)
it.options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'])
}

idea {
Expand Down
Loading