Migrating run scripts to gradle.

This commit is contained in:
nmittler 2015-01-26 14:03:11 -08:00
parent d54a463871
commit 02c953e5e0
8 changed files with 87 additions and 12 deletions

View File

@ -1,6 +1,15 @@
plugins {
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
}
description = "Stubby: Auth" description = "Stubby: Auth"
dependencies { dependencies {
compile project(':stubby-core'), compile project(':stubby-core'),
libraries.oauth_client, libraries.oauth_client,
libraries.javaee_api libraries.javaee_api
} }
// Configure the animal sniffer plugin
animalsniffer {
signature = "org.codehaus.mojo.signature:java16:+@signature"
}

View File

@ -14,6 +14,10 @@ subprojects {
mavenLocal() mavenLocal()
} }
compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
// External dependency management // External dependency management
ext.libraries = [ ext.libraries = [
protobuf: 'com.google.protobuf:protobuf-java:2.6.1', protobuf: 'com.google.protobuf:protobuf-java:2.6.1',

View File

@ -1,6 +1,16 @@
plugins {
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
}
description = 'Stubby: Core' description = 'Stubby: Core'
dependencies { dependencies {
compile libraries.protobuf, compile libraries.protobuf,
libraries.guava, libraries.guava,
libraries.jsr305 libraries.jsr305
} }
// Configure the animal sniffer plugin
animalsniffer {
signature = "org.codehaus.mojo.signature:java16:+@signature"
}

View File

@ -1,4 +1,5 @@
apply plugin: 'protobuf' apply plugin: 'protobuf'
apply plugin:'application'
description = "Stubby: Integration Testing" description = "Stubby: Integration Testing"
@ -12,6 +13,10 @@ buildscript {
} }
} }
configurations {
alpnboot
}
dependencies { dependencies {
compile project(':stubby-core'), compile project(':stubby-core'),
project(':stubby-netty'), project(':stubby-netty'),
@ -20,6 +25,29 @@ dependencies {
project(':stubby-testing'), project(':stubby-testing'),
libraries.junit, libraries.junit,
libraries.mockito 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 // 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, // The whole build dir is excluded by default, but we need build/generated-sources,
// which contains the generated proto classes. // which contains the generated proto classes.
excludeDirs = [file('.gradle')] excludeDirs = [file('.gradle')]
excludeDirs += files(file("$buildDir/").listFiles()) if (buildDir.exists()) {
excludeDirs -= file("$buildDir/generated-sources") excludeDirs += files(buildDir.listFiles())
excludeDirs -= file("$buildDir/generated-sources")
}
} }
} }

View File

@ -1,6 +1,15 @@
plugins {
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
}
description = "Stubby: OkHttp" description = "Stubby: OkHttp"
dependencies { dependencies {
compile project(':stubby-core'), compile project(':stubby-core'),
libraries.okio, libraries.okio,
libraries.okhttp libraries.okhttp
} }
// Configure the animal sniffer plugin
animalsniffer {
signature = "org.codehaus.mojo.signature:java16:+@signature"
}

View File

@ -1,10 +1,12 @@
#!/bin/bash -e #!/bin/bash -e
TARGET='Test Service Client' TARGET='Test Service Client'
TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceClient' TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceClient'
TARGET_ARGS="$@"
cd "$(dirname "$0")" TARGET_ARGS=''
mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests for i in "$@"; do
. integration-testing/target/bootclasspath.properties TARGET_ARGS="$TARGET_ARGS, '$i'"
done
TARGET_ARGS="${TARGET_ARGS:2}"
echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)" 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

View File

@ -1,10 +1,12 @@
#!/bin/bash -e #!/bin/bash -e
TARGET='Test Service Server' TARGET='Test Service Server'
TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceServer' TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceServer'
TARGET_ARGS="$@"
cd "$(dirname "$0")" TARGET_ARGS=''
mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests for i in "$@"; do
. integration-testing/target/bootclasspath.properties TARGET_ARGS="$TARGET_ARGS, '$i'"
done
TARGET_ARGS="${TARGET_ARGS:2}"
echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)" 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

View File

@ -1,4 +1,13 @@
plugins {
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
}
description = "Stubby: Stub" description = "Stubby: Stub"
dependencies { dependencies {
compile project(':stubby-core') compile project(':stubby-core')
} }
// Configure the animal sniffer plugin
animalsniffer {
signature = "org.codehaus.mojo.signature:java16:+@signature"
}