1//
2// Copyright (C) 2016 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: "profman-defaults",
28    host_supported: true,
29    defaults: ["art_defaults"],
30    srcs: [
31        "boot_image_profile.cc",
32        "profman.cc",
33        "profile_assistant.cc",
34    ],
35
36    target: {
37        android: {
38            compile_multilib: "first",
39            shared_libs: [
40                "libbase",
41            ],
42        },
43        host: {
44            whole_static_libs: [
45                "libbase",
46            ],
47        },
48        darwin: {
49            enabled: true,
50        },
51    },
52}
53
54// Collect all the static defaults and build a host-only static library, which
55// is then used for the (mostly) static host profman binary.
56art_cc_library_static {
57    name: "libprofman_static",
58    device_supported: false,
59    host_supported: true,
60    defaults: [
61        "art_defaults",
62        "libartbase_static_defaults",
63        "libdexfile_static_defaults",
64        "libprofile_static_defaults",
65    ],
66    target: {
67        darwin: {
68            enabled: true,
69        },
70    },
71}
72
73art_cc_library_static {
74    name: "libprofmand_static",
75    device_supported: false,
76    host_supported: true,
77    defaults: [
78        "art_debug_defaults",
79        "art_defaults",
80        "libartbased_static_defaults",
81        "libdexfiled_static_defaults",
82        "libprofiled_static_defaults",
83    ],
84    target: {
85        darwin: {
86            enabled: true,
87        },
88    },
89}
90
91art_cc_binary {
92    name: "profman",
93    defaults: ["profman-defaults"],
94    target: {
95        android: {
96            shared_libs: [
97                "libartbase",
98                "libdexfile",
99                "libprofile",
100            ],
101        },
102        host: {
103            // Make the host binary static, except for system libraries. This
104            // avoids having to bundle host dynamic libs in prebuilts.
105            static_libs: ["libprofman_static"],
106            stl: "c++_static",
107
108        },
109    },
110    apex_available: [
111        "com.android.art",
112        "com.android.art.debug",
113    ],
114}
115
116art_cc_binary {
117    name: "profmand",
118    defaults: [
119        "art_debug_defaults",
120        "profman-defaults",
121    ],
122    target: {
123        android: {
124            shared_libs: [
125                "libartbased",
126                "libdexfiled",
127                "libprofiled",
128            ],
129        },
130        host: {
131            // Make the host binary static, except for system libraries. This
132            // avoids having to bundle host dynamic libs in prebuilts.
133            static_libs: ["libprofmand_static"],
134            stl: "c++_static",
135
136        },
137    },
138    apex_available: [
139        "com.android.art.debug",
140    ],
141}
142
143art_cc_binary {
144    name: "profmans",
145    defaults: [
146        "profman-defaults",
147        "libprofile_static_defaults",
148        "libdexfile_static_defaults",
149        "libartbase_static_defaults",
150    ],
151    host_supported: true,
152    device_supported: false,
153    target: {
154        darwin: {
155            enabled: false,
156        },
157        windows: {
158            enabled: true,
159            cflags: ["-Wno-thread-safety"],
160        },
161    },
162}
163
164art_cc_defaults {
165    name: "art_profman_tests_defaults",
166    data: [
167        ":art-gtest-jars-ProfileTestMultiDex",
168    ],
169    srcs: ["profile_assistant_test.cc"],
170}
171
172// Version of ART gtest `art_profman_tests` bundled with the ART APEX on target.
173// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
174art_cc_test {
175    name: "art_profman_tests",
176    defaults: [
177        "art_gtest_defaults",
178        "art_profman_tests_defaults",
179    ],
180    shared_libs: [
181        "libprofiled",
182    ],
183    target: {
184        host: {
185            required: ["profmand"],
186        },
187    },
188}
189
190// Standalone version of ART gtest `art_profman_tests`, not bundled with the ART APEX on target.
191art_cc_test {
192    name: "art_standalone_profman_tests",
193    defaults: [
194        "art_standalone_gtest_defaults",
195        "art_profman_tests_defaults",
196    ],
197    shared_libs: [
198        "libprofile",
199    ],
200    target: {
201        host: {
202            required: ["profman"],
203        },
204    },
205    test_config_template: "art_standalone_profman_tests.xml",
206}
207