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}
25
26cc_defaults {
27    name: "oatdump-defaults",
28    defaults: ["art_defaults"],
29    host_supported: true,
30    srcs: ["oatdump.cc"],
31    header_libs: [
32        "art_cmdlineparser_headers",
33    ],
34}
35
36// Collect all the static defaults and build a host-only static library, which
37// is then used for the (mostly) static host oatdump binary.
38art_cc_library_static {
39    name: "liboatdump_static",
40    device_supported: false,
41    host_supported: true,
42    defaults: [
43        "libart-compiler_static_defaults",
44        "libart-dexlayout_static_defaults",
45        "libart-disassembler_static_defaults",
46        "libart_static_defaults",
47        "libartbase_static_defaults",
48        "libdexfile_static_defaults",
49        "libprofile_static_defaults",
50        "oatdump-defaults",
51    ],
52    whole_static_libs: [
53        "libbase",
54    ],
55}
56
57art_cc_binary {
58    name: "oatdump",
59    defaults: ["oatdump-defaults"],
60
61    target: {
62        android: {
63            shared_libs: [
64                "libart",
65                "libart-compiler",
66                "libart-dexlayout",
67                "libart-disassembler",
68                "libartbase",
69                "libbase",
70                "libdexfile",
71                "libprofile",
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    ],
85}
86
87// Collect all the static defaults and build a host-only static library, which
88// is then used for the (mostly) static host oatdump binary.
89art_cc_library_static {
90    name: "liboatdumpd_static",
91    device_supported: false,
92    host_supported: true,
93    defaults: [
94        "libartd-compiler_static_defaults",
95        "libartd-dexlayout_static_defaults",
96        "libartd-disassembler_static_defaults",
97        "libartd_static_defaults",
98        "libartbased_static_defaults",
99        "libdexfiled_static_defaults",
100        "libprofiled_static_defaults",
101        "oatdump-defaults",
102    ],
103    whole_static_libs: [
104        "libbase",
105    ],
106}
107
108art_cc_binary {
109    name: "oatdumpd",
110    defaults: [
111        "art_debug_defaults",
112        "oatdump-defaults",
113    ],
114
115    target: {
116        android: {
117            shared_libs: [
118                "libartbased",
119                "libartd",
120                "libartd-compiler",
121                "libartd-dexlayout",
122                "libartd-disassembler",
123                "libbase",
124                "libdexfiled",
125                "libprofiled",
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        "libart-compiler_static_defaults",
171        "libart-dexlayout_static_defaults",
172        "oatdumps-defaults",
173    ],
174    static_libs: [
175        "libart-disassembler",
176        "libvixl",
177    ],
178    // We need this to resolve libartpalette symbols
179    // correctly. Multiple source libraries depend on it.
180    // TODO(b/122885634): This is also necessary for the static lib ordering bug
181    // with APEX stubs.
182    group_static_libs: true,
183}
184
185art_cc_binary {
186    name: "oatdumpds",
187    defaults: [
188        "art_debug_defaults",
189        "libartd_static_defaults",
190        "libartbased_static_defaults",
191        "libdexfiled_static_defaults",
192        "libprofiled_static_defaults",
193        "libartd-compiler_static_defaults",
194        "libartd-dexlayout_static_defaults",
195        "oatdumps-defaults",
196    ],
197    static_libs: [
198        "libartd-disassembler",
199        "libvixld",
200    ],
201    group_static_libs: true,
202}
203
204art_cc_defaults {
205    name: "art_oatdump_tests_defaults",
206    data: [
207        ":art-gtest-jars-ProfileTestMultiDex",
208    ],
209    srcs: [
210        "oatdump_app_test.cc",
211        "oatdump_test.cc",
212        "oatdump_image_test.cc",
213    ],
214    target: {
215        host: {
216            required: [
217                "dex2oatd",
218                "dex2oatds",
219                "dexdump",
220                "oatdumpd",
221                "oatdumpds",
222            ],
223        },
224    },
225}
226
227// Version of ART gtest `art_oatdump_tests` bundled with the ART APEX on target.
228// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
229art_cc_test {
230    name: "art_oatdump_tests",
231    defaults: [
232        "art_gtest_defaults",
233        "art_oatdump_tests_defaults",
234    ],
235}
236
237// Standalone version of ART gtest `art_oatdump_tests`, not bundled with the ART APEX on target.
238art_cc_test {
239    name: "art_standalone_oatdump_tests",
240    defaults: [
241        "art_standalone_gtest_defaults",
242        "art_oatdump_tests_defaults",
243    ],
244    test_config: "art_standalone_oatdump_tests.xml",
245}
246