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