11apply plugin : ' protobuf'
2+ apply plugin :' application'
23
34description = " Stubby: Integration Testing"
45
@@ -12,6 +13,10 @@ buildscript {
1213 }
1314}
1415
16+ configurations {
17+ alpnboot
18+ }
19+
1520dependencies {
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
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}
0 commit comments