diff --git a/auth/build.gradle b/auth/build.gradle index e1d4e0ec26..22a3fe36a1 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -1,6 +1,15 @@ +plugins { + id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0" +} + description = "Stubby: Auth" dependencies { compile project(':stubby-core'), libraries.oauth_client, libraries.javaee_api } + +// Configure the animal sniffer plugin +animalsniffer { + signature = "org.codehaus.mojo.signature:java16:+@signature" +} diff --git a/build.gradle b/build.gradle index bc0b7d1755..32c4e211e7 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,10 @@ subprojects { mavenLocal() } + compileJava { + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + } + // External dependency management ext.libraries = [ protobuf: 'com.google.protobuf:protobuf-java:2.6.1', diff --git a/core/build.gradle b/core/build.gradle index 870c3222ec..46948c8dad 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,6 +1,16 @@ +plugins { + id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0" +} + description = 'Stubby: Core' + dependencies { compile libraries.protobuf, libraries.guava, libraries.jsr305 } + +// Configure the animal sniffer plugin +animalsniffer { + signature = "org.codehaus.mojo.signature:java16:+@signature" +} diff --git a/integration-testing/build.gradle b/integration-testing/build.gradle index 689d5f5003..51d916a8c5 100644 --- a/integration-testing/build.gradle +++ b/integration-testing/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'protobuf' +apply plugin:'application' description = "Stubby: Integration Testing" @@ -12,6 +13,10 @@ buildscript { } } +configurations { + alpnboot +} + dependencies { compile project(':stubby-core'), project(':stubby-netty'), @@ -20,6 +25,29 @@ dependencies { project(':stubby-testing'), libraries.junit, libraries.mockito + + // Determine the correct version of Jetty ALPN boot to use based + // on the Java version. + def alpnboot_prefix = 'org.mortbay.jetty.alpn:alpn-boot:' + def alpnboot_version = '8.1.2.v20141202' + if (JavaVersion.current().ordinal() < JavaVersion.VERSION_1_8.ordinal()) { + alpnboot_version = '7.1.2.v20141202' + } + + alpnboot alpnboot_prefix + alpnboot_version +} + +// Allow execution of test client and server. +task execute(dependsOn: classes, type:JavaExec) { + main = project.hasProperty('mainClass') ? project.mainClass : '' + classpath = sourceSets.main.runtimeClasspath + jvmArgs = ["-Xbootclasspath/p:" + configurations.alpnboot.asPath] + workingDir = project.rootDir + + // If appArgs were provided, set the program arguments. + if (project.hasProperty("appArgs")) { + args = Eval.me(appArgs) + } } // Allow intellij projects to refer to generated-sources @@ -28,7 +56,9 @@ idea { // The whole build dir is excluded by default, but we need build/generated-sources, // which contains the generated proto classes. excludeDirs = [file('.gradle')] - excludeDirs += files(file("$buildDir/").listFiles()) - excludeDirs -= file("$buildDir/generated-sources") + if (buildDir.exists()) { + excludeDirs += files(buildDir.listFiles()) + excludeDirs -= file("$buildDir/generated-sources") + } } } diff --git a/okhttp/build.gradle b/okhttp/build.gradle index ed290e1c73..29be36ee4b 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -1,6 +1,15 @@ +plugins { + id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0" +} + description = "Stubby: OkHttp" dependencies { compile project(':stubby-core'), libraries.okio, libraries.okhttp } + +// Configure the animal sniffer plugin +animalsniffer { + signature = "org.codehaus.mojo.signature:java16:+@signature" +} diff --git a/run-test-client.sh b/run-test-client.sh index b126dcad20..c897d5e88b 100755 --- a/run-test-client.sh +++ b/run-test-client.sh @@ -1,10 +1,12 @@ #!/bin/bash -e TARGET='Test Service Client' TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceClient' -TARGET_ARGS="$@" -cd "$(dirname "$0")" -mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests -. integration-testing/target/bootclasspath.properties +TARGET_ARGS='' +for i in "$@"; do + TARGET_ARGS="$TARGET_ARGS, '$i'" +done +TARGET_ARGS="${TARGET_ARGS:2}" + echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)" -exec java "$bootclasspath" -cp "$jar" "$TARGET_CLASS" $TARGET_ARGS +gradle -PmainClass="$TARGET_CLASS" -PappArgs="[$TARGET_ARGS]" :stubby-integration-testing:execute diff --git a/run-test-server.sh b/run-test-server.sh index 325c1d5771..b84bd3f335 100755 --- a/run-test-server.sh +++ b/run-test-server.sh @@ -1,10 +1,12 @@ #!/bin/bash -e TARGET='Test Service Server' TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceServer' -TARGET_ARGS="$@" -cd "$(dirname "$0")" -mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests -. integration-testing/target/bootclasspath.properties +TARGET_ARGS='' +for i in "$@"; do + TARGET_ARGS="$TARGET_ARGS, '$i'" +done +TARGET_ARGS="${TARGET_ARGS:2}" + echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)" -exec java "$bootclasspath" -cp "$jar" "$TARGET_CLASS" $TARGET_ARGS +gradle -PmainClass="$TARGET_CLASS" -PappArgs="[$TARGET_ARGS]" :stubby-integration-testing:execute diff --git a/stub/build.gradle b/stub/build.gradle index 6d3af66eb8..f7e6a5bdc3 100644 --- a/stub/build.gradle +++ b/stub/build.gradle @@ -1,4 +1,13 @@ +plugins { + id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0" +} + description = "Stubby: Stub" dependencies { compile project(':stubby-core') } + +// Configure the animal sniffer plugin +animalsniffer { + signature = "org.codehaus.mojo.signature:java16:+@signature" +} \ No newline at end of file