• 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    shared_libs: [
34        "libbase",
35    ],
36}
37
38cc_library {
39    name: "libartservice",
40    defaults: ["libartservice_defaults"],
41    apex_available: [
42        "com.android.art",
43        "com.android.art.debug",
44    ],
45    shared_libs: [
46    ],
47}
48
49cc_library {
50    name: "libartserviced",
51    defaults: [
52        "libartservice_defaults",
53        "art_debug_defaults",
54    ],
55    apex_available: [
56        "com.android.art",
57        "com.android.art.debug",
58    ],
59    shared_libs: [
60    ],
61}
62
63java_defaults {
64    name: "service-art-defaults",
65    defaults: [
66        "framework-system-server-module-defaults",
67    ],
68    sdk_version: "system_server_current",
69    min_sdk_version: "31",
70    srcs: [
71        "java/**/*.java",
72    ],
73    libs: [
74        "androidx.annotation_annotation",
75        "auto_value_annotations",
76        "sdk_module-lib_current_framework-permission-s",
77        // TODO(b/256866172): Transitive dependency, for r8 only.
78        "framework-statsd.stubs.module_lib",
79        // TODO(b/256866172): Transitive dependency, for r8 only. This module
80        // always refers to the jar in prebuilts/sdk. We can't use
81        // "framework-connectivity.stubs.module_lib" here because it's not
82        // available on master-art.
83        "sdk_module-lib_current_framework-connectivity",
84    ],
85    static_libs: [
86        "art-statslog-art-java",
87        "artd-aidl-java",
88        "modules-utils-package-state",
89        "modules-utils-shell-command-handler",
90        "service-art-proto-java",
91    ],
92    plugins: [
93        "auto_value_plugin",
94    ],
95}
96
97// Used by tests to allow tests to mock the right classes.
98java_library {
99    name: "service-art-pre-jarjar",
100    defaults: ["service-art-defaults"],
101    installable: false,
102    visibility: [
103        "//visibility:override",
104        "//visibility:private",
105    ],
106}
107
108// Provides the API and implementation of the ART Service class that will be
109// loaded by the System Server.
110java_sdk_library {
111    // This target is named 'service-art' to conform to the naming conventions
112    // for JAR files in the System Server.
113    name: "service-art",
114    defaults: [
115        "service-art-defaults",
116        "framework-system-server-module-optimize-defaults",
117    ],
118    permitted_packages: ["com.android.server.art"],
119    visibility: [
120        "//art:__subpackages__",
121        "//frameworks/base/services/core",
122    ],
123    apex_available: [
124        "com.android.art",
125        "com.android.art.debug",
126    ],
127    jarjar_rules: "jarjar-rules.txt",
128    optimize: {
129        proguard_flags_files: ["proguard.flags"],
130    },
131}
132
133java_library {
134    name: "service-art-proto-java",
135    proto: {
136        type: "lite",
137    },
138    srcs: [
139        "proto/**/*.proto",
140    ],
141    sdk_version: "system_server_current",
142    min_sdk_version: "31",
143    apex_available: [
144        "com.android.art",
145        "com.android.art.debug",
146    ],
147}
148
149java_library {
150    name: "art-statslog-art-java",
151    srcs: [
152        ":art-statslog-art-java-gen",
153    ],
154    libs: [
155        "framework-statsd.stubs.module_lib",
156    ],
157    sdk_version: "system_server_current",
158    min_sdk_version: "31",
159    apex_available: [
160        "com.android.art",
161        "com.android.art.debug",
162    ],
163}
164
165genrule {
166    name: "art-statslog-art-java-gen",
167    tools: ["stats-log-api-gen"],
168    cmd: "$(location stats-log-api-gen) --java $(out) --module art --javaPackage com.android.server.art --javaClass ArtStatsLog",
169    out: ["java/com/android/server/art/ArtStatsLog.java"],
170}
171
172art_cc_defaults {
173    name: "art_libartservice_tests_defaults",
174    defaults: ["libartservice_defaults"],
175    srcs: [
176        "native/service_test.cc",
177    ],
178}
179
180// Version of ART gtest `art_libartservice_tests` bundled with the ART APEX on target.
181// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
182art_cc_test {
183    name: "art_libartservice_tests",
184    defaults: [
185        "art_gtest_defaults",
186        "art_libartservice_tests_defaults",
187    ],
188}
189
190// Standalone version of ART gtest `art_libartservice_tests`, not bundled with the ART APEX on
191// target.
192art_cc_test {
193    name: "art_standalone_libartservice_tests",
194    defaults: [
195        "art_standalone_gtest_defaults",
196        "art_libartservice_tests_defaults",
197    ],
198}
199
200android_test {
201    name: "ArtServiceTests",
202
203    // Include all test java files.
204    srcs: [
205        "javatests/**/*.java",
206    ],
207
208    static_libs: [
209        "androidx.test.ext.junit",
210        "androidx.test.ext.truth",
211        "androidx.test.runner",
212        "artd-aidl-java",
213        "framework-annotations-lib",
214        // We need ExtendedMockito to mock static methods.
215        "mockito-target-extended-minus-junit4",
216        "modules-utils-package-state",
217        "service-art-pre-jarjar",
218        // Statically link against system server to allow us to mock system
219        // server APIs. This won't work on master-art, but it's fine because we
220        // don't run this test on master-art.
221        "services.core",
222    ],
223
224    jni_libs: [
225        // The two libraries below are required by ExtendedMockito.
226        "libdexmakerjvmtiagent",
227        "libstaticjvmtiagent",
228    ],
229    compile_multilib: "both",
230
231    // TODO: This module should move to sdk_version: "system_server_current" when possible,
232    //   as this will restrict the APIs available to just that expected system API. For now,
233    //   a compileOnly / runtimeOnly split for dependencies doesn't exist in the build system
234    //   and so it's not possible to enforce.
235    min_sdk_version: "31",
236
237    test_suites: ["general-tests"],
238    test_config: "ArtServiceTests.xml",
239}
240