xref: /aosp_15_r20/system/libartpalette/Android.bp (revision 40dae23f154df491fe180b8be88cd3a82ca62e73)
1//
2// Copyright (C) 2019 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17// libartpalette-system is the implementation of the platform
18// abstraction layer for ART. It is intended to be dynamically loaded by
19// ART which now ships as an APEX and not part of the system.
20package {
21    default_applicable_licenses: ["Android-Apache-2.0"],
22}
23
24cc_library {
25    name: "libartpalette-system",
26    cpp_std: "experimental",
27    compile_multilib: "both",
28    header_libs: [
29        "libartpalette-headers",
30        "jni_headers",
31    ],
32    host_supported: true,
33    target: {
34        android: {
35            srcs: [
36                "palette_android.cc",
37                "palette_android_partner.cc",
38            ],
39            header_libs: ["libbase_headers"],
40            shared_libs: [
41                "libbase",
42                "libcutils",
43                "libdebugstore_cxx",
44                "liblog",
45                "libprocessgroup",
46                "libtombstoned_client",
47                "libselinux",
48            ],
49        },
50        host: {
51            header_libs: ["libbase_headers"],
52            srcs: ["palette_fake.cc"],
53            shared_libs: ["libbase"],
54        },
55        darwin: {
56            enabled: false,
57        },
58        windows: {
59            enabled: false,
60        },
61    },
62    static: {
63        enabled: false,
64    },
65    version_script: "libartpalette.map.txt",
66    stubs: {
67        versions: [
68            "1",
69            "2",
70            "3",
71            "4",
72        ],
73        symbol_file: "libartpalette.map.txt",
74    },
75    visibility: [
76        // Limit visibility to ART. Many functions wrap native libraries without
77        // stable APIs, and if those change drastically it may become hard to
78        // keep the wrappers functional. Hence, while they can never be removed
79        // completely, we can always update the ART module to use other APIs and
80        // then turn them into stubs that only return PALETTE_STATUS_NOT_SUPPORTED.
81        // That makes this library unsuitable for other modules.
82        "//art:__subpackages__",
83        "//libcore:__subpackages__",
84        "//libnativehelper:__subpackages__",
85
86        // Exception: composd calls PaletteCreateOdrefreshStagingDirectory, but
87        // that function doesn't depend on any unstable internal APIs (only libc
88        // and libselinux).
89        "//packages/modules/Virtualization/android/composd/native",
90
91        // Microdroid needs this library to be able to run odrefresh and dex2oat
92        // in the pVM, but it doesn't make any calls to it itself.
93        "//packages/modules/Virtualization/microdroid",
94        "//visibility:any_system_partition",
95    ],
96}
97
98// Definition of the extended SDK offered by the platform for mainline modules.
99// TODO: this is in the palette directory as it's only being used by ART.
100// It used to be in prebuilts/sdk/mainline, but this doesn't work for ART
101// unbundled which also includes the prebuilts/sdk git repository. We need to find
102// a better location for this SDK, see b/162706448.
103sdk {
104    name: "platform-mainline-sdk",
105    host_supported: true,
106    native_shared_libs: [
107        "libartpalette-system",
108    ],
109    native_static_libs: [
110        "libcap",
111    ],
112    target: {
113        darwin: {
114            enabled: false,
115        },
116        android: {
117            native_shared_libs: [
118                "libbinder_ndk",
119                "liblog",
120            ],
121        },
122        not_windows: {
123            native_libs: [
124                "liblog",
125            ],
126        },
127    },
128}
129
130module_exports {
131    name: "platform-mainline-test-exports",
132    host_supported: false,
133    native_shared_libs: [
134        // Required by the implementation of libartpalette-system,
135        // which ART uses in replacement of stubs in its testing environment.
136        "libtombstoned_client",
137    ],
138}
139