Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Spotless for formatting #1619

Merged
merged 7 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply spotless to gradle files.
  • Loading branch information
tylerbenson committed Jun 19, 2020
commit 5e3783ca84041b3134a36e10dedf170afa894087
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ dependencies {
}

/*
Setup here is as following:
* We compile with Java11 compiler to get JFR definitions.
* We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible.
* We force IDEA to treat this as Java11 project with 'idea' plugin below.
Setup here is as following:
* We compile with Java11 compiler to get JFR definitions.
* We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible.
* We force IDEA to treat this as Java11 project with 'idea' plugin below.
*/
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -36,7 +36,9 @@ targetCompatibility = JavaVersion.VERSION_1_8
// 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.compilerArgs.addAll([
'-Xlint:all,-processing,-options,-path'/*, '-Werror'*/
])
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ dependencies {

jar {
manifest {
attributes(
"Main-Class": "datadog.perftest.jetty.JettyPerftest"
)
attributes("Main-Class": "datadog.perftest.jetty.JettyPerftest")
}
}
29 changes: 16 additions & 13 deletions dd-java-agent/benchmark/benchmark.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,26 @@ jmh {
timeOnIteration = '20s'
iterations = 1 // Number of measurement iterations to do.
fork = 1 // How many times to forks a single benchmark. Use 0 to disable forking altogether
jvmArgs = ["-Ddd.jmxfetch.enabled=false", "-Ddd.writer.type=LoggingWriter"]
// jvmArgs += ["-XX:+UnlockDiagnosticVMOptions", "-XX:+DebugNonSafepoints", "-XX:StartFlightRecording=delay=5s,dumponexit=true,name=jmh-benchmark,filename=$rootDir/dd-java-agent/benchmark/build/reports/jmh/jmh-benchmark.jfr"]
// jvmArgs += ["-agentpath:$rootDir/dd-java-agent/benchmark/src/jmh/resources/libasyncProfiler.so=start,collapsed,file=$rootDir/dd-java-agent/benchmark/build/reports/jmh/profiler.txt".toString()]
jvmArgs = [
"-Ddd.jmxfetch.enabled=false",
"-Ddd.writer.type=LoggingWriter"
]
// jvmArgs += ["-XX:+UnlockDiagnosticVMOptions", "-XX:+DebugNonSafepoints", "-XX:StartFlightRecording=delay=5s,dumponexit=true,name=jmh-benchmark,filename=$rootDir/dd-java-agent/benchmark/build/reports/jmh/jmh-benchmark.jfr"]
// jvmArgs += ["-agentpath:$rootDir/dd-java-agent/benchmark/src/jmh/resources/libasyncProfiler.so=start,collapsed,file=$rootDir/dd-java-agent/benchmark/build/reports/jmh/profiler.txt".toString()]
failOnError = true // Should JMH fail immediately if any benchmark had experienced the unrecoverable error?
warmup = '5s' // Time to spend at each warmup iteration.
// warmupBatchSize = 10 // Warmup batch size: number of benchmark method calls per operation.
// warmupBatchSize = 10 // Warmup batch size: number of benchmark method calls per operation.
warmupForks = 0 // How many warmup forks to make for a single benchmark. 0 to disable warmup forks.
warmupIterations = 1 // Number of warmup iterations to do.

// profilers = ['stack:lines=5;detailLine=true;period=5;excludePackages=true']
// profilers = ['stack:lines=5;detailLine=true;period=5;excludePackages=true']
// Use profilers to collect additional data. Supported profilers: [cl, comp, gc, stack, perf, perfnorm, perfasm, xperf, xperfasm, hs_cl, hs_comp, hs_gc, hs_rt, hs_thr]

// humanOutputFile = project.file("${project.buildDir}/reports/jmh/human.txt") // human-readable output file
// operationsPerInvocation = 10 // Operations per invocation.
// synchronizeIterations = false // Synchronize iterations?
// humanOutputFile = project.file("${project.buildDir}/reports/jmh/human.txt") // human-readable output file
// operationsPerInvocation = 10 // Operations per invocation.
// synchronizeIterations = false // Synchronize iterations?
timeout = '5s' // Timeout for benchmark iteration.
// includeTests = false
// includeTests = false
// Allows to include test sources into generate JMH jar, i.e. use it when benchmarks depend on the test classes.

duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
Expand All @@ -41,9 +44,9 @@ jmh {
tasks.jmh.dependsOn project(':dd-java-agent').shadowJar

/*
If using libasyncProfiler, use the following to generate nice svg flamegraphs.
sed '/unknown/d' dd-java-agent/benchmark/build/reports/jmh/profiler.txt | sed '/^thread_start/d' | sed '/not_walkable/d' > dd-java-agent/benchmark/build/reports/jmh/profiler-cleaned.txt
(using https://github.com/brendangregg/FlameGraph)
./flamegraph.pl --color=java dd-java-agent/benchmark/build/reports/jmh/profiler-cleaned.txt > dd-java-agent/benchmark/build/reports/jmh/jmh-master.svg
If using libasyncProfiler, use the following to generate nice svg flamegraphs.
sed '/unknown/d' dd-java-agent/benchmark/build/reports/jmh/profiler.txt | sed '/^thread_start/d' | sed '/not_walkable/d' > dd-java-agent/benchmark/build/reports/jmh/profiler-cleaned.txt
(using https://github.com/brendangregg/FlameGraph)
./flamegraph.pl --color=java dd-java-agent/benchmark/build/reports/jmh/profiler-cleaned.txt > dd-java-agent/benchmark/build/reports/jmh/jmh-master.svg
*/

12 changes: 6 additions & 6 deletions dd-java-agent/dd-java-agent.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ shadowJar generalShadowJarConfig >> {

manifest {
attributes(
"Main-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Agent-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Premain-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Can-Redefine-Classes": true,
"Can-Retransform-Classes": true,
)
"Main-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Agent-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Premain-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Can-Redefine-Classes": true,
"Can-Retransform-Classes": true,
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ testSets {

dependencies {
compileOnly group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.0'

testCompile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.0'

latestDepTestCompile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ dependencies {
testCompile group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner', version: '2.9.10'

// Anything 1.0+ fails with a java.lang.NoClassDefFoundError: org/eclipse/jetty/server/RequestLog
// latestDepTestCompile group: 'io.dropwizard', name: 'dropwizard-testing', version: '1.+'
// latestDepTestCompile group: 'io.dropwizard', name: 'dropwizard-testing', version: '1.+'
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ targetCompatibility = JavaVersion.VERSION_1_7
// 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.compilerArgs.addAll([
'-source',
'8',
'-target',
'8',
'-Xlint:all,-processing,-options,-path'
])
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies {
latestDepTestCompile group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '2.3.20+'
latestDepTestCompile group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '2.+'
latestDepTestCompile group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.+'

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
muzzle {
// Cant assert fails because muzzle assumes all instrumentations will fail
// Instrumentations in jax-rs-annotations-2 will pass
// Resteasy changes a class's package in 3.1.0 then moves it back in 3.5.0

// Resteasy changes a class's package in 3.1.0 then moves it back in 3.5.0
pass {
group = "org.jboss.resteasy"
module = "resteasy-jaxrs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ muzzle {
// Cant assert fails because muzzle assumes all instrumentations will fail
// Instrumentations in jax-rs-annotations-2 will pass

// Resteasy changes a class's package in 3.1.0 then moves it back in 3.5.0
// Resteasy changes a class's package in 3.1.0 then moves it back in 3.5.0
pass {
group = "org.jboss.resteasy"
module = "resteasy-jaxrs"
Expand Down
2 changes: 1 addition & 1 deletion dd-java-agent/instrumentation/lettuce-5/lettuce-5.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ dependencies {
testCompile group: 'com.github.kstyrc', name: 'embedded-redis', version: '0.6'
testCompile group: 'io.lettuce', name: 'lettuce-core', version: '5.0.0.RELEASE'
testCompile project(':dd-java-agent:instrumentation:reactor-core-3.1')

latestDepTestCompile group: 'io.lettuce', name: 'lettuce-core', version: '5.+'
}
6 changes: 3 additions & 3 deletions dd-java-agent/instrumentation/okhttp-2/okhttp-2.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Note: The Interceptor class for OkHttp was not introduced until 2.2+, so we need to make sure the
instrumentation is not loaded unless the dependency is 2.2+.
*/
Note: The Interceptor class for OkHttp was not introduced until 2.2+, so we need to make sure the
instrumentation is not loaded unless the dependency is 2.2+.
*/
muzzle {
pass {
group = "com.squareup.okhttp"
Expand Down
14 changes: 7 additions & 7 deletions dd-java-agent/instrumentation/okhttp-3/okhttp-3.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ testSets {
}

/*
Note: there is a bit of dependency exclusion magic goin on.
We have to exclude all transitive dependencies on 'okhttp' because we would like to force
specific version. We cannot use . Unfortunately we cannot just force version on
a dependency because this doesn't work well with version ranges - it doesn't select latest.
And we cannot use configurations to exclude this dependency from everywhere in one go
because it looks like exclusions using configurations excludes dependency even if it explicit
not transitive.
Note: there is a bit of dependency exclusion magic goin on.
We have to exclude all transitive dependencies on 'okhttp' because we would like to force
specific version. We cannot use . Unfortunately we cannot just force version on
a dependency because this doesn't work well with version ranges - it doesn't select latest.
And we cannot use configurations to exclude this dependency from everywhere in one go
because it looks like exclusions using configurations excludes dependency even if it explicit
not transitive.
*/
dependencies {
compileOnly(group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.0.0')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ muzzle {
group = 'org.springframework'
module = 'spring-webmvc'
versions = "[3.1.0.RELEASE,]"
skipVersions += ['1.2.1', '1.2.2', '1.2.3', '1.2.4'] // broken releases... missing dependencies
skipVersions += [
'1.2.1',
'1.2.2',
'1.2.3',
'1.2.4'] // broken releases... missing dependencies
skipVersions += '3.2.1.RELEASE' // missing a required class. (bad release?)
extraDependency "javax.servlet:javax.servlet-api:3.0.1"
assertInverse = true
Expand All @@ -14,7 +18,11 @@ muzzle {
group = 'org.springframework'
module = 'spring-web'
versions = "[,]"
skipVersions += ['1.2.1', '1.2.2', '1.2.3', '1.2.4'] // broken releases... missing dependencies
skipVersions += [
'1.2.1',
'1.2.2',
'1.2.3',
'1.2.4'] // broken releases... missing dependencies
extraDependency "javax.servlet:javax.servlet-api:3.0.1"
}
}
Expand All @@ -24,8 +32,8 @@ apply from: "$rootDir/gradle/java.gradle"
dependencies {
compileOnly group: 'org.springframework', name: 'spring-webmvc', version: '3.1.0.RELEASE'
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
// compileOnly group: 'org.springframework', name: 'spring-webmvc', version: '2.5.6'
// compileOnly group: 'javax.servlet', name: 'servlet-api', version: '2.4'
// compileOnly group: 'org.springframework', name: 'spring-webmvc', version: '2.5.6'
// compileOnly group: 'javax.servlet', name: 'servlet-api', version: '2.4'

testCompile(project(':dd-java-agent:testing')) {
exclude(module: 'jetty-server') // incompatable servlet api
Expand Down
2 changes: 1 addition & 1 deletion dd-java-agent/instrumentation/vertx/vertx.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
// compileOnly group: 'io.vertx', name: 'vertx-web', version: '3.5.0'
// compileOnly group: 'io.vertx', name: 'vertx-web', version: '3.5.0'

testCompile project(':dd-java-agent:instrumentation:netty-4.1')
testCompile project(':dd-java-agent:instrumentation:trace-annotation')
Expand Down
7 changes: 5 additions & 2 deletions dd-java-agent/load-generator/load-generator.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ dependencies {
task launch(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'datadog.loadgenerator.LoadGenerator'
jvmArgs = ["-javaagent:${project(':dd-java-agent').shadowJar.archivePath}", "-Ddd.service.name=loadtest"]
jvmArgs = [
"-javaagent:${project(':dd-java-agent').shadowJar.archivePath}",
"-Ddd.service.name=loadtest"
]
systemProperties System.properties

dependsOn project(':dd-java-agent').shadowJar
}
4 changes: 1 addition & 3 deletions dd-smoke-tests/cli/cli.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ description = 'Command Line Application Smoke Tests.'

jar {
manifest {
attributes(
'Main-Class': 'datadog.smoketest.cli.CliApplication'
)
attributes('Main-Class': 'datadog.smoketest.cli.CliApplication')
}
}

Expand Down
10 changes: 4 additions & 6 deletions dd-smoke-tests/java9-modules/java9-modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ apply from: "$rootDir/gradle/java.gradle"

jar {
manifest {
attributes(
'Main-Class': 'datadog.smoketest.moduleapp.ModuleApplication'
)
attributes('Main-Class': 'datadog.smoketest.moduleapp.ModuleApplication')
}
}

// If the current JDK version (the one running gradle) is < 9, we need to find a version >= 9
// to compile this project. java.gradle creates a map of java executables
// to compile this project. java.gradle creates a map of java executables
// called "javaExecutableVersionCache" pulled from the environment.
// This loops over the cache to find a usable jdk.
// Since this project is the only one that requires a version above Java 8
Expand Down Expand Up @@ -71,8 +69,8 @@ tasks.withType(Test).each {
// Run the jlink command to create the image
exec {
commandLine jlinkExecutable, '--no-man-pages', '--no-header-files',
'--add-modules', 'java.instrument,datadog.smoketest.moduleapp',
"--module-path", "${jdkModulesPath}:" + jar.archiveFile.get().toString(), "--output", generatedImageDir
'--add-modules', 'java.instrument,datadog.smoketest.moduleapp',
"--module-path", "${jdkModulesPath}:" + jar.archiveFile.get().toString(), "--output", generatedImageDir
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ description = 'Profiling Integration Tests.'

jar {
manifest {
attributes(
'Main-Class': 'datadog.smoketest.profiling.ProfilingTestApplication'
)
attributes('Main-Class': 'datadog.smoketest.profiling.ProfilingTestApplication')
}
}

Expand Down
4 changes: 1 addition & 3 deletions dd-smoke-tests/springboot/springboot.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ description = 'SpringBoot Smoke Tests.'
// so we'll build a fat jar instead
jar {
manifest {
attributes(
'Main-Class': 'datadog.smoketest.springboot.SpringbootApplication'
)
attributes('Main-Class': 'datadog.smoketest.springboot.SpringbootApplication')
}
}

Expand Down
15 changes: 9 additions & 6 deletions dd-trace-core/jfr-openjdk/jfr-openjdk.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ dependencies {
}

/*
Setup here is as following:
* We compile with Java11 compiler to get JFR definitions.
* We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible.
* We force IDEA to treat this as Java11 project with 'idea' plugin below.
* We run tests only on Java11+.
Setup here is as following:
* We compile with Java11 compiler to get JFR definitions.
* We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible.
* We force IDEA to treat this as Java11 project with 'idea' plugin below.
* We run tests only on Java11+.
*/
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -28,7 +28,10 @@ targetCompatibility = JavaVersion.VERSION_1_8
// 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.compilerArgs.addAll([
'-Xlint:all,-processing,-options,-path',
'-Werror'
])
options.fork = true
options.forkOptions.javaHome = file(System.env.JAVA_11_HOME)
}
Expand Down
Loading