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
15art_cc_defaults {
16    name: "libart-dexlayout-defaults",
17    defaults: ["art_defaults"],
18    visibility: [
19        // Visibility for prebuilt binaries from the prebuilt of this module.
20        // TODO(b/155921753): Restrict this when prebuilts are in their proper
21        // locations.
22        "//prebuilts:__subpackages__",
23    ],
24    host_supported: true,
25    srcs: [
26        "compact_dex_writer.cc",
27        "dexlayout.cc",
28        "dex_ir.cc",
29        "dex_ir_builder.cc",
30        "dex_verify.cc",
31        "dex_visualize.cc",
32        "dex_writer.cc",
33    ],
34    export_include_dirs: ["."],
35    target: {
36        android: {
37            shared_libs: [
38                "libartpalette",
39                "libbase",
40            ],
41        },
42        not_windows: {
43            shared_libs: [
44                "libartpalette",
45                "libbase",
46            ],
47        },
48        windows: {
49            cflags: ["-Wno-thread-safety"],
50            static_libs: [
51                "libartpalette",
52                "libbase",
53            ],
54        },
55    },
56    shared_libs: ["libz"],
57}
58
59cc_defaults {
60    name: "libart-dexlayout_static_base_defaults",
61    static_libs: [
62        "libbase",
63        "libz",
64    ],
65}
66
67art_cc_library {
68    name: "libart-dexlayout",
69    defaults: [
70        "libart-dexlayout-defaults",
71        "dex2oat-pgo-defaults",
72    ],
73    target: {
74        android: {
75            lto: {
76                thin: true,
77            },
78            shared_libs: [
79                "libartbase",
80                "libdexfile",
81                "libprofile",
82            ],
83        },
84        not_windows: {
85            shared_libs: [
86                "libartbase",
87                "libdexfile",
88                "libprofile",
89            ],
90        },
91        windows: {
92            enabled: true,
93            shared: {
94                enabled: false,
95            },
96            static_libs: [
97                "libartbase",
98                "libdexfile",
99                "libprofile",
100            ],
101        },
102    },
103    apex_available: [
104        "com.android.art.release",
105        "com.android.art.debug",
106    ],
107}
108
109cc_defaults {
110    name: "libart-dexlayout_static_defaults",
111    defaults: [
112        "libart-dexlayout_static_base_defaults",
113        "libartbase_static_defaults",
114        "libdexfile_static_defaults",
115        "libprofile_static_defaults",
116    ],
117    static_libs: ["libart-dexlayout"],
118}
119
120art_cc_library {
121    name: "libartd-dexlayout",
122    defaults: [
123        "libart-dexlayout-defaults",
124        "art_debug_defaults",
125    ],
126    target: {
127        android: {
128            shared_libs: [
129                "libartbased",
130                "libdexfiled",
131                "libprofiled",
132            ],
133        },
134        not_windows: {
135            shared_libs: [
136                "libartbased",
137                "libdexfiled",
138                "libprofiled",
139            ],
140        },
141        windows: {
142            static_libs: [
143                "libartbased",
144                "libdexfiled",
145                "libprofiled",
146            ],
147        },
148    },
149    apex_available: [
150        "com.android.art.debug",
151    ],
152}
153
154cc_defaults {
155    name: "libartd-dexlayout_static_defaults",
156    defaults: [
157        "libart-dexlayout_static_base_defaults",
158        "libartbased_static_defaults",
159        "libdexfiled_static_defaults",
160        "libprofiled_static_defaults",
161    ],
162    static_libs: ["libartd-dexlayout"],
163}
164
165cc_defaults {
166    name: "dexlayout-defaults",
167    defaults: ["art_defaults"],
168    host_supported: true,
169    shared_libs: [
170        "libbase",
171    ],
172}
173
174art_cc_binary {
175    name: "dexlayout",
176    defaults: ["dexlayout-defaults"],
177    srcs: ["dexlayout_main.cc"],
178    shared_libs: [
179        "libdexfile",
180        "libprofile",
181        "libartbase",
182        "libart-dexlayout",
183    ],
184    apex_available: [
185        "com.android.art.release",
186        "com.android.art.debug",
187    ],
188}
189
190art_cc_binary {
191    name: "dexlayouts",
192    defaults: [
193        "dexlayout-defaults",
194        "libart-dexlayout_static_defaults",
195        "libprofile_static_defaults",
196        "libdexfile_static_defaults",
197        "libartbase_static_defaults",
198    ],
199    srcs: ["dexlayout_main.cc"],
200    host_supported: true,
201    device_supported: false,
202    target: {
203        darwin: {
204            enabled: false,
205        },
206        windows: {
207            enabled: true,
208            cflags: ["-Wno-thread-safety"],
209        },
210    },
211}
212
213art_cc_binary {
214    name: "dexlayoutd",
215    defaults: [
216        "art_debug_defaults",
217        "dexlayout-defaults",
218    ],
219    srcs: ["dexlayout_main.cc"],
220    shared_libs: [
221        "libdexfiled",
222        "libprofiled",
223        "libartbased",
224        "libartd-dexlayout",
225    ],
226    apex_available: [
227        "com.android.art.debug",
228    ],
229}
230
231art_cc_test {
232    name: "art_dexlayout_tests",
233    defaults: ["art_gtest_defaults"],
234    shared_libs: [
235        "libprofiled",
236        "libartd-dexlayout",
237    ],
238    data: [
239        ":art-gtest-jars-ManyMethods",
240    ],
241    srcs: ["dexlayout_test.cc"],
242    required: [
243        "dexlayoutd",
244        "dexdump",
245    ],
246}
247
248art_cc_binary {
249    name: "dexdiag",
250    defaults: ["art_defaults"],
251    host_supported: true,
252    srcs: ["dexdiag.cc"],
253    cflags: ["-Wall"],
254    shared_libs: [
255        "libart",
256        "libdexfile",
257        "libartbase",
258        "libart-dexlayout",
259        "libbase",
260    ],
261    target: {
262        android: {
263            shared_libs: [
264                "libmeminfo",
265            ],
266        },
267    },
268    apex_available: [
269        "com.android.art.release",
270        "com.android.art.debug",
271    ],
272}
273
274art_cc_test {
275    name: "art_dexdiag_tests",
276    host_supported: true,
277    defaults: [
278        "art_gtest_defaults",
279    ],
280    srcs: ["dexdiag_test.cc"],
281    required: ["dexdiag"],
282}
283