xref: /aosp_15_r20/art/libartpalette/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
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
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "art_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["art_license"],
24    default_team: "trendy_team_art_mainline",
25}
26
27cc_defaults {
28    name: "libartpalette_defaults",
29    defaults: ["art_defaults"],
30    export_include_dirs: ["include"],
31    header_libs: [
32        "jni_headers",
33    ],
34}
35
36cc_library_headers {
37    name: "libartpalette-headers",
38    export_include_dirs: ["include"],
39    host_supported: true,
40    visibility: [
41        "//art:__subpackages__",
42        "//system/libartpalette",
43    ],
44}
45
46// libartpalette is the dynamic loader of the platform abstraction
47// layer. It is only used on Android. For other targets, it just
48// implements a fake platform implementation.
49art_cc_library {
50    name: "libartpalette",
51    defaults: ["libartpalette_defaults"],
52    host_supported: true,
53    visibility: [
54        // TODO(b/183483755): Please visibility checks when the prebuilt
55        // libartpalette is present but not preferred, and the prebuilt
56        // libdexfile hence depends on the source instead.
57        // TODO(b/172480617): Alternatively, clean up when we no longer need to
58        // support both prebuilts and sources present simultaneously.
59        "//prebuilts/module_sdk/art:__subpackages__",
60    ],
61    header_libs: [
62        "libbase_headers",
63    ],
64    export_header_lib_headers: [
65        "jni_headers",
66    ],
67    target: {
68        // Targets supporting dlopen build the client library which loads
69        // and binds the methods in the libartpalette-system library.
70        android: {
71            // libartpalette.so dlopen()'s libartpalette-system.
72            runtime_libs: ["libartpalette-system"],
73            srcs: ["apex/palette.cc"],
74            shared_libs: ["liblog"],
75            version_script: "libartpalette.map",
76        },
77        host_linux: {
78            header_libs: ["libbase_headers"],
79            srcs: ["system/palette_fake.cc"],
80            shared: {
81                shared_libs: [
82                    "libbase",
83                    "liblog",
84                ],
85            },
86            version_script: "libartpalette.map",
87        },
88        // Targets without support for dlopen just use the sources for
89        // the system library which actually implements functionality.
90        darwin: {
91            enabled: true,
92            header_libs: ["libbase_headers"],
93            srcs: ["system/palette_fake.cc"],
94            static_libs: [
95                "libbase",
96                "liblog",
97            ],
98        },
99        windows: {
100            enabled: true,
101            header_libs: ["libbase_headers"],
102            srcs: ["system/palette_fake.cc"],
103            static_libs: [
104                "libbase",
105                "liblog",
106            ],
107        },
108    },
109    apex_available: [
110        "com.android.art",
111        "com.android.art.debug",
112        // TODO(b/142944931): remove this
113        "com.android.runtime", // due to the transitive dependency from linker
114    ],
115}
116
117art_cc_library {
118    name: "libartpalette_fake",
119    defaults: ["libartpalette_defaults"],
120    srcs: ["system/palette_fake.cc"],
121    stem: "libartpalette-system",
122    relative_install_path: "art_fake", // Avoid conflict with the real lib.
123    shared_libs: [
124        "libbase",
125        "liblog",
126    ],
127    compile_multilib: "both",
128    visibility: [
129        "//visibility:override",
130        "//visibility:private",
131    ],
132}
133
134art_cc_defaults {
135    name: "art_libartpalette_tests_defaults",
136    srcs: ["apex/palette_test.cc"],
137    target: {
138        android: {
139            static_libs: ["libmodules-utils-build"],
140        },
141    },
142}
143
144// Version of ART gtest `art_libartpalette_tests` for host.
145// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
146art_cc_test {
147    name: "art_libartpalette_tests",
148    defaults: [
149        "art_gtest_defaults",
150        "art_libartpalette_tests_defaults",
151    ],
152    host_supported: true,
153    device_supported: false,
154}
155
156// Standalone version of ART gtest `art_libartpalette_tests`, not bundled with the ART APEX on
157// target.
158art_cc_test {
159    name: "art_standalone_libartpalette_tests",
160    defaults: [
161        "art_standalone_gtest_defaults",
162        "art_libartpalette_tests_defaults",
163    ],
164    test_config_template: ":art-gtests-target-standalone-cts-template",
165    test_suites: [
166        "cts",
167        "mcts-art",
168    ],
169}
170