1//
2// Copyright (C) 2011 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    default_team: "trendy_team_art_performance",
25}
26
27cc_defaults {
28    name: "oatdump-defaults",
29    defaults: ["art_defaults"],
30    host_supported: true,
31    srcs: ["oatdump.cc"],
32    header_libs: [
33        "art_cmdlineparser_headers",
34    ],
35}
36
37// Collect all the static defaults and build a host-only static library, which
38// is then used for the (mostly) static host oatdump binary.
39art_cc_library_static {
40    name: "liboatdump_static",
41    device_supported: false,
42    host_supported: true,
43    defaults: [
44        "libart-disassembler_static_defaults",
45        "libart_static_defaults",
46        "libartbase_static_defaults",
47        "libdexfile_static_defaults",
48        "libprofile_static_defaults",
49        "oatdump-defaults",
50    ],
51    whole_static_libs: [
52        "libbase",
53    ],
54}
55
56art_cc_binary {
57    name: "oatdump",
58    defaults: ["oatdump-defaults"],
59
60    target: {
61        android: {
62            shared_libs: [
63                "libart",
64                "libart-disassembler",
65                "libartbase",
66                "libbase",
67                "libdexfile",
68                "libprofile",
69            ],
70            static_libs: [
71                "libelffile",
72            ],
73        },
74        host: {
75            // Make the host binary static, except for system libraries.
76            static_libs: ["liboatdump_static"],
77            stl: "c++_static",
78        },
79    },
80
81    apex_available: [
82        "com.android.art",
83        "com.android.art.debug",
84        "test_broken_com.android.art",
85    ],
86}
87
88// Collect all the static defaults and build a host-only static library, which
89// is then used for the (mostly) static host oatdump binary.
90art_cc_library_static {
91    name: "liboatdumpd_static",
92    device_supported: false,
93    host_supported: true,
94    defaults: [
95        "libartd-disassembler_static_defaults",
96        "libartd_static_defaults",
97        "libartbased_static_defaults",
98        "libdexfiled_static_defaults",
99        "libprofiled_static_defaults",
100        "oatdump-defaults",
101    ],
102    whole_static_libs: [
103        "libbase",
104    ],
105}
106
107art_cc_binary {
108    name: "oatdumpd",
109    defaults: [
110        "art_debug_defaults",
111        "oatdump-defaults",
112    ],
113
114    target: {
115        android: {
116            shared_libs: [
117                "libartbased",
118                "libartd",
119                "libartd-disassembler",
120                "libbase",
121                "libdexfiled",
122                "libprofiled",
123            ],
124            static_libs: [
125                "libelffiled",
126            ],
127        },
128        host: {
129            // Make the host binary static, except for system libraries.
130            static_libs: ["liboatdumpd_static"],
131            stl: "c++_static",
132        },
133    },
134
135    apex_available: [
136        "com.android.art.debug",
137    ],
138}
139
140cc_defaults {
141    name: "oatdumps-defaults",
142    device_supported: false,
143    static_executable: true,
144    defaults: [
145        "oatdump-defaults",
146    ],
147    target: {
148        darwin: {
149            enabled: false,
150        },
151    },
152    ldflags: [
153        // We need this because GC stress mode makes use of
154        // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
155        // defined in libgcc_eh.a(unwind-dw2.o)
156        // TODO: Having this is not ideal as it might obscure errors.
157        // Try to get rid of it.
158        "-z muldefs",
159    ],
160    static_libs: ["libsigchain_fake"],
161}
162
163art_cc_binary {
164    name: "oatdumps",
165    defaults: [
166        "libart_static_defaults",
167        "libartbase_static_defaults",
168        "libdexfile_static_defaults",
169        "libprofile_static_defaults",
170        "oatdumps-defaults",
171    ],
172    static_libs: [
173        "libart-disassembler",
174        "libvixl",
175    ],
176}
177
178art_cc_binary {
179    name: "oatdumpds",
180    defaults: [
181        "art_debug_defaults",
182        "libartd_static_defaults",
183        "libartbased_static_defaults",
184        "libdexfiled_static_defaults",
185        "libprofiled_static_defaults",
186        "oatdumps-defaults",
187    ],
188    static_libs: [
189        "libartd-disassembler",
190        "libvixld",
191    ],
192}
193
194art_cc_defaults {
195    name: "art_oatdump_tests_defaults",
196    data: [
197        ":art-gtest-jars-ProfileTestMultiDex",
198    ],
199    srcs: [
200        "oatdump_app_test.cc",
201        "oatdump_test.cc",
202        "oatdump_image_test.cc",
203    ],
204    target: {
205        host: {
206            required: [
207                "dex2oatd",
208                "dex2oatds",
209                "dexdump",
210                "oatdumpd",
211                "oatdumpds",
212            ],
213        },
214    },
215}
216
217// Version of ART gtest `art_oatdump_tests` bundled with the ART APEX on target.
218// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
219art_cc_test {
220    name: "art_oatdump_tests",
221    defaults: [
222        "art_gtest_defaults",
223        "art_oatdump_tests_defaults",
224    ],
225}
226
227// Standalone version of ART gtest `art_oatdump_tests`, not bundled with the ART APEX on target.
228art_cc_test {
229    name: "art_standalone_oatdump_tests",
230    defaults: [
231        "art_standalone_gtest_defaults",
232        "art_oatdump_tests_defaults",
233    ],
234    data: [":generate-boot-image"],
235    test_config: "art_standalone_oatdump_tests.xml",
236}
237
238phony_rule {
239    name: "dump-oat",
240    phony_deps: ["dump-oat-boot"],
241}
242