1//
2// Copyright (C) 2018 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}
25
26cc_defaults {
27    name: "libprofile_defaults",
28    defaults: ["art_defaults"],
29    host_supported: true,
30    srcs: [
31        "profile/profile_boot_info.cc",
32        "profile/profile_compilation_info.cc",
33    ],
34    target: {
35        android: {
36            shared_libs: [
37                "libartpalette",
38                "libbase",
39                "libz",
40            ],
41            static_libs: [
42                // ZipArchive support, the order matters here to get all symbols.
43                "libziparchive",
44            ],
45            export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
46        },
47        not_windows: {
48            shared_libs: [
49                "libartpalette",
50                "libziparchive",
51                "libz",
52                "libbase",
53            ],
54            export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
55        },
56        windows: {
57            cflags: ["-Wno-thread-safety"],
58            static_libs: [
59                "libartpalette",
60                "libziparchive",
61                "libz",
62                "libbase",
63            ],
64            export_static_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
65        },
66        darwin: {
67            enabled: true,
68        },
69    },
70    //generated_sources: ["art_libartbase_operator_srcs"],
71    export_include_dirs: ["."],
72}
73
74cc_defaults {
75    name: "libprofile_static_base_defaults",
76    whole_static_libs: [
77        "libbase",
78        "libz",
79        "libziparchive",
80    ],
81}
82
83cc_defaults {
84    name: "libprofile_static_defaults",
85    defaults: [
86        "libprofile_static_base_defaults",
87        "libartbase_static_defaults",
88        "libdexfile_static_defaults",
89    ],
90    whole_static_libs: ["libprofile"],
91}
92
93cc_defaults {
94    name: "libprofiled_static_defaults",
95    defaults: [
96        "libprofile_static_base_defaults",
97        "libartbased_static_defaults",
98        "libdexfiled_static_defaults",
99    ],
100    whole_static_libs: ["libprofiled"],
101}
102
103art_cc_library {
104    name: "libprofile",
105    defaults: [
106        "libprofile_defaults",
107        "libart_nativeunwind_defaults",
108    ],
109    shared_libs: [
110        "libbase",
111        "libziparchive",
112    ],
113    export_shared_lib_headers: ["libbase"],
114    target: {
115        android: {
116            shared_libs: [
117                "libartbase",
118                "libdexfile",
119            ],
120        },
121        not_windows: {
122            shared_libs: [
123                "libartbase",
124                "libdexfile",
125            ],
126        },
127        windows: {
128            enabled: true,
129            shared: {
130                enabled: false,
131            },
132            static_libs: [
133                "libartbase",
134                "libdexfile",
135            ],
136        },
137    },
138    apex_available: [
139        "com.android.art",
140        "com.android.art.debug",
141    ],
142}
143
144art_cc_library {
145    name: "libprofiled",
146    defaults: [
147        "art_debug_defaults",
148        "libprofile_defaults",
149    ],
150    shared_libs: [
151        "libbase",
152        "libziparchive",
153    ],
154    target: {
155        android: {
156            shared_libs: [
157                "libartbased",
158                "libdexfiled",
159            ],
160        },
161        not_windows: {
162            shared_libs: [
163                "libartbased",
164                "libdexfiled",
165            ],
166        },
167        windows: {
168            static_libs: [
169                "libartbased",
170                "libdexfiled",
171            ],
172        },
173    },
174    export_shared_lib_headers: ["libbase"],
175    apex_available: [
176        "com.android.art.debug",
177        // TODO(b/183882457): This lib doesn't go into com.android.art, but
178        // apex_available lists need to be the same for internal libs to avoid
179        // stubs, and libartd depends on this.
180        "com.android.art",
181    ],
182}
183
184// For now many of these tests still use CommonRuntimeTest, almost universally because of
185// ScratchFile and related.
186// TODO: Remove CommonRuntimeTest dependency from these tests.
187art_cc_defaults {
188    name: "art_libprofile_tests_defaults",
189    data: [
190        ":art-gtest-jars-ManyMethods",
191        ":art-gtest-jars-MultiDex",
192        ":art-gtest-jars-ProfileTestMultiDex",
193    ],
194    srcs: [
195        "profile/profile_boot_info_test.cc",
196        "profile/profile_compilation_info_test.cc",
197    ],
198    shared_libs: [
199        "libziparchive",
200    ],
201}
202
203// Version of ART gtest `art_libprofile_tests` bundled with the ART APEX on target.
204// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
205art_cc_test {
206    name: "art_libprofile_tests",
207    defaults: [
208        "art_gtest_defaults",
209        "art_libprofile_tests_defaults",
210    ],
211    shared_libs: [
212        "libartbased",
213        "libdexfiled",
214    ],
215}
216
217// Standalone version of ART gtest `art_libprofile_tests`, not bundled with the ART APEX on target.
218art_cc_test {
219    name: "art_standalone_libprofile_tests",
220    defaults: [
221        "art_standalone_gtest_defaults",
222        "art_libprofile_tests_defaults",
223    ],
224    shared_libs: [
225        "libartbase",
226        "libdexfile",
227    ],
228    test_config: "art_standalone_libprofile_tests.xml",
229}
230