• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2021 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
24// This native library contains JNI support code for the ART Service Java
25// Language library.
26cc_defaults {
27    name: "libartservice_defaults",
28    defaults: ["art_defaults"],
29    host_supported: true,
30    srcs: [
31        "native/service.cc",
32    ],
33    export_include_dirs: ["native"],
34    shared_libs: [
35        "liblog", // Used by "JNIHelp.h".
36        "libnativehelper",
37    ],
38    target: {
39        android: {
40            compile_multilib: "first",
41        },
42    },
43}
44
45cc_library {
46    name: "libartservice",
47    defaults: ["libartservice_defaults"],
48    apex_available: [
49        "com.android.art",
50        "com.android.art.debug",
51    ],
52    shared_libs: [
53        "libart",
54        "libartbase",
55        "libarttools",
56        "libbase",
57    ],
58}
59
60cc_library {
61    name: "libartserviced",
62    defaults: [
63        "libartservice_defaults",
64        "art_debug_defaults",
65    ],
66    apex_available: [
67        "com.android.art",
68        "com.android.art.debug",
69    ],
70    shared_libs: [
71        "libartd",
72        "libartbased",
73        "libarttools",
74        "libbase",
75    ],
76}
77
78java_defaults {
79    name: "service-art-defaults",
80    defaults: [
81        "framework-system-server-module-defaults",
82    ],
83    sdk_version: "system_server_current",
84    min_sdk_version: "31",
85    srcs: [
86        "java/**/*.java",
87    ],
88    libs: [
89        "androidx.annotation_annotation",
90        "aconfig-annotations-lib",
91        "art-aconfig-flags-java-lib",
92        "auto_value_annotations",
93        "sdk_module-lib_current_framework-configinfrastructure",
94        "sdk_module-lib_current_framework-permission-s",
95        // TODO(b/256866172): Transitive dependency, for r8 only.
96        "framework-statsd.stubs.module_lib",
97        // TODO(b/256866172): Transitive dependency, for r8 only. This module
98        // always refers to the jar in prebuilts/sdk. We can't use
99        // "framework-connectivity.stubs.module_lib" here because it's not
100        // available on master-art.
101        "sdk_module-lib_current_framework-connectivity",
102    ],
103    static_libs: [
104        "android.content.pm.flags-aconfig-java-export",
105        "android.os.flags-aconfig-java-export",
106        "art-statslog-art-java",
107        "artd-aidl-java",
108        "dexopt_chroot_setup-aidl-java",
109        "modules-utils-build",
110        "modules-utils-package-state",
111        "modules-utils-shell-command-handler",
112        "service-art-proto-java",
113    ],
114    plugins: [
115        "auto_value_plugin",
116    ],
117}
118
119// Used by tests to allow tests to mock the right classes.
120java_library {
121    name: "service-art-pre-jarjar",
122    defaults: ["service-art-defaults"],
123    installable: false,
124    visibility: [
125        "//visibility:override",
126        "//visibility:private",
127    ],
128}
129
130// Provides the API and implementation of the ART Service class that will be
131// loaded by the System Server.
132java_sdk_library {
133    // This target is named 'service-art' to conform to the naming conventions
134    // for JAR files in the System Server.
135    name: "service-art",
136    defaults: [
137        "service-art-defaults",
138        "framework-system-server-module-optimize-defaults",
139    ],
140    permitted_packages: [
141        "com.android.server.art",
142    ],
143    dex_preopt: {
144        profile: "art-profile",
145    },
146    visibility: [
147        "//art:__subpackages__",
148        "//frameworks/base/services/core",
149    ],
150    apex_available: [
151        "com.android.art",
152        "com.android.art.debug",
153    ],
154    jarjar_rules: "jarjar-rules.txt",
155    optimize: {
156        proguard_flags_files: ["proguard.flags"],
157    },
158    aconfig_declarations: [
159        "art-aconfig-flags",
160    ],
161}
162
163java_library {
164    name: "service-art-proto-java",
165    proto: {
166        type: "lite",
167    },
168    srcs: [
169        "proto/**/*.proto",
170    ],
171    sdk_version: "system_server_current",
172    min_sdk_version: "31",
173    apex_available: [
174        "com.android.art",
175        "com.android.art.debug",
176    ],
177}
178
179java_library {
180    name: "art-statslog-art-java",
181    srcs: [
182        ":art-statslog-art-java-gen",
183    ],
184    libs: [
185        "framework-statsd.stubs.module_lib",
186    ],
187    sdk_version: "system_server_current",
188    min_sdk_version: "31",
189    apex_available: [
190        "com.android.art",
191        "com.android.art.debug",
192    ],
193}
194
195genrule {
196    name: "art-statslog-art-java-gen",
197    tools: ["stats-log-api-gen"],
198    cmd: "$(location stats-log-api-gen) --java $(out) --module art --javaPackage com.android.server.art --javaClass ArtStatsLog",
199    out: ["java/com/android/server/art/ArtStatsLog.java"],
200}
201
202art_cc_defaults {
203    name: "art_libartservice_tests_defaults",
204    defaults: ["libartservice_defaults"],
205    srcs: [
206        "native/service_test.cc",
207    ],
208    static_libs: [
209        "libgmock",
210    ],
211}
212
213// Version of ART gtest `art_libartservice_tests` for host.
214// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
215art_cc_test {
216    name: "art_libartservice_tests",
217    device_supported: false,
218    defaults: [
219        "art_gtest_defaults",
220        "art_libartservice_tests_defaults",
221    ],
222    shared_libs: [
223        "libarttools",
224        "libbase",
225    ],
226}
227
228// Standalone version of ART gtest `art_libartservice_tests`, not bundled with the ART APEX on
229// target.
230art_cc_test {
231    name: "art_standalone_libartservice_tests",
232    defaults: [
233        "art_standalone_gtest_defaults",
234        "art_libartservice_tests_defaults",
235    ],
236    static_libs: [
237        "libarttools",
238        "libbase",
239    ],
240    test_config_template: ":art-gtests-target-standalone-non-multilib-template",
241}
242
243android_test {
244    name: "ArtServiceTests",
245
246    // Include all test java files.
247    srcs: [
248        "javatests/**/*.java",
249    ],
250
251    libs: [
252        "sdk_module-lib_current_framework-configinfrastructure",
253    ],
254
255    static_libs: [
256        "androidx.test.ext.junit",
257        "androidx.test.ext.truth",
258        "androidx.test.runner",
259        "artd-aidl-java",
260        "flag-junit",
261        "framework-annotations-lib",
262        // We need ExtendedMockito to mock static methods.
263        "mockito-target-extended-minus-junit4",
264        "modules-utils-package-state",
265        "service-art-pre-jarjar",
266        // Statically link against system server to allow us to mock system
267        // server APIs. This won't work on master-art, but it's fine because we
268        // don't run this test on master-art.
269        "services.core",
270    ],
271
272    jni_libs: [
273        "libartservice",
274        // The two libraries below are required by ExtendedMockito.
275        "libdexmakerjvmtiagent",
276        "libstaticjvmtiagent",
277    ],
278    compile_multilib: "first",
279
280    // TODO: This module should move to sdk_version: "system_server_current" when possible,
281    //   as this will restrict the APIs available to just that expected system API. For now,
282    //   a compileOnly / runtimeOnly split for dependencies doesn't exist in the build system
283    //   and so it's not possible to enforce.
284    min_sdk_version: "31",
285
286    test_suites: ["general-tests"],
287    test_config: "ArtServiceTests.xml",
288}
289
290filegroup {
291    name: "libartservice_protos",
292    srcs: [
293        "proto/**/*.proto",
294    ],
295    visibility: [
296        "//cts/hostsidetests/compilation",
297    ],
298}
299