proto_test.go 1.3 KB

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