| Sam Delmerico | 9f047d9 | 2022-02-03 20:27:31 +0000 | [diff] [blame] | 1 | // Copyright 2022 Google Inc. All rights reserved. | 
 | 2 | // | 
 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 4 | // you may not use this file except in compliance with the License. | 
 | 5 | // You may obtain a copy of the License at | 
 | 6 | // | 
 | 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
 | 8 | // | 
 | 9 | // Unless required by applicable law or agreed to in writing, software | 
 | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
 | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 12 | // See the License for the specific language governing permissions and | 
 | 13 | // limitations under the License. | 
 | 14 |  | 
 | 15 | package java | 
 | 16 |  | 
 | 17 | import ( | 
 | 18 | 	"strings" | 
 | 19 | 	"testing" | 
 | 20 |  | 
 | 21 | 	"android/soong/android" | 
 | 22 | ) | 
 | 23 |  | 
 | 24 | const protoModules = ` | 
 | 25 | java_library_static { | 
 | 26 |     name: "libprotobuf-java-lite", | 
 | 27 | } | 
 | 28 | ` | 
 | 29 |  | 
 | 30 | func TestProtoStream(t *testing.T) { | 
 | 31 | 	bp := ` | 
 | 32 | 		java_library { | 
 | 33 | 			name: "java-stream-protos", | 
 | 34 | 			proto: { | 
 | 35 | 				type: "stream", | 
 | 36 | 			}, | 
 | 37 | 			srcs: [ | 
 | 38 | 				"a.proto", | 
 | 39 | 				"b.proto", | 
 | 40 | 			], | 
 | 41 | 		} | 
 | 42 | 	` | 
 | 43 |  | 
 | 44 | 	ctx := android.GroupFixturePreparers( | 
 | 45 | 		PrepareForIntegrationTestWithJava, | 
 | 46 | 	).RunTestWithBp(t, protoModules+bp) | 
 | 47 |  | 
 | 48 | 	proto0 := ctx.ModuleForTests("java-stream-protos", "android_common").Output("proto/proto0.srcjar") | 
 | 49 |  | 
 | 50 | 	if cmd := proto0.RuleParams.Command; !strings.Contains(cmd, "--javastream_out=") { | 
 | 51 | 		t.Errorf("expected '--javastream_out' in %q", cmd) | 
 | 52 | 	} | 
 | 53 | } |