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"
dependencies {
compile project(':stubby-core'),
libraries.oauth_client,
libraries.javaee_api
}
// Configure the animal sniffer plugin
animalsniffer {
signature = "org.codehaus.mojo.signature:java16:+@signature"
}

View File

@ -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',

View File

@ -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"
}

View File

@ -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())
if (buildDir.exists()) {
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"
dependencies {
compile project(':stubby-core'),
libraries.okio,
libraries.okhttp
}
// Configure the animal sniffer plugin
animalsniffer {
signature = "org.codehaus.mojo.signature:java16:+@signature"
}

View File

@ -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

View File

@ -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

View File

@ -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"
}