xref: /aosp_15_r20/art/libartpalette/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker//
2*795d594fSAndroid Build Coastguard Worker// Copyright (C) 2019 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker//
4*795d594fSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker// You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker//
8*795d594fSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker//
10*795d594fSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker// limitations under the License.
15*795d594fSAndroid Build Coastguard Worker//
16*795d594fSAndroid Build Coastguard Worker
17*795d594fSAndroid Build Coastguard Workerpackage {
18*795d594fSAndroid Build Coastguard Worker    // See: http://go/android-license-faq
19*795d594fSAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
20*795d594fSAndroid Build Coastguard Worker    // all of the 'license_kinds' from "art_license"
21*795d594fSAndroid Build Coastguard Worker    // to get the below license kinds:
22*795d594fSAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
23*795d594fSAndroid Build Coastguard Worker    default_applicable_licenses: ["art_license"],
24*795d594fSAndroid Build Coastguard Worker    default_team: "trendy_team_art_mainline",
25*795d594fSAndroid Build Coastguard Worker}
26*795d594fSAndroid Build Coastguard Worker
27*795d594fSAndroid Build Coastguard Workercc_defaults {
28*795d594fSAndroid Build Coastguard Worker    name: "libartpalette_defaults",
29*795d594fSAndroid Build Coastguard Worker    defaults: ["art_defaults"],
30*795d594fSAndroid Build Coastguard Worker    export_include_dirs: ["include"],
31*795d594fSAndroid Build Coastguard Worker    header_libs: [
32*795d594fSAndroid Build Coastguard Worker        "jni_headers",
33*795d594fSAndroid Build Coastguard Worker    ],
34*795d594fSAndroid Build Coastguard Worker}
35*795d594fSAndroid Build Coastguard Worker
36*795d594fSAndroid Build Coastguard Workercc_library_headers {
37*795d594fSAndroid Build Coastguard Worker    name: "libartpalette-headers",
38*795d594fSAndroid Build Coastguard Worker    export_include_dirs: ["include"],
39*795d594fSAndroid Build Coastguard Worker    host_supported: true,
40*795d594fSAndroid Build Coastguard Worker    visibility: [
41*795d594fSAndroid Build Coastguard Worker        "//art:__subpackages__",
42*795d594fSAndroid Build Coastguard Worker        "//system/libartpalette",
43*795d594fSAndroid Build Coastguard Worker    ],
44*795d594fSAndroid Build Coastguard Worker}
45*795d594fSAndroid Build Coastguard Worker
46*795d594fSAndroid Build Coastguard Worker// libartpalette is the dynamic loader of the platform abstraction
47*795d594fSAndroid Build Coastguard Worker// layer. It is only used on Android. For other targets, it just
48*795d594fSAndroid Build Coastguard Worker// implements a fake platform implementation.
49*795d594fSAndroid Build Coastguard Workerart_cc_library {
50*795d594fSAndroid Build Coastguard Worker    name: "libartpalette",
51*795d594fSAndroid Build Coastguard Worker    defaults: ["libartpalette_defaults"],
52*795d594fSAndroid Build Coastguard Worker    host_supported: true,
53*795d594fSAndroid Build Coastguard Worker    visibility: [
54*795d594fSAndroid Build Coastguard Worker        // TODO(b/183483755): Please visibility checks when the prebuilt
55*795d594fSAndroid Build Coastguard Worker        // libartpalette is present but not preferred, and the prebuilt
56*795d594fSAndroid Build Coastguard Worker        // libdexfile hence depends on the source instead.
57*795d594fSAndroid Build Coastguard Worker        // TODO(b/172480617): Alternatively, clean up when we no longer need to
58*795d594fSAndroid Build Coastguard Worker        // support both prebuilts and sources present simultaneously.
59*795d594fSAndroid Build Coastguard Worker        "//prebuilts/module_sdk/art:__subpackages__",
60*795d594fSAndroid Build Coastguard Worker    ],
61*795d594fSAndroid Build Coastguard Worker    header_libs: [
62*795d594fSAndroid Build Coastguard Worker        "libbase_headers",
63*795d594fSAndroid Build Coastguard Worker    ],
64*795d594fSAndroid Build Coastguard Worker    export_header_lib_headers: [
65*795d594fSAndroid Build Coastguard Worker        "jni_headers",
66*795d594fSAndroid Build Coastguard Worker    ],
67*795d594fSAndroid Build Coastguard Worker    target: {
68*795d594fSAndroid Build Coastguard Worker        // Targets supporting dlopen build the client library which loads
69*795d594fSAndroid Build Coastguard Worker        // and binds the methods in the libartpalette-system library.
70*795d594fSAndroid Build Coastguard Worker        android: {
71*795d594fSAndroid Build Coastguard Worker            // libartpalette.so dlopen()'s libartpalette-system.
72*795d594fSAndroid Build Coastguard Worker            runtime_libs: ["libartpalette-system"],
73*795d594fSAndroid Build Coastguard Worker            srcs: ["apex/palette.cc"],
74*795d594fSAndroid Build Coastguard Worker            shared_libs: ["liblog"],
75*795d594fSAndroid Build Coastguard Worker            version_script: "libartpalette.map",
76*795d594fSAndroid Build Coastguard Worker        },
77*795d594fSAndroid Build Coastguard Worker        host_linux: {
78*795d594fSAndroid Build Coastguard Worker            header_libs: ["libbase_headers"],
79*795d594fSAndroid Build Coastguard Worker            srcs: ["system/palette_fake.cc"],
80*795d594fSAndroid Build Coastguard Worker            shared: {
81*795d594fSAndroid Build Coastguard Worker                shared_libs: [
82*795d594fSAndroid Build Coastguard Worker                    "libbase",
83*795d594fSAndroid Build Coastguard Worker                    "liblog",
84*795d594fSAndroid Build Coastguard Worker                ],
85*795d594fSAndroid Build Coastguard Worker            },
86*795d594fSAndroid Build Coastguard Worker            version_script: "libartpalette.map",
87*795d594fSAndroid Build Coastguard Worker        },
88*795d594fSAndroid Build Coastguard Worker        // Targets without support for dlopen just use the sources for
89*795d594fSAndroid Build Coastguard Worker        // the system library which actually implements functionality.
90*795d594fSAndroid Build Coastguard Worker        darwin: {
91*795d594fSAndroid Build Coastguard Worker            enabled: true,
92*795d594fSAndroid Build Coastguard Worker            header_libs: ["libbase_headers"],
93*795d594fSAndroid Build Coastguard Worker            srcs: ["system/palette_fake.cc"],
94*795d594fSAndroid Build Coastguard Worker            static_libs: [
95*795d594fSAndroid Build Coastguard Worker                "libbase",
96*795d594fSAndroid Build Coastguard Worker                "liblog",
97*795d594fSAndroid Build Coastguard Worker            ],
98*795d594fSAndroid Build Coastguard Worker        },
99*795d594fSAndroid Build Coastguard Worker        windows: {
100*795d594fSAndroid Build Coastguard Worker            enabled: true,
101*795d594fSAndroid Build Coastguard Worker            header_libs: ["libbase_headers"],
102*795d594fSAndroid Build Coastguard Worker            srcs: ["system/palette_fake.cc"],
103*795d594fSAndroid Build Coastguard Worker            static_libs: [
104*795d594fSAndroid Build Coastguard Worker                "libbase",
105*795d594fSAndroid Build Coastguard Worker                "liblog",
106*795d594fSAndroid Build Coastguard Worker            ],
107*795d594fSAndroid Build Coastguard Worker        },
108*795d594fSAndroid Build Coastguard Worker    },
109*795d594fSAndroid Build Coastguard Worker    apex_available: [
110*795d594fSAndroid Build Coastguard Worker        "com.android.art",
111*795d594fSAndroid Build Coastguard Worker        "com.android.art.debug",
112*795d594fSAndroid Build Coastguard Worker        // TODO(b/142944931): remove this
113*795d594fSAndroid Build Coastguard Worker        "com.android.runtime", // due to the transitive dependency from linker
114*795d594fSAndroid Build Coastguard Worker    ],
115*795d594fSAndroid Build Coastguard Worker}
116*795d594fSAndroid Build Coastguard Worker
117*795d594fSAndroid Build Coastguard Workerart_cc_library {
118*795d594fSAndroid Build Coastguard Worker    name: "libartpalette_fake",
119*795d594fSAndroid Build Coastguard Worker    defaults: ["libartpalette_defaults"],
120*795d594fSAndroid Build Coastguard Worker    srcs: ["system/palette_fake.cc"],
121*795d594fSAndroid Build Coastguard Worker    stem: "libartpalette-system",
122*795d594fSAndroid Build Coastguard Worker    relative_install_path: "art_fake", // Avoid conflict with the real lib.
123*795d594fSAndroid Build Coastguard Worker    shared_libs: [
124*795d594fSAndroid Build Coastguard Worker        "libbase",
125*795d594fSAndroid Build Coastguard Worker        "liblog",
126*795d594fSAndroid Build Coastguard Worker    ],
127*795d594fSAndroid Build Coastguard Worker    compile_multilib: "both",
128*795d594fSAndroid Build Coastguard Worker    visibility: [
129*795d594fSAndroid Build Coastguard Worker        "//visibility:override",
130*795d594fSAndroid Build Coastguard Worker        "//visibility:private",
131*795d594fSAndroid Build Coastguard Worker    ],
132*795d594fSAndroid Build Coastguard Worker}
133*795d594fSAndroid Build Coastguard Worker
134*795d594fSAndroid Build Coastguard Workerart_cc_defaults {
135*795d594fSAndroid Build Coastguard Worker    name: "art_libartpalette_tests_defaults",
136*795d594fSAndroid Build Coastguard Worker    srcs: ["apex/palette_test.cc"],
137*795d594fSAndroid Build Coastguard Worker    target: {
138*795d594fSAndroid Build Coastguard Worker        android: {
139*795d594fSAndroid Build Coastguard Worker            static_libs: ["libmodules-utils-build"],
140*795d594fSAndroid Build Coastguard Worker        },
141*795d594fSAndroid Build Coastguard Worker    },
142*795d594fSAndroid Build Coastguard Worker}
143*795d594fSAndroid Build Coastguard Worker
144*795d594fSAndroid Build Coastguard Worker// Version of ART gtest `art_libartpalette_tests` for host.
145*795d594fSAndroid Build Coastguard Worker// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
146*795d594fSAndroid Build Coastguard Workerart_cc_test {
147*795d594fSAndroid Build Coastguard Worker    name: "art_libartpalette_tests",
148*795d594fSAndroid Build Coastguard Worker    defaults: [
149*795d594fSAndroid Build Coastguard Worker        "art_gtest_defaults",
150*795d594fSAndroid Build Coastguard Worker        "art_libartpalette_tests_defaults",
151*795d594fSAndroid Build Coastguard Worker    ],
152*795d594fSAndroid Build Coastguard Worker    host_supported: true,
153*795d594fSAndroid Build Coastguard Worker    device_supported: false,
154*795d594fSAndroid Build Coastguard Worker}
155*795d594fSAndroid Build Coastguard Worker
156*795d594fSAndroid Build Coastguard Worker// Standalone version of ART gtest `art_libartpalette_tests`, not bundled with the ART APEX on
157*795d594fSAndroid Build Coastguard Worker// target.
158*795d594fSAndroid Build Coastguard Workerart_cc_test {
159*795d594fSAndroid Build Coastguard Worker    name: "art_standalone_libartpalette_tests",
160*795d594fSAndroid Build Coastguard Worker    defaults: [
161*795d594fSAndroid Build Coastguard Worker        "art_standalone_gtest_defaults",
162*795d594fSAndroid Build Coastguard Worker        "art_libartpalette_tests_defaults",
163*795d594fSAndroid Build Coastguard Worker    ],
164*795d594fSAndroid Build Coastguard Worker    test_config_template: ":art-gtests-target-standalone-cts-template",
165*795d594fSAndroid Build Coastguard Worker    test_suites: [
166*795d594fSAndroid Build Coastguard Worker        "cts",
167*795d594fSAndroid Build Coastguard Worker        "mcts-art",
168*795d594fSAndroid Build Coastguard Worker    ],
169*795d594fSAndroid Build Coastguard Worker}
170