1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "art_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["art_license"],
22}
23
24art_cc_defaults {
25    name: "libart-dexlayout-defaults",
26    defaults: ["art_defaults"],
27    host_supported: true,
28    srcs: [
29        "compact_dex_writer.cc",
30        "dexlayout.cc",
31        "dex_ir.cc",
32        "dex_ir_builder.cc",
33        "dex_verify.cc",
34        "dex_visualize.cc",
35        "dex_writer.cc",
36    ],
37    export_include_dirs: ["."],
38    target: {
39        android: {
40            shared_libs: [
41                "libartpalette",
42                "libbase",
43            ],
44        },
45        not_windows: {
46            shared_libs: [
47                "libartpalette",
48                "libbase",
49            ],
50        },
51        windows: {
52            cflags: ["-Wno-thread-safety"],
53            static_libs: [
54                "libartpalette",
55                "libbase",
56            ],
57        },
58    },
59    shared_libs: ["libz"],
60}
61
62cc_defaults {
63    name: "libart-dexlayout_static_base_defaults",
64    whole_static_libs: [
65        "libbase",
66        "libz",
67    ],
68}
69
70art_cc_library {
71    name: "libart-dexlayout",
72    defaults: [
73        "libart-dexlayout-defaults",
74        "dex2oat-pgo-defaults",
75    ],
76    target: {
77        android: {
78            lto: {
79                thin: true,
80            },
81            shared_libs: [
82                "libartbase",
83                "libdexfile",
84                "libprofile",
85            ],
86        },
87        not_windows: {
88            shared_libs: [
89                "libartbase",
90                "libdexfile",
91                "libprofile",
92            ],
93        },
94        windows: {
95            enabled: true,
96            shared: {
97                enabled: false,
98            },
99            static_libs: [
100                "libartbase",
101                "libdexfile",
102                "libprofile",
103            ],
104        },
105    },
106    apex_available: [
107        "com.android.art",
108        "com.android.art.debug",
109    ],
110}
111
112cc_defaults {
113    name: "libart-dexlayout_static_defaults",
114    defaults: [
115        "libart-dexlayout_static_base_defaults",
116        "libartbase_static_defaults",
117        "libdexfile_static_defaults",
118        "libprofile_static_defaults",
119    ],
120    whole_static_libs: ["libart-dexlayout"],
121}
122
123art_cc_library {
124    name: "libartd-dexlayout",
125    defaults: [
126        "libart-dexlayout-defaults",
127        "art_debug_defaults",
128    ],
129    target: {
130        android: {
131            shared_libs: [
132                "libartbased",
133                "libdexfiled",
134                "libprofiled",
135            ],
136        },
137        not_windows: {
138            shared_libs: [
139                "libartbased",
140                "libdexfiled",
141                "libprofiled",
142            ],
143        },
144        windows: {
145            static_libs: [
146                "libartbased",
147                "libdexfiled",
148                "libprofiled",
149            ],
150        },
151    },
152    apex_available: [
153        "com.android.art.debug",
154        // TODO(b/183882457): This lib doesn't go into com.android.art, but
155        // apex_available lists need to be the same for internal libs to avoid
156        // stubs, and this depends on libdexfiled.
157        "com.android.art",
158    ],
159}
160
161cc_defaults {
162    name: "libartd-dexlayout_static_defaults",
163    defaults: [
164        "libart-dexlayout_static_base_defaults",
165        "libartbased_static_defaults",
166        "libdexfiled_static_defaults",
167        "libprofiled_static_defaults",
168    ],
169    whole_static_libs: ["libartd-dexlayout"],
170}
171
172cc_defaults {
173    name: "dexlayout-defaults",
174    defaults: ["art_defaults"],
175    host_supported: true,
176    shared_libs: [
177        "libbase",
178    ],
179}
180
181art_cc_binary {
182    name: "dexlayout",
183    defaults: ["dexlayout-defaults"],
184    srcs: ["dexlayout_main.cc"],
185    shared_libs: [
186        "libdexfile",
187        "libprofile",
188        "libartbase",
189        "libart-dexlayout",
190    ],
191    apex_available: [
192        "com.android.art",
193        "com.android.art.debug",
194    ],
195}
196
197art_cc_binary {
198    name: "dexlayouts",
199    defaults: [
200        "dexlayout-defaults",
201        "libart-dexlayout_static_defaults",
202        "libprofile_static_defaults",
203        "libdexfile_static_defaults",
204        "libartbase_static_defaults",
205    ],
206    srcs: ["dexlayout_main.cc"],
207    host_supported: true,
208    device_supported: false,
209    target: {
210        darwin: {
211            enabled: false,
212        },
213        windows: {
214            enabled: true,
215            cflags: ["-Wno-thread-safety"],
216        },
217    },
218}
219
220art_cc_binary {
221    name: "dexlayoutd",
222    defaults: [
223        "art_debug_defaults",
224        "dexlayout-defaults",
225    ],
226    srcs: ["dexlayout_main.cc"],
227    shared_libs: [
228        "libdexfiled",
229        "libprofiled",
230        "libartbased",
231        "libartd-dexlayout",
232    ],
233    apex_available: [
234        "com.android.art.debug",
235    ],
236}
237
238art_cc_test {
239    name: "art_dexlayout_tests",
240    defaults: ["art_gtest_defaults"],
241    shared_libs: [
242        "libprofiled",
243        "libartd-dexlayout",
244    ],
245    data: [
246        ":art-gtest-jars-ManyMethods",
247    ],
248    srcs: ["dexlayout_test.cc"],
249    target: {
250        host: {
251            required: [
252                "dexdump",
253                "dexlayoutd",
254            ],
255        },
256    },
257}
258
259art_cc_binary {
260    name: "dexdiag",
261    defaults: ["art_defaults"],
262    host_supported: true,
263    srcs: ["dexdiag.cc"],
264    cflags: ["-Wall"],
265    shared_libs: [
266        "libart",
267        "libdexfile",
268        "libartbase",
269        "libart-dexlayout",
270        "libbase",
271    ],
272    target: {
273        android: {
274            shared_libs: [
275                "libmeminfo",
276            ],
277        },
278    },
279    apex_available: [
280        "com.android.art",
281        "com.android.art.debug",
282    ],
283}
284
285art_cc_test {
286    name: "art_dexdiag_tests",
287    host_supported: true,
288    defaults: [
289        "art_gtest_defaults",
290    ],
291    srcs: ["dexdiag_test.cc"],
292    target: {
293        host: {
294            required: ["dexdiag"],
295        },
296    },
297}
298