1// Copyright (C) 2019 The Android Open Source Project
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 {
16    default_team: "trendy_team_updatable_sdk_apis",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20apex_test {
21    name: "test_com.android.sdkext",
22    defaults: ["com.android.sdkext-defaults"],
23    bootclasspath_fragments: ["test_com.android.sdkext-bootclasspath-fragment"],
24    manifest: "test_manifest.json",
25    prebuilts: [
26        "sdkinfo_45",
27        "test_extensions_db",
28    ],
29    file_contexts: ":com.android.sdkext-file_contexts",
30    installable: false, // Should never be installed on the systemimage
31    multilib: {
32        prefer32: {
33            binaries: [
34                "derive_classpath_prefer32",
35                "derive_sdk_prefer32",
36            ],
37        },
38    },
39    // The automated test infra ends up building this apex for 64+32-bit and
40    // then installs it on a 32-bit-only device. Work around this weirdness
41    // by preferring 32-bit.
42    compile_multilib: "prefer32",
43}
44
45// Encapsulate the contributions made by the test_com.android.sdkext to the
46// bootclasspath.
47bootclasspath_fragment_test {
48    name: "test_com.android.sdkext-bootclasspath-fragment",
49    contents: [
50        "framework-sdkextensions",
51        "test_framework-sdkextensions",
52    ],
53    apex_available: ["test_com.android.sdkext"],
54
55    // The bootclasspath_fragments that provide APIs on which this depends.
56    fragments: [
57        {
58            apex: "com.android.art",
59            module: "art-bootclasspath-fragment",
60        },
61    ],
62}
63
64genrule {
65    name: "sdkinfo_45_src",
66    out: ["sdkinfo.pb"],
67    tools: ["gen_sdkinfo"],
68    cmd: "$(location) -v 45 -o $(out)",
69}
70
71prebuilt_etc {
72    name: "sdkinfo_45",
73    src: ":sdkinfo_45_src",
74    filename: "sdkinfo.pb",
75    installable: false,
76    visibility: [
77        ":__pkg__",
78        "//frameworks/av/apex/testing",
79    ],
80}
81
82genrule {
83    name: "test_extensions_db.pb",
84    srcs: ["test_extensions_db.textpb"],
85    out: ["test_extensions_db.pb"],
86    tools: ["gen_sdk"],
87    cmd: "$(location gen_sdk) --action print_binary --database $(location test_extensions_db.textpb) > $(out)",
88    visibility: ["//visibility:private"],
89}
90
91prebuilt_etc {
92    name: "test_extensions_db",
93    src: ":test_extensions_db.pb",
94    filename: "extensions_db.pb",
95    installable: false,
96    visibility: ["//visibility:private"],
97}
98