blob: 5b184b6731a6bb8168391b8a6ac14c32a0661ade [file] [log] [blame]
Sam Delmerico9f047d92022-02-03 20:27:31 +00001// 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) {
Colin Cross844cb6a2025-01-29 15:53:21 -080031 t.Parallel()
Sam Delmerico9f047d92022-02-03 20:27:31 +000032 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("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}