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 15package java 16 17import ( 18 "strings" 19 "testing" 20 21 "android/soong/android" 22) 23 24const protoModules = ` 25java_library_static { 26 name: "libprotobuf-java-lite", 27} 28` 29 30func TestProtoStream(t *testing.T) { 31 t.Parallel() 32 bp := ` 33 java_library { 34 name: "java-stream-protos", 35 proto: { 36 type: "stream", 37 }, 38 srcs: [ 39 "a.proto", 40 "b.proto", 41 ], 42 } 43 ` 44 45 ctx := android.GroupFixturePreparers( 46 PrepareForIntegrationTestWithJava, 47 ).RunTestWithBp(t, protoModules+bp) 48 49 proto0 := ctx.ModuleForTests(t, "java-stream-protos", "android_common").Output("proto/proto0.srcjar") 50 51 if cmd := proto0.RuleParams.Command; !strings.Contains(cmd, "--javastream_out=") { 52 t.Errorf("expected '--javastream_out' in %q", cmd) 53 } 54} 55