Skip to content

Commit

Permalink
Gradle warnings (open-telemetry#659)
Browse files Browse the repository at this point in the history
* More gradle warnings fixes

* Disable javadoc where it is definitely not needed

* Polish
  • Loading branch information
iNikem authored and mabdinur committed Jul 10, 2020
1 parent 459aa35 commit 27c00a3
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 96 deletions.
2 changes: 2 additions & 0 deletions benchmark-integration/benchmark-integration.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ targetCompatibility = 1.8
subprojects { sub ->
sub.apply plugin: 'com.github.johnrengelman.shadow'
sub.apply from: "$rootDir/gradle/java.gradle"

javadoc.enabled = false
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package controllers

import io.opentelemetry.OpenTelemetry
Expand All @@ -10,21 +26,24 @@ import play.api.mvc._
* This controller creates an `Action` to handle HTTP requests to the
* application's work page which does busy wait to simulate some work
*/
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
val TRACER: Tracer = OpenTelemetry.getTracerProvider.get("io.opentelemetry.auto")
class HomeController @Inject()(cc: ControllerComponents)
extends AbstractController(cc) {
val TRACER: Tracer =
OpenTelemetry.getTracerProvider.get("io.opentelemetry.auto")

/**
* Create an Action to perform busy wait
*/
def doGet(workTimeMS: Option[Long], error: Option[String]) = Action { implicit request: Request[AnyContent] =>
error match {
case Some(x) => throw new RuntimeException("some sync error")
case None => {
var workTime = workTimeMS.getOrElse(0l)
scheduleWork(workTime)
Ok("Did " + workTime + "ms of work.")
def doGet(workTimeMS: Option[Long], error: Option[String]) = Action {
implicit request: Request[AnyContent] =>
error match {
case Some(x) => throw new RuntimeException("some sync error")
case None => {
var workTime = workTimeMS.getOrElse(0L)
scheduleWork(workTime)
Ok("Did " + workTime + "ms of work.")
}
}
}

}

Expand Down
25 changes: 22 additions & 3 deletions benchmark-integration/play-perftest/app/controllers/Worker.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package controllers

import io.opentelemetry.OpenTelemetry
import io.opentelemetry.trace.Tracer
import java.util.concurrent.TimeUnit

object Worker {
val TRACER: Tracer = OpenTelemetry.getTracerProvider.get("io.opentelemetry.auto")
val TRACER: Tracer =
OpenTelemetry.getTracerProvider.get("io.opentelemetry.auto")

def doWork(workTimeMS: Long) = {
val span = TRACER.spanBuilder("work").startSpan()
Expand All @@ -16,8 +33,10 @@ object Worker {
span.setAttribute("info", "interesting stuff")
span.setAttribute("additionalInfo", "interesting stuff")
}
val doneTimestamp = System.nanoTime + TimeUnit.MILLISECONDS.toNanos(workTimeMS)
while ( {
val doneTimestamp = System.nanoTime + TimeUnit.MILLISECONDS.toNanos(
workTimeMS
)
while ({
System.nanoTime < doneTimestamp
}) {
// busy-wait to simulate work
Expand Down
32 changes: 17 additions & 15 deletions benchmark-integration/play-perftest/play-perftest.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
plugins {
id 'play'
// id 'idea'
id "org.gradle.playframework" version "0.9"
}

def playVersion = "2.6.20"
def scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
ext {
minJavaVersionForTests = JavaVersion.VERSION_1_8
playVersion = "2.6.20"
scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
}

model {
components {
play {
platform play: playVersion, scala: scalaVersion, java: '1.8'
injectedRoutesGenerator = true
}
play {
platform {
playVersion = project.ext.playVersion
scalaVersion = project.ext.scalaVersion
javaVersion = JavaVersion.VERSION_1_8
}
injectedRoutesGenerator = true
}

dependencies {
play "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
play "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
play "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"
implementation "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
implementation "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
implementation "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"

play project(':auto-bootstrap')
play project(':benchmark-integration')
implementation project(':auto-bootstrap')
implementation project(':benchmark-integration')
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'com.jfrog.bintray' version '1.8.5' apply false
id "nebula.release" version "15.0.1"

id 'org.unbroken-dome.test-sets' version '2.2.1'
id 'org.unbroken-dome.test-sets' version '3.0.1'
id 'com.github.ben-manes.versions' version '0.27.0'

id 'com.dorongold.task-tree' version '1.5'
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}

dependencies {
api(gradleApi())
implementation(gradleApi())
implementation(localGroovy())

implementation("org.eclipse.aether", "aether-connector-basic", "1.1.0")
Expand Down
10 changes: 1 addition & 9 deletions gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,4 @@ tasks.withType(Test).configureEach {
// Disable all tests if current JVM doesn't match version requirements
// Disable all tests if skipTests property was specified
enabled = isJavaVersionAllowed(JavaVersion.current()) && !project.rootProject.hasProperty("skipTests")
}

plugins.withType(BasePlugin) {
project.afterEvaluate {
def deleteTasks = tasks.withType(Delete) + project.tasks.findByPath('clean')
def otherTasks = tasks - deleteTasks
otherTasks*.mustRunAfter deleteTasks
}
}
}
1 change: 1 addition & 0 deletions gradle/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spotless {
scala {
scalafmt()
licenseHeaderFile rootProject.file('gradle/enforcement/spotless.license.java'), '(package|import|public)'
target 'src/**/*.scala'
}
kotlin {
// ktfmt() // only supports 4 space indentation
Expand Down
8 changes: 4 additions & 4 deletions instrumentation/akka-http-10.0/akka-http-10.0.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ dependencies {
testImplementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'
testImplementation project(':instrumentation:annotations')

lagomTestCompile project(':instrumentation:akka-http-10.0')
lagomTestImplementation project(':instrumentation:akka-http-10.0')

lagomTestCompile group: 'com.lightbend.lagom', name: 'lagom-javadsl-testkit_2.11', version: '1.4.0'
lagomTestImplementation group: 'com.lightbend.lagom', name: 'lagom-javadsl-testkit_2.11', version: '1.4.0'

// There are some internal API changes in 10.1 that we would like to test separately for
version101TestCompile group: 'com.typesafe.akka', name: 'akka-http_2.11', version: '10.1.0'
version101TestCompile group: 'com.typesafe.akka', name: 'akka-stream_2.11', version: '2.5.11'
version101TestImplementation group: 'com.typesafe.akka', name: 'akka-http_2.11', version: '10.1.0'
version101TestImplementation group: 'com.typesafe.akka', name: 'akka-stream_2.11', version: '2.5.11'

latestDepTestImplementation group: 'com.typesafe.akka', name: 'akka-http_2.11', version: '+'
latestDepTestImplementation group: 'com.typesafe.akka', name: 'akka-stream_2.11', version: '+'
Expand Down
35 changes: 17 additions & 18 deletions instrumentation/aws-sdk/aws-sdk-1.11/aws-sdk-1.11.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ testSets {
}
}

configurations {
test_before_1_11_106RuntimeClasspath {
resolutionStrategy.force 'com.amazonaws:aws-java-sdk-s3:1.11.0'
resolutionStrategy.force 'com.amazonaws:aws-java-sdk-rds:1.11.0'
resolutionStrategy.force 'com.amazonaws:aws-java-sdk-ec2:1.11.0'
resolutionStrategy.force 'com.amazonaws:aws-java-sdk-kinesis:1.11.0'
resolutionStrategy.force 'com.amazonaws:aws-java-sdk-sqs:1.11.0'
resolutionStrategy.force 'com.amazonaws:aws-java-sdk-dynamodb:1.11.0'
}
}

dependencies {
compileOnly group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.0'

Expand All @@ -48,24 +59,12 @@ dependencies {
// needed for kinesis:
testImplementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-cbor', version: versions.jackson

test_before_1_11_106Compile(group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.0') {
force = true
}
test_before_1_11_106Compile(group: 'com.amazonaws', name: 'aws-java-sdk-rds', version: '1.11.0') {
force = true
}
test_before_1_11_106Compile(group: 'com.amazonaws', name: 'aws-java-sdk-ec2', version: '1.11.0') {
force = true
}
test_before_1_11_106Compile(group: 'com.amazonaws', name: 'aws-java-sdk-kinesis', version: '1.11.0') {
force = true
}
test_before_1_11_106Compile(group: 'com.amazonaws', name: 'aws-java-sdk-sqs', version: '1.11.0') {
force = true
}
test_before_1_11_106Compile(group: 'com.amazonaws', name: 'aws-java-sdk-dynamodb', version: '1.11.0') {
force = true
}
test_before_1_11_106Implementation(group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.0')
test_before_1_11_106Implementation(group: 'com.amazonaws', name: 'aws-java-sdk-rds', version: '1.11.0')
test_before_1_11_106Implementation(group: 'com.amazonaws', name: 'aws-java-sdk-ec2', version: '1.11.0')
test_before_1_11_106Implementation(group: 'com.amazonaws', name: 'aws-java-sdk-kinesis', version: '1.11.0')
test_before_1_11_106Implementation(group: 'com.amazonaws', name: 'aws-java-sdk-sqs', version: '1.11.0')
test_before_1_11_106Implementation(group: 'com.amazonaws', name: 'aws-java-sdk-dynamodb', version: '1.11.0')

latestDepTestImplementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '+'
latestDepTestImplementation group: 'com.amazonaws', name: 'aws-java-sdk-rds', version: '+'
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/grpc-1.5/grpc-1.5.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
}
}

Expand Down
12 changes: 6 additions & 6 deletions instrumentation/java-concurrent/java-concurrent.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ dependencies {

testImplementation project(':instrumentation:annotations')

slickTestCompile project(':instrumentation:java-concurrent')
slickTestCompile project(':instrumentation:annotations')
slickTestCompile project(':instrumentation:jdbc')
slickTestCompile deps.scala
slickTestCompile group: 'com.typesafe.slick', name: 'slick_2.11', version: '3.2.0'
slickTestCompile group: 'com.h2database', name: 'h2', version: '1.4.197'
slickTestImplementation project(':instrumentation:java-concurrent')
slickTestImplementation project(':instrumentation:annotations')
slickTestImplementation project(':instrumentation:jdbc')
slickTestImplementation deps.scala
slickTestImplementation group: 'com.typesafe.slick', name: 'slick_2.11', version: '3.2.0'
slickTestImplementation group: 'com.h2database', name: 'h2', version: '1.4.197'
}

// Run Slick library tests along with the rest of unit tests
Expand Down
4 changes: 1 addition & 3 deletions instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ dependencies {
// Resteasy
testImplementation group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.0.0.Final'

resteasy31TestCompile(group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.1.0.Final') {
force = true
}
resteasy31TestImplementation(group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.1.0.Final')

latestDepTestImplementation group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '+'
}
Expand Down
19 changes: 18 additions & 1 deletion smoke-tests/play/app/controllers/HomeController.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package controllers

import javax.inject.Inject
Expand All @@ -8,7 +24,8 @@ import play.api.mvc._
* This controller creates an `Action` to handle HTTP requests to the
* application's welcome greeting
*/
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
class HomeController @Inject()(cc: ControllerComponents)
extends AbstractController(cc) {

/**
* Create an Action to return a greeting
Expand Down
34 changes: 12 additions & 22 deletions smoke-tests/play/play.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
plugins {
id 'play'
id "org.gradle.playframework" version "0.9"
}

ext {
minJavaVersionForTests = JavaVersion.VERSION_1_8
playVersion = "2.6.20"
scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
}

def playVersion = "2.6.20"
def scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")

model {
components {
play {
platform play: playVersion, scala: scalaVersion, java: '1.8'
injectedRoutesGenerator = true
}
}
distributions {
playBinary {
contents {
from("conf") {
into "conf"
}
}
}
play {
platform {
playVersion = project.ext.playVersion
scalaVersion = project.ext.scalaVersion
javaVersion = JavaVersion.VERSION_1_8
}
injectedRoutesGenerator = true
}

repositories {
Expand All @@ -45,9 +35,9 @@ apply from: "$rootDir/gradle/java.gradle"
description = 'Play Integration Tests.'

dependencies {
play "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
play "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
play "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"
implementation "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
implementation "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
implementation "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"

testImplementation project(':smoke-tests')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class PlaySmokeTest extends AbstractServerSmokeTest {
static final HTTP_REQUEST_SPAN = 'LOGGED_SPAN GET /welcome'

@Shared
File playDirectory = new File("${buildDirectory}/stage/playBinary")
File playDirectory = new File("${buildDirectory}/stage/main")

@Override
ProcessBuilder createProcessBuilder() {
String ext = System.getProperty("os.name").startsWith("Windows") ? ".bat" : ""
ProcessBuilder processBuilder =
new ProcessBuilder("${playDirectory}/bin/playBinary" + ext)
new ProcessBuilder("${playDirectory}/bin/main" + ext)
processBuilder.directory(playDirectory)

processBuilder.environment().put("JAVA_OPTS",
Expand Down
Loading

0 comments on commit 27c00a3

Please sign in to comment.