blob: 5a7ce845ad5a8c80194697dacf851d829f9e3076 [file] [log] [blame]
Paul Duffin8150da62019-12-16 17:21:27 +00001// 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
15package sdk
16
17import (
18 "testing"
19)
20
21// Ensure that module_exports generates a module_exports_snapshot module.
22func TestModuleExportsSnapshot(t *testing.T) {
Colin Crossaba8cd92025-02-05 16:39:18 -080023 t.Parallel()
Paul Duffin8150da62019-12-16 17:21:27 +000024 packageBp := `
25 module_exports {
26 name: "myexports",
27 java_libs: [
28 "myjavalib",
29 ],
30 }
31
32 java_library {
33 name: "myjavalib",
34 srcs: ["Test.java"],
35 system_modules: "none",
36 sdk_version: "none",
37 }
38 `
39
40 result := testSdkWithFs(t, ``,
41 map[string][]byte{
42 "package/Test.java": nil,
43 "package/Android.bp": []byte(packageBp),
44 })
45
Paul Duffin36474d32021-03-12 12:19:43 +000046 CheckSnapshot(t, result, "myexports", "package",
Paul Duffinb01ac4b2022-05-24 20:10:05 +000047 checkAndroidBpContents(`
Paul Duffine1381882021-04-16 17:05:10 +010048// This is auto-generated. DO NOT EDIT.
49
Spandan Dasa5e26d32024-03-06 14:04:36 +000050apex_contributions_defaults {
51 name: "myexports.contributions",
52 contents: ["prebuilt_myjavalib"],
53}
54
Paul Duffine1381882021-04-16 17:05:10 +010055java_import {
56 name: "myjavalib",
57 prefer: false,
58 visibility: ["//visibility:public"],
59 apex_available: ["//apex_available:platform"],
60 jars: ["java/myjavalib.jar"],
61}
62`),
Paul Duffine1381882021-04-16 17:05:10 +010063 )
Paul Duffin8150da62019-12-16 17:21:27 +000064}