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
17cc_defaults {
18    name: "libartpalette_defaults",
19    defaults: ["art_defaults"],
20    visibility: [
21        // Visibility for prebuilt binaries from the prebuilt of this module.
22        // TODO(b/155921753): Restrict this when prebuilts are in their proper
23        // locations.
24        "//prebuilts:__subpackages__",
25    ],
26    host_supported: true,
27    export_include_dirs: ["include"],
28}
29
30cc_library_headers {
31    name: "libartpalette-headers",
32    export_include_dirs: ["include"],
33    host_supported: true,
34    visibility: ["//system/libartpalette"],
35}
36
37// libartpalette is the dynamic loader of the platform abstraction
38// layer. It is only used on Android. For other targets, it just
39// implements a fake platform implementation.
40art_cc_library {
41    name: "libartpalette",
42    defaults: ["libartpalette_defaults"],
43    header_libs: ["libbase_headers"],
44    target: {
45        // Targets supporting dlopen build the client library which loads
46        // and binds the methods in the libartpalette-system library.
47        android: {
48            // libartpalette.so dlopen()'s libartpalette-system.
49            required: ["libartpalette-system"],
50            srcs: ["apex/palette.cc"],
51            shared_libs: ["liblog"],
52            version_script: "libartpalette.map.txt",
53        },
54        linux_bionic: {
55            header_libs: ["libbase_headers"],
56            srcs: ["system/palette_fake.cc"],
57            shared: {
58                shared_libs: [
59                    "libbase",
60                    "liblog",
61                ],
62            },
63            version_script: "libartpalette.map.txt",
64        },
65        linux_glibc: {
66            header_libs: ["libbase_headers"],
67            srcs: ["system/palette_fake.cc"],
68            shared: {
69                shared_libs: [
70                    "libbase",
71                    "liblog",
72                ],
73            },
74            version_script: "libartpalette.map.txt",
75        },
76        // Targets without support for dlopen just use the sources for
77        // the system library which actually implements functionality.
78        darwin: {
79            enabled: true,
80            header_libs: ["libbase_headers"],
81            srcs: ["system/palette_fake.cc"],
82            static_libs: [
83                "libbase",
84                "liblog",
85            ],
86        },
87        windows: {
88            enabled: true,
89            header_libs: ["libbase_headers"],
90            srcs: ["system/palette_fake.cc"],
91            static_libs: [
92                "libbase",
93                "liblog",
94            ],
95        },
96    },
97    apex_available: [
98        "com.android.art.release",
99        "com.android.art.debug",
100        // TODO(b/142944931): remove this
101        "com.android.runtime", // due to the transitive dependency from linker
102    ],
103}
104
105art_cc_test {
106    name: "art_libartpalette_tests",
107    defaults: ["art_gtest_defaults"],
108    host_supported: true,
109    srcs: ["apex/palette_test.cc"],
110    shared_libs: ["libartpalette"],
111}
112