Skip to content

Commit 02c953e

Browse files
author
nmittler
committed
Migrating run scripts to gradle.
1 parent d54a463 commit 02c953e

8 files changed

Lines changed: 87 additions & 12 deletions

File tree

auth/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
plugins {
2+
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
3+
}
4+
15
description = "Stubby: Auth"
26
dependencies {
37
compile project(':stubby-core'),
48
libraries.oauth_client,
59
libraries.javaee_api
610
}
11+
12+
// Configure the animal sniffer plugin
13+
animalsniffer {
14+
signature = "org.codehaus.mojo.signature:java16:+@signature"
15+
}

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ subprojects {
1414
mavenLocal()
1515
}
1616

17+
compileJava {
18+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
19+
}
20+
1721
// External dependency management
1822
ext.libraries = [
1923
protobuf: 'com.google.protobuf:protobuf-java:2.6.1',

core/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
plugins {
2+
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
3+
}
4+
15
description = 'Stubby: Core'
6+
27
dependencies {
38
compile libraries.protobuf,
49
libraries.guava,
510
libraries.jsr305
611
}
12+
13+
// Configure the animal sniffer plugin
14+
animalsniffer {
15+
signature = "org.codehaus.mojo.signature:java16:+@signature"
16+
}

integration-testing/build.gradle

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'protobuf'
2+
apply plugin:'application'
23

34
description = "Stubby: Integration Testing"
45

@@ -12,6 +13,10 @@ buildscript {
1213
}
1314
}
1415

16+
configurations {
17+
alpnboot
18+
}
19+
1520
dependencies {
1621
compile project(':stubby-core'),
1722
project(':stubby-netty'),
@@ -20,6 +25,29 @@ dependencies {
2025
project(':stubby-testing'),
2126
libraries.junit,
2227
libraries.mockito
28+
29+
// Determine the correct version of Jetty ALPN boot to use based
30+
// on the Java version.
31+
def alpnboot_prefix = 'org.mortbay.jetty.alpn:alpn-boot:'
32+
def alpnboot_version = '8.1.2.v20141202'
33+
if (JavaVersion.current().ordinal() < JavaVersion.VERSION_1_8.ordinal()) {
34+
alpnboot_version = '7.1.2.v20141202'
35+
}
36+
37+
alpnboot alpnboot_prefix + alpnboot_version
38+
}
39+
40+
// Allow execution of test client and server.
41+
task execute(dependsOn: classes, type:JavaExec) {
42+
main = project.hasProperty('mainClass') ? project.mainClass : ''
43+
classpath = sourceSets.main.runtimeClasspath
44+
jvmArgs = ["-Xbootclasspath/p:" + configurations.alpnboot.asPath]
45+
workingDir = project.rootDir
46+
47+
// If appArgs were provided, set the program arguments.
48+
if (project.hasProperty("appArgs")) {
49+
args = Eval.me(appArgs)
50+
}
2351
}
2452

2553
// Allow intellij projects to refer to generated-sources
@@ -28,7 +56,9 @@ idea {
2856
// The whole build dir is excluded by default, but we need build/generated-sources,
2957
// which contains the generated proto classes.
3058
excludeDirs = [file('.gradle')]
31-
excludeDirs += files(file("$buildDir/").listFiles())
32-
excludeDirs -= file("$buildDir/generated-sources")
59+
if (buildDir.exists()) {
60+
excludeDirs += files(buildDir.listFiles())
61+
excludeDirs -= file("$buildDir/generated-sources")
62+
}
3363
}
3464
}

okhttp/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
plugins {
2+
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
3+
}
4+
15
description = "Stubby: OkHttp"
26
dependencies {
37
compile project(':stubby-core'),
48
libraries.okio,
59
libraries.okhttp
610
}
11+
12+
// Configure the animal sniffer plugin
13+
animalsniffer {
14+
signature = "org.codehaus.mojo.signature:java16:+@signature"
15+
}

run-test-client.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash -e
22
TARGET='Test Service Client'
33
TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceClient'
4-
TARGET_ARGS="$@"
54

6-
cd "$(dirname "$0")"
7-
mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests
8-
. integration-testing/target/bootclasspath.properties
5+
TARGET_ARGS=''
6+
for i in "$@"; do
7+
TARGET_ARGS="$TARGET_ARGS, '$i'"
8+
done
9+
TARGET_ARGS="${TARGET_ARGS:2}"
10+
911
echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)"
10-
exec java "$bootclasspath" -cp "$jar" "$TARGET_CLASS" $TARGET_ARGS
12+
gradle -PmainClass="$TARGET_CLASS" -PappArgs="[$TARGET_ARGS]" :stubby-integration-testing:execute

run-test-server.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash -e
22
TARGET='Test Service Server'
33
TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceServer'
4-
TARGET_ARGS="$@"
54

6-
cd "$(dirname "$0")"
7-
mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests
8-
. integration-testing/target/bootclasspath.properties
5+
TARGET_ARGS=''
6+
for i in "$@"; do
7+
TARGET_ARGS="$TARGET_ARGS, '$i'"
8+
done
9+
TARGET_ARGS="${TARGET_ARGS:2}"
10+
911
echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)"
10-
exec java "$bootclasspath" -cp "$jar" "$TARGET_CLASS" $TARGET_ARGS
12+
gradle -PmainClass="$TARGET_CLASS" -PappArgs="[$TARGET_ARGS]" :stubby-integration-testing:execute

stub/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
plugins {
2+
id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0"
3+
}
4+
15
description = "Stubby: Stub"
26
dependencies {
37
compile project(':stubby-core')
48
}
9+
10+
// Configure the animal sniffer plugin
11+
animalsniffer {
12+
signature = "org.codehaus.mojo.signature:java16:+@signature"
13+
}

0 commit comments

Comments
 (0)