Anton Hansson | 24c88f4 | 2019-12-13 16:17:27 +0000 | [diff] [blame] | 1 | // Copyright (C) 2019 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 | |
Anton Hansson | c7aa3f1 | 2020-12-15 18:28:20 +0000 | [diff] [blame] | 15 | package { |
| 16 | default_visibility: [":__subpackages__"], |
| 17 | } |
| 18 | |
Anton Hansson | 24c88f4 | 2019-12-13 16:17:27 +0000 | [diff] [blame] | 19 | mainline_stubs_args = |
| 20 | "--error UnhiddenSystemApi " + |
| 21 | "--hide BroadcastBehavior " + |
Alexander Dorokhine | c38a05e | 2020-12-04 12:17:30 -0800 | [diff] [blame] | 22 | "--hide CallbackInterface " + |
Anton Hansson | 24c88f4 | 2019-12-13 16:17:27 +0000 | [diff] [blame] | 23 | "--hide DeprecationMismatch " + |
| 24 | "--hide HiddenSuperclass " + |
| 25 | "--hide HiddenTypedefConstant " + |
| 26 | "--hide HiddenTypeParameter " + |
| 27 | "--hide MissingPermission " + |
| 28 | "--hide RequiresPermission " + |
| 29 | "--hide SdkConstant " + |
| 30 | "--hide Todo " + |
| 31 | "--hide Typo " + |
| 32 | "--hide UnavailableSymbol " |
| 33 | |
Anton Hansson | f79b08b | 2020-03-24 15:21:01 +0000 | [diff] [blame] | 34 | // TODO: modularize this so not every module has the same whitelist |
| 35 | framework_packages_to_document = [ |
| 36 | "android", |
| 37 | "dalvik", |
| 38 | "java", |
| 39 | "javax", |
| 40 | "junit", |
| 41 | "org.apache.http", |
| 42 | "org.json", |
| 43 | "org.w3c.dom", |
| 44 | "org.xml.sax", |
| 45 | "org.xmlpull", |
| 46 | ] |
| 47 | |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 48 | // TODO: remove the hiding when server classes are cleaned up. |
| 49 | mainline_framework_stubs_args = |
| 50 | mainline_stubs_args + |
| 51 | "--hide-package com.android.server " |
Anton Hansson | 5036ab6 | 2019-12-17 10:03:52 +0000 | [diff] [blame] | 52 | |
Anton Hansson | a12addc | 2020-02-03 14:44:47 +0000 | [diff] [blame] | 53 | priv_apps = " " + |
| 54 | "--show-annotation android.annotation.SystemApi\\(" + |
Jiyong Park | b4f8a85 | 2020-02-25 17:12:30 +0900 | [diff] [blame] | 55 | "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + |
Anton Hansson | a12addc | 2020-02-03 14:44:47 +0000 | [diff] [blame] | 56 | "\\) " |
| 57 | |
| 58 | module_libs = " " + |
| 59 | " --show-annotation android.annotation.SystemApi\\(" + |
Jiyong Park | b4f8a85 | 2020-02-25 17:12:30 +0900 | [diff] [blame] | 60 | "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + |
Makoto Onuki | a13287f | 2020-07-10 12:05:21 -0700 | [diff] [blame] | 61 | "\\)" + |
| 62 | " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" + |
| 63 | "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + |
Anton Hansson | a12addc | 2020-02-03 14:44:47 +0000 | [diff] [blame] | 64 | "\\) " |
| 65 | |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 66 | mainline_service_stubs_args = |
| 67 | mainline_stubs_args + |
| 68 | "--show-annotation android.annotation.SystemApi\\(" + |
| 69 | "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" + |
| 70 | "\\) " + |
| 71 | "--hide-annotation android.annotation.Hide " + |
| 72 | "--hide InternalClasses " // com.android.* classes are okay in this interface |
| 73 | |
Paul Duffin | bace9a1 | 2020-06-02 17:48:57 +0100 | [diff] [blame] | 74 | // Defaults common to all mainline module java_sdk_library instances. |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 75 | java_defaults { |
Paul Duffin | bace9a1 | 2020-06-02 17:48:57 +0100 | [diff] [blame] | 76 | name: "framework-module-common-defaults", |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 77 | |
| 78 | // Additional annotations used for compiling both the implementation and the |
| 79 | // stubs libraries. |
| 80 | libs: ["framework-annotations-lib"], |
| 81 | |
Paul Duffin | 4147550 | 2020-05-22 17:12:12 +0100 | [diff] [blame] | 82 | // Framework modules are not generally shared libraries, i.e. they are not |
| 83 | // intended, and must not be allowed, to be used in a <uses-library> manifest |
| 84 | // entry. |
| 85 | shared_library: false, |
| 86 | |
Paul Duffin | 1a0ba1e | 2020-05-29 09:50:20 +0100 | [diff] [blame] | 87 | // Prevent dependencies that do not specify an sdk_version from accessing the |
| 88 | // implementation library by default and force them to use stubs instead. |
| 89 | default_to_stubs: true, |
| 90 | |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 91 | // Enable api lint. This will eventually become the default for java_sdk_library |
| 92 | // but it cannot yet be turned on because some usages have not been cleaned up. |
| 93 | // TODO(b/156126315) - Remove when no longer needed. |
| 94 | api_lint: { |
| 95 | enabled: true, |
| 96 | }, |
| 97 | |
| 98 | // The API scope specific properties. |
| 99 | public: { |
| 100 | enabled: true, |
| 101 | sdk_version: "module_current", |
| 102 | }, |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 103 | |
Paul Duffin | 56195fb | 2020-05-17 13:00:36 +0100 | [diff] [blame] | 104 | // Configure framework module specific metalava options. |
| 105 | droiddoc_options: [mainline_stubs_args], |
| 106 | |
Anton Hansson | 01ff6b2 | 2020-05-27 11:26:16 +0100 | [diff] [blame] | 107 | annotations_enabled: true, |
| 108 | |
Anton Hansson | 70882b5 | 2020-08-18 12:52:51 +0100 | [diff] [blame] | 109 | // Allow access to the stubs from anywhere |
| 110 | visibility: ["//visibility:public"], |
| 111 | stubs_library_visibility: ["//visibility:public"], |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 112 | |
Anton Hansson | 70882b5 | 2020-08-18 12:52:51 +0100 | [diff] [blame] | 113 | // Hide impl library and stub sources |
Anton Hansson | 7a9bc4e | 2020-08-18 12:52:44 +0100 | [diff] [blame] | 114 | impl_library_visibility: [ |
Liz Kammer | 09e4eb1 | 2020-10-15 10:28:13 -0700 | [diff] [blame] | 115 | ":__pkg__", |
Anton Hansson | 7a9bc4e | 2020-08-18 12:52:44 +0100 | [diff] [blame] | 116 | "//frameworks/base", // For framework-all |
| 117 | ], |
Anton Hansson | 70882b5 | 2020-08-18 12:52:51 +0100 | [diff] [blame] | 118 | stubs_source_visibility: ["//visibility:private"], |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 119 | |
Anton Hansson | 7b59297 | 2020-11-02 18:57:12 +0000 | [diff] [blame] | 120 | defaults_visibility: ["//visibility:private"], |
| 121 | |
Paul Duffin | bee7404 | 2020-05-13 10:17:56 +0100 | [diff] [blame] | 122 | // Collates API usages from each module for further analysis. |
| 123 | plugins: ["java_api_finder"], |
| 124 | |
| 125 | // Mainline modules should only rely on 'module_lib' APIs provided by other modules |
| 126 | // and the non updatable parts of the platform. |
| 127 | sdk_version: "module_current", |
| 128 | } |
| 129 | |
Paul Duffin | bace9a1 | 2020-06-02 17:48:57 +0100 | [diff] [blame] | 130 | // Defaults for mainline module provided java_sdk_library instances. |
| 131 | java_defaults { |
| 132 | name: "framework-module-defaults", |
| 133 | defaults: ["framework-module-common-defaults"], |
| 134 | |
| 135 | system: { |
| 136 | enabled: true, |
| 137 | sdk_version: "module_current", |
| 138 | }, |
| 139 | module_lib: { |
| 140 | enabled: true, |
| 141 | sdk_version: "module_current", |
| 142 | }, |
Anton Hansson | c7aa3f1 | 2020-12-15 18:28:20 +0000 | [diff] [blame] | 143 | defaults_visibility: [ |
| 144 | ":__subpackages__", |
| 145 | "//frameworks/base/libs/hwui", |
| 146 | "//frameworks/base/wifi", |
| 147 | "//packages/modules:__subpackages__", |
| 148 | "//packages/providers/MediaProvider:__subpackages__", |
| 149 | ], |
Paul Duffin | bace9a1 | 2020-06-02 17:48:57 +0100 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | // Defaults for mainline module system server provided java_sdk_library instances. |
| 153 | java_defaults { |
| 154 | name: "framework-system-server-module-defaults", |
| 155 | defaults: ["framework-module-common-defaults"], |
| 156 | |
| 157 | system_server: { |
| 158 | enabled: true, |
| 159 | sdk_version: "module_current", |
| 160 | }, |
Anton Hansson | c7aa3f1 | 2020-12-15 18:28:20 +0000 | [diff] [blame] | 161 | defaults_visibility: [ |
| 162 | ":__subpackages__", |
| 163 | "//packages/modules:__subpackages__", |
| 164 | ], |
Paul Duffin | bace9a1 | 2020-06-02 17:48:57 +0100 | [diff] [blame] | 165 | } |
| 166 | |
Anton Hansson | 24c88f4 | 2019-12-13 16:17:27 +0000 | [diff] [blame] | 167 | stubs_defaults { |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 168 | name: "service-module-stubs-srcs-defaults", |
| 169 | args: mainline_service_stubs_args, |
| 170 | installable: false, |
Anton Hansson | 6e9bd96 | 2020-05-20 11:51:22 +0100 | [diff] [blame] | 171 | annotations_enabled: true, |
| 172 | merge_annotations_dirs: [ |
| 173 | "metalava-manual", |
| 174 | ], |
Anton Hansson | 442fcf4 | 2020-03-27 15:09:26 +0000 | [diff] [blame] | 175 | filter_packages: ["com.android."], |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 176 | check_api: { |
| 177 | current: { |
| 178 | api_file: "api/current.txt", |
| 179 | removed_api_file: "api/removed.txt", |
| 180 | }, |
Anton Hansson | 340954c | 2020-05-01 18:25:09 +0100 | [diff] [blame] | 181 | api_lint: { |
| 182 | enabled: true, |
| 183 | }, |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 184 | }, |
Anton Hansson | a92a23b | 2020-03-23 17:04:23 +0000 | [diff] [blame] | 185 | dist: { |
| 186 | targets: ["sdk", "win_sdk"], |
| 187 | dir: "apistubs/android/system-server/api", |
| 188 | }, |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | // Empty for now, but a convenient place to add rules for all |
| 192 | // module java_library system_server stub libs. |
| 193 | java_defaults { |
| 194 | name: "service-module-stubs-defaults", |
Anton Hansson | 5259a14 | 2020-03-25 13:30:03 +0000 | [diff] [blame] | 195 | dist: { |
| 196 | targets: ["sdk", "win_sdk"], |
| 197 | dir: "apistubs/android/system-server", |
| 198 | }, |
Anton Hansson | 180ec39 | 2020-03-23 13:30:01 +0000 | [diff] [blame] | 199 | } |