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
17cc_defaults {
18    name: "libprofile_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    srcs: [
28        "profile/profile_boot_info.cc",
29        "profile/profile_compilation_info.cc",
30    ],
31    target: {
32        android: {
33            shared_libs: [
34                "libartpalette",
35                "libbase",
36                "libz",
37            ],
38            static_libs: [
39                // ZipArchive support, the order matters here to get all symbols.
40                "libziparchive",
41            ],
42            export_shared_lib_headers: ["libbase"],
43        },
44        not_windows: {
45            shared_libs: [
46                "libartpalette",
47                "libziparchive",
48                "libz",
49                "libbase",
50            ],
51            export_shared_lib_headers: ["libbase"],
52        },
53        windows: {
54            cflags: ["-Wno-thread-safety"],
55            static_libs: [
56                "libartpalette",
57                "libziparchive",
58                "libz",
59                "libbase",
60            ],
61            export_static_lib_headers: ["libbase"],
62        },
63        darwin: {
64            enabled: true,
65        },
66    },
67    //generated_sources: ["art_libartbase_operator_srcs"],
68    cflags: ["-DBUILDING_LIBART=1"],
69    export_include_dirs: ["."],
70    // ART's macros.h depends on libbase's macros.h.
71    // Note: runtime_options.h depends on cmdline. But we don't really want to export this
72    //       generically. dex2oat takes care of it itself.
73}
74
75cc_defaults {
76    name: "libprofile_static_base_defaults",
77    static_libs: [
78        "libbase",
79        "libz",
80        "libziparchive",
81    ],
82}
83
84cc_defaults {
85    name: "libprofile_static_defaults",
86    defaults: [
87        "libprofile_static_base_defaults",
88        "libartbase_static_defaults",
89        "libdexfile_static_defaults",
90    ],
91    static_libs: ["libprofile"],
92}
93
94cc_defaults {
95    name: "libprofiled_static_defaults",
96    defaults: [
97        "libprofile_static_base_defaults",
98        "libartbased_static_defaults",
99        "libdexfiled_static_defaults",
100    ],
101    static_libs: ["libprofiled"],
102}
103
104art_cc_library {
105    name: "libprofile",
106    defaults: [
107        "libprofile_defaults",
108        "libart_nativeunwind_defaults",
109    ],
110    shared_libs: [
111        "libbase",
112        "libziparchive",
113    ],
114    export_shared_lib_headers: ["libbase"],
115    target: {
116        android: {
117            shared_libs: [
118                "libartbase",
119                "libdexfile",
120            ],
121        },
122        not_windows: {
123            shared_libs: [
124                "libartbase",
125                "libdexfile",
126            ],
127        },
128        windows: {
129            enabled: true,
130            shared: {
131                enabled: false,
132            },
133            static_libs: [
134                "libartbase",
135                "libdexfile",
136            ],
137        },
138    },
139    apex_available: [
140        "com.android.art.release",
141        "com.android.art.debug",
142    ],
143}
144
145art_cc_library {
146    name: "libprofiled",
147    defaults: [
148        "art_debug_defaults",
149        "libprofile_defaults",
150    ],
151    shared_libs: [
152        "libbase",
153        "libziparchive",
154    ],
155    target: {
156        android: {
157            shared_libs: [
158                "libartbased",
159                "libdexfiled",
160            ],
161        },
162        not_windows: {
163            shared_libs: [
164                "libartbased",
165                "libdexfiled",
166            ],
167        },
168        windows: {
169            static_libs: [
170                "libartbased",
171                "libdexfiled",
172            ],
173        },
174    },
175    export_shared_lib_headers: ["libbase"],
176    apex_available: [
177        "com.android.art.debug",
178    ],
179}
180
181// For now many of these tests still use CommonRuntimeTest, almost universally because of
182// ScratchFile and related.
183// TODO: Remove CommonRuntimeTest dependency from these tests.
184art_cc_test {
185    name: "art_libprofile_tests",
186    defaults: [
187        "art_gtest_defaults",
188    ],
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        "libartbased",
200        "libdexfiled",
201        "libartbased",
202        "libziparchive",
203    ],
204}
205