@@ -73,9 +73,45 @@ model {
7373 }
7474}
7575
76+ configurations {
77+ testNanoCompile
78+ }
79+
7680dependencies {
7781 testCompile project(' :grpc-protobuf' ),
7882 project(' :grpc-stub' )
83+ testNanoCompile project(' :grpc-protobuf-nano' ),
84+ project(' :grpc-stub' )
85+ }
86+
87+ sourceSets {
88+ test {
89+ proto {
90+ plugins {
91+ grpc { }
92+ }
93+ }
94+ }
95+ testNano {
96+ proto {
97+ setSrcDirs([' src/test/proto' ])
98+ builtins {
99+ remove java
100+ javanano {
101+ option ' ignore_services=true'
102+ }
103+ }
104+ plugins {
105+ grpc {
106+ option ' nano=true'
107+ }
108+ }
109+ }
110+ }
111+ }
112+
113+ checkstyleTestNano {
114+ source = fileTree(dir : " src/testNano" , include : " **/*.java" )
79115}
80116
81117binaries. all {
@@ -152,35 +188,28 @@ artifacts {
152188}
153189
154190project. protocDep = " com.google.protobuf:protoc:${ protobufVersion} "
155- protobufCodeGenPlugins = [" java_plugin :$javaPluginPath " ]
191+ protobufCodeGenPlugins = [" grpc :$javaPluginPath " ]
156192
157193project. afterEvaluate {
158- generateTestProto. dependsOn ' java_pluginExecutable'
194+ [ generateTestProto, generateTestNanoProto] * . dependsOn ' java_pluginExecutable'
159195}
160196
161- // Ignore test for the moment on Windows. It will be easier to run once the
162- // gradle protobuf plugin can support nano.
163- if (osdetector. os != ' windows' ) {
164- test. dependsOn(' testGolden' ,' testNanoGolden' )
165- }
197+ test. dependsOn(' testGolden' , ' testNanoGolden' )
166198
167- task testGolden (type : Exec , dependsOn : ' generateTestProto' ) {
199+ def configureTestTask (Task task , String suffix ) {
200+ task. dependsOn " generateTest${ suffix} Proto"
168201 if (osdetector. os != ' windows' ) {
169- executable " diff"
202+ task . executable " diff"
170203 } else {
171- executable " fc"
204+ task . executable " fc"
172205 }
173206 // File isn't found on Windows if last slash is forward-slash
174207 def slash = System . getProperty(" file.separator" )
175- args " $buildDir /generated-sources/test/io/grpc/testing/integration" + slash + " TestServiceGrpc.java" ,
176- " $projectDir /src/test/golden/TestService.java.txt"
208+ task . args " $buildDir /generated-sources/test${ suffix } /io/grpc/testing/integration" + slash + " TestServiceGrpc.java" ,
209+ " $projectDir /src/test/golden/TestService${ suffix } .java.txt"
177210}
178211
179- task testNanoGolden (type : Exec , dependsOn : ' java_pluginExecutable' ) {
180- doFirst {
181- temporaryDir. createNewFile();
182- }
183-
184- environment ' TEST_TMP_DIR' , temporaryDir
185- commandLine ' ./src/test/run_nano_test.sh'
186- }
212+ task testGolden (type : Exec )
213+ task testNanoGolden (type : Exec )
214+ configureTestTask(testGolden, ' ' )
215+ configureTestTask(testNanoGolden, ' Nano' )
0 commit comments