exports_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 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 sdk
  15. import (
  16. "testing"
  17. )
  18. // Ensure that module_exports generates a module_exports_snapshot module.
  19. func TestModuleExportsSnapshot(t *testing.T) {
  20. packageBp := `
  21. module_exports {
  22. name: "myexports",
  23. java_libs: [
  24. "myjavalib",
  25. ],
  26. }
  27. java_library {
  28. name: "myjavalib",
  29. srcs: ["Test.java"],
  30. system_modules: "none",
  31. sdk_version: "none",
  32. }
  33. `
  34. result := testSdkWithFs(t, ``,
  35. map[string][]byte{
  36. "package/Test.java": nil,
  37. "package/Android.bp": []byte(packageBp),
  38. })
  39. CheckSnapshot(t, result, "myexports", "package",
  40. checkAndroidBpContents(`
  41. // This is auto-generated. DO NOT EDIT.
  42. java_import {
  43. name: "myjavalib",
  44. prefer: false,
  45. visibility: ["//visibility:public"],
  46. apex_available: ["//apex_available:platform"],
  47. jars: ["java/myjavalib.jar"],
  48. }
  49. `),
  50. )
  51. }