1// Copyright (C) 2021 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    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "art_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["art_license"],
22}
23
24// TODO: b/319697968 - Remove the conditional logic and let art-bootclasspath-fragment always
25// depend on the exportable stubs once metalava fully supports flagged api handling.
26soong_config_module_type {
27    name: "art_bootclasspath_fragment_soong_config_defaults",
28    module_type: "java_defaults",
29    config_namespace: "ANDROID",
30    bool_variables: [
31        "release_hidden_api_exportable_stubs",
32    ],
33    properties: [
34        "core_platform_api.stub_libs",
35    ],
36}
37
38art_bootclasspath_fragment_soong_config_defaults {
39    name: "art-bootclasspath-fragment-soong-config-defaults",
40    soong_config_variables: {
41        release_hidden_api_exportable_stubs: {
42            // When "RELEASE_HIDDEN_API_EXPORTABLE_STUBS" build flag is set,
43            // depend on the exportable stubs
44            core_platform_api: {
45                stub_libs: [
46                    // Core platform (aka. module_lib) stubs for all the non-coverage contents.
47                    "art.module.public.api.stubs.exportable.module_lib",
48                ],
49            },
50            conditions_default: {
51                // When "RELEASE_HIDDEN_API_EXPORTABLE_STUBS" build flag is not set,
52                // depend on the everything stubs
53                core_platform_api: {
54                    stub_libs: [
55                        // Core platform (aka. module_lib) stubs for all the non-coverage contents.
56                        "art.module.public.api.stubs.module_lib",
57                    ],
58                },
59            },
60        },
61    },
62}
63
64// Encapsulate the contributions made by the com.android.art to the bootclasspath.
65bootclasspath_fragment {
66    name: "art-bootclasspath-fragment",
67    defaults: [
68        "art-bootclasspath-fragment-soong-config-defaults",
69    ],
70    image_name: "art",
71    // Must match the ART_APEX_JARS set in build/make/core/envsetup.mk
72    contents: [
73        "core-oj",
74        "core-libart",
75        "okhttp",
76        "bouncycastle",
77        "apache-xml",
78    ],
79
80    api: {
81        stub_libs: [
82            // Stubs for the core-oj and core-libart. The other modules do not
83            // have any public API.
84            "art.module.public.api",
85        ],
86    },
87
88    // Additional properties to append when coverage is enabled, i.e. when
89    // EMMA_INSTRUMENT_FRAMEWORK=true
90    coverage: {
91        contents: [
92            "jacocoagent",
93        ],
94        api: {
95            stub_libs: [
96                // Stubs for the jacocoagent.
97                "jacoco-stubs",
98            ],
99        },
100
101        hidden_api: {
102            // Additional packages provided by jacoagent
103            package_prefixes: [
104                "com.vladium.emma.rt",
105                "org.jacoco",
106                "org.objectweb.asm",
107            ],
108
109        },
110    },
111    visibility: [
112        "//art/build/apex",
113        "//art/build/sdk",
114    ],
115    apex_available: [
116        "com.android.art",
117        "com.android.art.debug",
118    ],
119
120    hidden_api: {
121        blocked: ["hiddenapi/hiddenapi-blocked.txt"],
122        max_target_o_low_priority: ["hiddenapi/hiddenapi-max-target-o-low-priority.txt"],
123        unsupported_packages: ["hiddenapi/hiddenapi-unsupported-packages.txt"],
124
125        // This module does not contain any split packages.
126        split_packages: [],
127
128        // The following packages currently only contain classes from this
129        // bootclasspath_fragment but some of their sub-packages contain classes
130        // from other bootckasspath modules. Packages should only be listed here
131        // when necessary for legacy purposes, new packages should match a
132        // package prefix.
133        single_packages: [
134            "android.system",
135        ],
136
137        // The following packages and all their subpackages currently only
138        // contain classes from this bootclasspath_fragment. Listing a package
139        // here won't prevent other bootclasspath modules from adding classes in
140        // any of those packages but it will prevent them from adding those
141        // classes into an API surface, e.g. public, system, etc.. Doing so will
142        // result in a build failure due to inconsistent flags.
143        package_prefixes: [
144            "android.compat",
145            "android.crypto.hpke",
146            "com.android.okhttp",
147            "com.android.org.bouncycastle",
148            "com.android.org.kxml2",
149            "com.sun",
150            "dalvik",
151            "java",
152            "javax.annotation",
153            "javax.crypto",
154            "javax.net",
155            "javax.security",
156            "javax.sql",
157            "javax.xml",
158            "jdk",
159            "libcore",
160            "org.apache.harmony",
161            "org.apache.xalan",
162            "org.apache.xml",
163            "org.apache.xpath",
164            "org.json",
165            "org.w3c",
166            "org.xml",
167            "org.xmlpull",
168            "sun",
169        ],
170    },
171}
172
173// Encapsulate the contributions made by the com.android.art to the systemserverclasspath.
174systemserverclasspath_fragment {
175    name: "art-systemserverclasspath-fragment",
176    contents: ["service-art"],
177    apex_available: [
178        "com.android.art",
179        "com.android.art.debug",
180    ],
181}
182