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 "art-statslog-art-java", 106 "artd-aidl-java", 107 "dexopt_chroot_setup-aidl-java", 108 "modules-utils-build", 109 "modules-utils-package-state", 110 "modules-utils-shell-command-handler", 111 "service-art-proto-java", 112 ], 113 plugins: [ 114 "auto_value_plugin", 115 ], 116} 117 118// Used by tests to allow tests to mock the right classes. 119java_library { 120 name: "service-art-pre-jarjar", 121 defaults: ["service-art-defaults"], 122 installable: false, 123 visibility: [ 124 "//visibility:override", 125 "//visibility:private", 126 ], 127} 128 129// Provides the API and implementation of the ART Service class that will be 130// loaded by the System Server. 131java_sdk_library { 132 // This target is named 'service-art' to conform to the naming conventions 133 // for JAR files in the System Server. 134 name: "service-art", 135 defaults: [ 136 "service-art-defaults", 137 "framework-system-server-module-optimize-defaults", 138 ], 139 permitted_packages: [ 140 "com.android.server.art", 141 ], 142 dex_preopt: { 143 profile: "art-profile", 144 }, 145 visibility: [ 146 "//art:__subpackages__", 147 "//frameworks/base/services/core", 148 ], 149 apex_available: [ 150 "com.android.art", 151 "com.android.art.debug", 152 ], 153 jarjar_rules: "jarjar-rules.txt", 154 optimize: { 155 proguard_flags_files: ["proguard.flags"], 156 }, 157 aconfig_declarations: [ 158 "art-aconfig-flags", 159 ], 160} 161 162java_library { 163 name: "service-art-proto-java", 164 proto: { 165 type: "lite", 166 }, 167 srcs: [ 168 "proto/**/*.proto", 169 ], 170 sdk_version: "system_server_current", 171 min_sdk_version: "31", 172 apex_available: [ 173 "com.android.art", 174 "com.android.art.debug", 175 ], 176} 177 178java_library { 179 name: "art-statslog-art-java", 180 srcs: [ 181 ":art-statslog-art-java-gen", 182 ], 183 libs: [ 184 "framework-statsd.stubs.module_lib", 185 ], 186 sdk_version: "system_server_current", 187 min_sdk_version: "31", 188 apex_available: [ 189 "com.android.art", 190 "com.android.art.debug", 191 ], 192} 193 194genrule { 195 name: "art-statslog-art-java-gen", 196 tools: ["stats-log-api-gen"], 197 cmd: "$(location stats-log-api-gen) --java $(out) --module art --javaPackage com.android.server.art --javaClass ArtStatsLog", 198 out: ["java/com/android/server/art/ArtStatsLog.java"], 199} 200 201art_cc_defaults { 202 name: "art_libartservice_tests_defaults", 203 defaults: ["libartservice_defaults"], 204 srcs: [ 205 "native/service_test.cc", 206 ], 207 static_libs: [ 208 "libgmock", 209 ], 210} 211 212// Version of ART gtest `art_libartservice_tests` for host. 213// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. 214art_cc_test { 215 name: "art_libartservice_tests", 216 device_supported: false, 217 defaults: [ 218 "art_gtest_defaults", 219 "art_libartservice_tests_defaults", 220 ], 221 shared_libs: [ 222 "libarttools", 223 "libbase", 224 ], 225} 226 227// Standalone version of ART gtest `art_libartservice_tests`, not bundled with the ART APEX on 228// target. 229art_cc_test { 230 name: "art_standalone_libartservice_tests", 231 defaults: [ 232 "art_standalone_gtest_defaults", 233 "art_libartservice_tests_defaults", 234 ], 235 static_libs: [ 236 "libarttools", 237 "libbase", 238 ], 239 test_config_template: ":art-gtests-target-standalone-non-multilib-template", 240} 241 242android_test { 243 name: "ArtServiceTests", 244 245 // Include all test java files. 246 srcs: [ 247 "javatests/**/*.java", 248 ], 249 250 libs: [ 251 "sdk_module-lib_current_framework-configinfrastructure", 252 ], 253 254 static_libs: [ 255 "androidx.test.ext.junit", 256 "androidx.test.ext.truth", 257 "androidx.test.runner", 258 "artd-aidl-java", 259 "framework-annotations-lib", 260 // We need ExtendedMockito to mock static methods. 261 "mockito-target-extended-minus-junit4", 262 "modules-utils-package-state", 263 "service-art-pre-jarjar", 264 // Statically link against system server to allow us to mock system 265 // server APIs. This won't work on master-art, but it's fine because we 266 // don't run this test on master-art. 267 "services.core", 268 ], 269 270 jni_libs: [ 271 "libartservice", 272 // The two libraries below are required by ExtendedMockito. 273 "libdexmakerjvmtiagent", 274 "libstaticjvmtiagent", 275 ], 276 compile_multilib: "first", 277 278 // TODO: This module should move to sdk_version: "system_server_current" when possible, 279 // as this will restrict the APIs available to just that expected system API. For now, 280 // a compileOnly / runtimeOnly split for dependencies doesn't exist in the build system 281 // and so it's not possible to enforce. 282 min_sdk_version: "31", 283 284 test_suites: ["general-tests"], 285 test_config: "ArtServiceTests.xml", 286} 287 288filegroup { 289 name: "libartservice_protos", 290 srcs: [ 291 "proto/**/*.proto", 292 ], 293 visibility: [ 294 "//cts/hostsidetests/compilation", 295 ], 296} 297