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_visibility: [":__subpackages__"],
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21apex {
22    name: "com.android.sdkext",
23    defaults: ["com.android.sdkext-defaults"],
24    bootclasspath_fragments: ["com.android.sdkext-bootclasspath-fragment"],
25    binaries: [
26        "derive_classpath",
27        "derive_sdk",
28    ],
29    prebuilts: [
30        "current_sdkinfo",
31        "extensions_db",
32    ],
33    manifest: "manifest.json",
34    visibility: ["//packages/modules/common/build"],
35}
36
37apex_defaults {
38    name: "com.android.sdkext-defaults",
39    defaults: ["r-launched-apex-module"],
40    prebuilts: [
41        "derive_classpath.rc",
42        "derive_sdk.rc",
43    ],
44    key: "com.android.sdkext.key",
45    certificate: ":com.android.sdkext.certificate",
46}
47
48apex_key {
49    name: "com.android.sdkext.key",
50    public_key: "com.android.sdkext.avbpubkey",
51    private_key: "com.android.sdkext.pem",
52}
53
54android_app_certificate {
55    name: "com.android.sdkext.certificate",
56    certificate: "com.android.sdkext",
57}
58
59sdk {
60    name: "sdkextensions-sdk",
61    apexes: [
62        // Adds exportable dependencies of the APEX to the sdk,
63        // e.g. *classpath_fragments.
64        "com.android.sdkext",
65    ],
66}
67
68// Encapsulate the contributions made by the com.android.sdkext to the bootclasspath.
69bootclasspath_fragment {
70    name: "com.android.sdkext-bootclasspath-fragment",
71    contents: ["framework-sdkextensions"],
72    apex_available: ["com.android.sdkext"],
73
74    // The bootclasspath_fragments that provide APIs on which this depends.
75    fragments: [
76        {
77            apex: "com.android.art",
78            module: "art-bootclasspath-fragment",
79        },
80    ],
81
82    hidden_api: {
83        // This module does not contain any split packages.
84        split_packages: [],
85
86        // The following packages and all their subpackages currently only
87        // contain classes from this bootclasspath_fragment. Listing a package
88        // here won't prevent other bootclasspath modules from adding classes in
89        // any of those packages but it will prevent them from adding those
90        // classes into an API surface, e.g. public, system, etc.. Doing so will
91        // result in a build failure due to inconsistent flags.
92        package_prefixes: [
93            "android.os.ext",
94        ],
95    },
96}
97
98filegroup {
99    name: "sdk-extensions-info",
100    srcs: ["sdk-extensions-info.xml"],
101    visibility: [
102        "//frameworks/base",
103        "//frameworks/base/api",
104    ],
105}
106
107java_test_host {
108    name: "sdkextensions_conformance_framework_tests",
109    static_libs: ["ClasspathFetcher"],
110    libs: [
111        "tradefed",
112        "truth",
113    ],
114    test_config: "sdkext-conformance-framework.xml",
115    test_suites: [
116        "mts",
117        "device-tests",
118    ],
119}
120
121// TODO: b/316383039 - Remove this module and the script when udc-mainline-prod
122// branch is removed.
123// The options passed to Metalava when generating API signature files and stubs
124// for SDK extension releases.
125genrule {
126    name: "sdkext-released-flagged-apis",
127    visibility: [
128        "//visibility:public",
129    ],
130    tool_files: ["keep-flagged-apis.sh"],
131    srcs: ["released-flagged-apis.txt"],
132    out: ["metalava-keep-flagged-apis.txt"],
133    cmd: "$(location keep-flagged-apis.sh) \"$(in)\" > \"$(out)\"",
134}
135