• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2020 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: "odrefresh-defaults",
28    srcs: [
29        "odrefresh.cc",
30        "odr_common.cc",
31        "odr_compilation_log.cc",
32        "odr_fs_utils.cc",
33        "odr_metrics.cc",
34        "odr_metrics_record.cc",
35    ],
36    local_include_dirs: ["include"],
37    header_libs: ["dexoptanalyzer_headers"],
38    generated_sources: [
39        "apex-info-list-tinyxml",
40        "art-apex-cache-info",
41        "art-odrefresh-operator-srcs",
42    ],
43    shared_libs: [
44        "libartpalette",
45        "libarttools", // Contains "libc++fs".
46        "libbase",
47        "liblog",
48    ],
49    static_libs: [
50        "libmodules-utils-build",
51    ],
52    tidy: true,
53    tidy_disabled_srcs: [":art-apex-cache-info"],
54    tidy_flags: [
55        "-format-style=file",
56        "-header-filter=(art/odrefresh/|system/apex/)",
57    ],
58}
59
60cc_defaults {
61    name: "odrefresh_binary_defaults",
62    defaults: [
63        "art_defaults",
64        "odrefresh-defaults",
65    ],
66    srcs: ["odrefresh_main.cc"],
67    shared_libs: [
68        "libdexfile",
69    ],
70    target: {
71        android: {
72            compile_multilib: "first",
73        },
74    },
75}
76
77cc_library_headers {
78    name: "odrefresh_headers",
79    defaults: ["art_defaults"],
80    export_include_dirs: ["include"],
81    host_supported: true,
82    stl: "none",
83    system_shared_libs: [],
84    sdk_version: "minimum", // The minimum sdk version required by users of this module.
85    apex_available: [
86        "//apex_available:platform", // For odsign.
87    ],
88    visibility: ["//visibility:public"],
89}
90
91gensrcs {
92    name: "art-odrefresh-operator-srcs",
93    cmd: "$(location generate_operator_out) art/odrefresh $(in) > $(out)",
94    tools: ["generate_operator_out"],
95    srcs: [
96        "odr_metrics.h",
97    ],
98    output_extension: "operator_out.cc",
99}
100
101art_cc_binary {
102    name: "odrefresh",
103    defaults: ["odrefresh_binary_defaults"],
104    required: [
105        "dexoptanalyzer",
106        "dex2oat",
107    ],
108    shared_libs: [
109        "libart",
110        "libartbase",
111    ],
112    apex_available: [
113        "com.android.art",
114        "com.android.art.debug",
115        "test_broken_com.android.art",
116    ],
117}
118
119// A no-op version of the odrefresh binary.
120art_cc_binary {
121    name: "odrefresh_broken",
122    defaults: ["art_defaults"],
123    stem: "odrefresh",
124    local_include_dirs: ["include"],
125    header_libs: ["libbase_headers"],
126    srcs: ["odrefresh_broken.cc"],
127    installable: false,
128    apex_available: ["test_jitzygote_com.android.art"],
129}
130
131art_cc_binary {
132    name: "odrefreshd",
133    defaults: [
134        "art_debug_defaults",
135        "odrefresh_binary_defaults",
136    ],
137    required: [
138        "dexoptanalyzerd",
139        "dex2oatd",
140    ],
141    shared_libs: [
142        "libartd",
143        "libartbased",
144    ],
145    apex_available: [
146        "com.android.art.debug",
147        // TODO(b/183882457): This binary doesn't go into com.android.art, but
148        // apex_available lists need to be the same for internal libs to avoid
149        // stubs, and this depends on libartd.
150        "com.android.art",
151        "test_broken_com.android.art",
152    ],
153}
154
155cc_library_static {
156    name: "libodrstatslog",
157    defaults: ["art_defaults"],
158    host_supported: true,
159    export_include_dirs: ["include"],
160    local_include_dirs: ["include"],
161    header_libs: ["libart_headers"],
162    shared_libs: ["libartbase"],
163    target: {
164        android: {
165            generated_headers: ["statslog_odrefresh.h"],
166            generated_sources: ["statslog_odrefresh.cpp"],
167            srcs: [
168                "odr_metrics_record.cc",
169                "odr_statslog_android.cc",
170            ],
171            shared_libs: ["libstatssocket"],
172        },
173        host: {
174            srcs: ["odr_statslog_host.cc"],
175        },
176    },
177    apex_available: [
178        "com.android.art",
179        "com.android.art.debug",
180    ],
181}
182
183art_cc_defaults {
184    name: "art_odrefresh_tests_defaults",
185    defaults: ["odrefresh-defaults"],
186    header_libs: ["odrefresh_headers"],
187    srcs: [
188        "odr_artifacts_test.cc",
189        "odr_common_test.cc",
190        "odr_compilation_log_test.cc",
191        "odr_fs_utils_test.cc",
192        "odr_metrics_test.cc",
193        "odr_metrics_record_test.cc",
194        "odrefresh_test.cc",
195    ],
196    static_libs: [
197        "libgmock",
198    ],
199}
200
201// Version of ART gtest `art_odrefresh_tests` bundled with the ART APEX on target.
202// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
203art_cc_test {
204    name: "art_odrefresh_tests",
205    defaults: [
206        "art_gtest_defaults",
207        "art_odrefresh_tests_defaults",
208    ],
209    host_supported: false,
210    shared_libs: [
211        "libdexfiled",
212    ],
213    // The test config template is needed even though it's not used by the test
214    // runner. Otherwise, Soong will generate a test config, which is adding
215    // `art-host-test` as a test tag, while this test does not support running
216    // on host.
217    // TODO(b/214016626): Remove this line once the bug is fixed.
218    test_config_template: "//art/test:art-gtests-target-standalone-template",
219}
220
221// Standalone version of ART gtest `art_odrefresh_tests`, not bundled with the ART APEX on target.
222art_cc_test {
223    name: "art_standalone_odrefresh_tests",
224    defaults: [
225        "art_standalone_gtest_defaults",
226        "art_odrefresh_tests_defaults",
227    ],
228    shared_libs: [
229        "libdexfile",
230    ],
231}
232
233genrule {
234    name: "statslog_odrefresh.h",
235    tools: ["stats-log-api-gen"],
236    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_odrefresh.h --module art --namespace art,metrics,statsd",
237    out: [
238        "statslog_odrefresh.h",
239    ],
240}
241
242genrule {
243    name: "statslog_odrefresh.cpp",
244    tools: ["stats-log-api-gen"],
245    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_odrefresh.cpp --module art --namespace art,metrics,statsd --importHeader statslog_odrefresh.h",
246    out: [
247        "statslog_odrefresh.cpp",
248    ],
249}
250
251xsd_config {
252    name: "art-apex-cache-info",
253    srcs: ["CacheInfo.xsd"],
254    package_name: "com.android.art",
255    api_dir: "schema",
256    gen_writer: true,
257    tinyxml: true,
258}
259