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