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