Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 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 | |
| 15 | package sdk |
| 16 | |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 17 | import ( |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 18 | "fmt" |
| 19 | "path/filepath" |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 20 | "testing" |
| 21 | |
| 22 | "android/soong/android" |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 23 | "android/soong/java" |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 24 | ) |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 25 | |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 26 | // fixtureAddPlatformBootclasspathForBootclasspathFragment adds a platform_bootclasspath module that |
| 27 | // references the bootclasspath fragment. |
| 28 | func fixtureAddPlatformBootclasspathForBootclasspathFragment(apex, fragment string) android.FixturePreparer { |
| 29 | return android.GroupFixturePreparers( |
| 30 | // Add a platform_bootclasspath module. |
| 31 | android.FixtureAddTextFile("frameworks/base/boot/Android.bp", fmt.Sprintf(` |
| 32 | platform_bootclasspath { |
| 33 | name: "platform-bootclasspath", |
| 34 | fragments: [ |
| 35 | { |
| 36 | apex: "%s", |
| 37 | module: "%s", |
| 38 | }, |
| 39 | ], |
| 40 | } |
| 41 | `, apex, fragment)), |
| 42 | android.FixtureAddFile("frameworks/base/config/boot-profile.txt", nil), |
| 43 | ) |
| 44 | } |
| 45 | |
| 46 | // fixtureAddPrebuiltApexForBootclasspathFragment adds a prebuilt_apex that exports the fragment. |
| 47 | func fixtureAddPrebuiltApexForBootclasspathFragment(apex, fragment string) android.FixturePreparer { |
| 48 | apexFile := fmt.Sprintf("%s.apex", apex) |
| 49 | dir := "prebuilts/apex" |
| 50 | return android.GroupFixturePreparers( |
| 51 | // A preparer to add a prebuilt apex to the test fixture. |
| 52 | android.FixtureAddTextFile(filepath.Join(dir, "Android.bp"), fmt.Sprintf(` |
| 53 | prebuilt_apex { |
| 54 | name: "%s", |
| 55 | src: "%s", |
| 56 | exported_bootclasspath_fragments: [ |
| 57 | "%s", |
| 58 | ], |
| 59 | } |
| 60 | `, apex, apexFile, fragment)), |
| 61 | android.FixtureAddFile(filepath.Join(dir, apexFile), nil), |
| 62 | ) |
| 63 | } |
| 64 | |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 65 | func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) { |
| 66 | result := android.GroupFixturePreparers( |
| 67 | prepareForSdkTestWithJava, |
Paul Duffin | 023dba0 | 2021-04-22 01:45:29 +0100 | [diff] [blame] | 68 | java.PrepareForTestWithJavaDefaultModules, |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 69 | prepareForSdkTestWithApex, |
| 70 | |
| 71 | // Some additional files needed for the art apex. |
| 72 | android.FixtureMergeMockFs(android.MockFS{ |
| 73 | "com.android.art.avbpubkey": nil, |
| 74 | "com.android.art.pem": nil, |
| 75 | "system/sepolicy/apex/com.android.art-file_contexts": nil, |
| 76 | }), |
Paul Duffin | 023dba0 | 2021-04-22 01:45:29 +0100 | [diff] [blame] | 77 | |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 78 | // Add a platform_bootclasspath that depends on the fragment. |
| 79 | fixtureAddPlatformBootclasspathForBootclasspathFragment("com.android.art", "mybootclasspathfragment"), |
Paul Duffin | 023dba0 | 2021-04-22 01:45:29 +0100 | [diff] [blame] | 80 | |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 81 | java.FixtureConfigureBootJars("com.android.art:mybootlib"), |
| 82 | android.FixtureWithRootAndroidBp(` |
| 83 | sdk { |
| 84 | name: "mysdk", |
| 85 | bootclasspath_fragments: ["mybootclasspathfragment"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | apex { |
| 89 | name: "com.android.art", |
| 90 | key: "com.android.art.key", |
| 91 | bootclasspath_fragments: [ |
| 92 | "mybootclasspathfragment", |
| 93 | ], |
| 94 | updatable: false, |
| 95 | } |
| 96 | |
| 97 | bootclasspath_fragment { |
| 98 | name: "mybootclasspathfragment", |
| 99 | image_name: "art", |
Paul Duffin | f23bc47 | 2021-04-27 12:42:20 +0100 | [diff] [blame] | 100 | contents: ["mybootlib"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 101 | apex_available: ["com.android.art"], |
| 102 | } |
| 103 | |
| 104 | apex_key { |
| 105 | name: "com.android.art.key", |
| 106 | public_key: "com.android.art.avbpubkey", |
| 107 | private_key: "com.android.art.pem", |
| 108 | } |
| 109 | |
| 110 | java_library { |
| 111 | name: "mybootlib", |
| 112 | srcs: ["Test.java"], |
| 113 | system_modules: "none", |
| 114 | sdk_version: "none", |
| 115 | compile_dex: true, |
| 116 | apex_available: ["com.android.art"], |
| 117 | } |
| 118 | `), |
| 119 | ).RunTest(t) |
| 120 | |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 121 | // A preparer to update the test fixture used when processing an unpackage snapshot. |
| 122 | preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("com.android.art", "mybootclasspathfragment") |
Paul Duffin | 023dba0 | 2021-04-22 01:45:29 +0100 | [diff] [blame] | 123 | |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 124 | CheckSnapshot(t, result, "mysdk", "", |
| 125 | checkUnversionedAndroidBpContents(` |
| 126 | // This is auto-generated. DO NOT EDIT. |
| 127 | |
| 128 | prebuilt_bootclasspath_fragment { |
| 129 | name: "mybootclasspathfragment", |
| 130 | prefer: false, |
| 131 | visibility: ["//visibility:public"], |
| 132 | apex_available: ["com.android.art"], |
| 133 | image_name: "art", |
Paul Duffin | 2dc665b | 2021-04-23 16:58:51 +0100 | [diff] [blame] | 134 | contents: ["mybootlib"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | java_import { |
| 138 | name: "mybootlib", |
| 139 | prefer: false, |
| 140 | visibility: ["//visibility:public"], |
| 141 | apex_available: ["com.android.art"], |
| 142 | jars: ["java/mybootlib.jar"], |
| 143 | } |
| 144 | `), |
| 145 | checkVersionedAndroidBpContents(` |
| 146 | // This is auto-generated. DO NOT EDIT. |
| 147 | |
| 148 | prebuilt_bootclasspath_fragment { |
| 149 | name: "mysdk_mybootclasspathfragment@current", |
| 150 | sdk_member_name: "mybootclasspathfragment", |
| 151 | visibility: ["//visibility:public"], |
| 152 | apex_available: ["com.android.art"], |
| 153 | image_name: "art", |
Paul Duffin | 2dc665b | 2021-04-23 16:58:51 +0100 | [diff] [blame] | 154 | contents: ["mysdk_mybootlib@current"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | java_import { |
| 158 | name: "mysdk_mybootlib@current", |
| 159 | sdk_member_name: "mybootlib", |
| 160 | visibility: ["//visibility:public"], |
| 161 | apex_available: ["com.android.art"], |
| 162 | jars: ["java/mybootlib.jar"], |
| 163 | } |
| 164 | |
| 165 | sdk_snapshot { |
| 166 | name: "mysdk@current", |
| 167 | visibility: ["//visibility:public"], |
| 168 | bootclasspath_fragments: ["mysdk_mybootclasspathfragment@current"], |
| 169 | java_boot_libs: ["mysdk_mybootlib@current"], |
| 170 | } |
| 171 | `), |
| 172 | checkAllCopyRules(` |
| 173 | .intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar |
| 174 | `), |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 175 | snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot), |
| 176 | snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot), |
| 177 | snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot), |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 178 | ) |
| 179 | } |
| 180 | |
| 181 | func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) { |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 182 | result := android.GroupFixturePreparers( |
| 183 | prepareForSdkTestWithJava, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 184 | java.PrepareForTestWithJavaDefaultModules, |
| 185 | java.PrepareForTestWithJavaSdkLibraryFiles, |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 186 | java.FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"), |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 187 | java.FixtureConfigureUpdatableBootJars("myapex:mybootlib", "myapex:myothersdklibrary"), |
| 188 | prepareForSdkTestWithApex, |
| 189 | |
| 190 | // Add a platform_bootclasspath that depends on the fragment. |
| 191 | fixtureAddPlatformBootclasspathForBootclasspathFragment("myapex", "mybootclasspathfragment"), |
| 192 | |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 193 | android.FixtureWithRootAndroidBp(` |
| 194 | sdk { |
| 195 | name: "mysdk", |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 196 | bootclasspath_fragments: ["mybootclasspathfragment"], |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 197 | java_sdk_libs: [ |
| 198 | // This is not strictly needed as it should be automatically added to the sdk_snapshot as |
| 199 | // a java_sdk_libs module because it is used in the mybootclasspathfragment's |
| 200 | // api.stub_libs property. However, it is specified here to ensure that duplicates are |
| 201 | // correctly deduped. |
| 202 | "mysdklibrary", |
| 203 | ], |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 204 | } |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 205 | |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 206 | apex { |
| 207 | name: "myapex", |
| 208 | key: "myapex.key", |
| 209 | min_sdk_version: "2", |
| 210 | bootclasspath_fragments: ["mybootclasspathfragment"], |
| 211 | } |
| 212 | |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 213 | bootclasspath_fragment { |
| 214 | name: "mybootclasspathfragment", |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 215 | apex_available: ["myapex"], |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 216 | contents: [ |
| 217 | // This should be automatically added to the sdk_snapshot as a java_boot_libs module. |
| 218 | "mybootlib", |
| 219 | // This should be automatically added to the sdk_snapshot as a java_sdk_libs module. |
| 220 | "myothersdklibrary", |
| 221 | ], |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 222 | api: { |
| 223 | stub_libs: ["mysdklibrary"], |
| 224 | }, |
| 225 | core_platform_api: { |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 226 | // This should be automatically added to the sdk_snapshot as a java_sdk_libs module. |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 227 | stub_libs: ["mycoreplatform"], |
| 228 | }, |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | java_library { |
| 232 | name: "mybootlib", |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 233 | apex_available: ["myapex"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 234 | srcs: ["Test.java"], |
| 235 | system_modules: "none", |
| 236 | sdk_version: "none", |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 237 | min_sdk_version: "2", |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 238 | compile_dex: true, |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 239 | permitted_packages: ["mybootlib"], |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 240 | } |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 241 | |
| 242 | java_sdk_library { |
| 243 | name: "mysdklibrary", |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 244 | apex_available: ["myapex"], |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 245 | srcs: ["Test.java"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 246 | shared_library: false, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 247 | public: {enabled: true}, |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 248 | min_sdk_version: "2", |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | java_sdk_library { |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 252 | name: "myothersdklibrary", |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 253 | apex_available: ["myapex"], |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 254 | srcs: ["Test.java"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 255 | shared_library: false, |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 256 | public: {enabled: true}, |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 257 | min_sdk_version: "2", |
| 258 | permitted_packages: ["myothersdklibrary"], |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | java_sdk_library { |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 262 | name: "mycoreplatform", |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 263 | apex_available: ["myapex"], |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 264 | srcs: ["Test.java"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 265 | shared_library: false, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 266 | public: {enabled: true}, |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 267 | min_sdk_version: "2", |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 268 | } |
Paul Duffin | 4a1d451 | 2021-03-18 10:12:26 +0000 | [diff] [blame] | 269 | `), |
| 270 | ).RunTest(t) |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 271 | |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 272 | // A preparer to update the test fixture used when processing an unpackage snapshot. |
| 273 | preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("myapex", "mybootclasspathfragment") |
| 274 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 275 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 276 | checkUnversionedAndroidBpContents(` |
| 277 | // This is auto-generated. DO NOT EDIT. |
| 278 | |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 279 | prebuilt_bootclasspath_fragment { |
| 280 | name: "mybootclasspathfragment", |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 281 | prefer: false, |
| 282 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 283 | apex_available: ["myapex"], |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 284 | contents: [ |
| 285 | "mybootlib", |
| 286 | "myothersdklibrary", |
| 287 | ], |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 288 | api: { |
| 289 | stub_libs: ["mysdklibrary"], |
| 290 | }, |
| 291 | core_platform_api: { |
| 292 | stub_libs: ["mycoreplatform"], |
| 293 | }, |
Paul Duffin | 2fef136 | 2021-04-15 13:32:00 +0100 | [diff] [blame] | 294 | hidden_api: { |
| 295 | stub_flags: "hiddenapi/stub-flags.csv", |
| 296 | annotation_flags: "hiddenapi/annotation-flags.csv", |
| 297 | metadata: "hiddenapi/metadata.csv", |
| 298 | index: "hiddenapi/index.csv", |
| 299 | all_flags: "hiddenapi/all-flags.csv", |
| 300 | }, |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | java_import { |
| 304 | name: "mybootlib", |
| 305 | prefer: false, |
| 306 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 307 | apex_available: ["myapex"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 308 | jars: ["java/mybootlib.jar"], |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 309 | } |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 310 | |
| 311 | java_sdk_library_import { |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 312 | name: "myothersdklibrary", |
| 313 | prefer: false, |
| 314 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 315 | apex_available: ["myapex"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 316 | shared_library: false, |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 317 | public: { |
| 318 | jars: ["sdk_library/public/myothersdklibrary-stubs.jar"], |
| 319 | stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"], |
| 320 | current_api: "sdk_library/public/myothersdklibrary.txt", |
| 321 | removed_api: "sdk_library/public/myothersdklibrary-removed.txt", |
| 322 | sdk_version: "current", |
| 323 | }, |
| 324 | } |
| 325 | |
| 326 | java_sdk_library_import { |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 327 | name: "mysdklibrary", |
| 328 | prefer: false, |
| 329 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 330 | apex_available: ["myapex"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 331 | shared_library: false, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 332 | public: { |
| 333 | jars: ["sdk_library/public/mysdklibrary-stubs.jar"], |
| 334 | stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"], |
| 335 | current_api: "sdk_library/public/mysdklibrary.txt", |
| 336 | removed_api: "sdk_library/public/mysdklibrary-removed.txt", |
| 337 | sdk_version: "current", |
| 338 | }, |
| 339 | } |
| 340 | |
| 341 | java_sdk_library_import { |
| 342 | name: "mycoreplatform", |
| 343 | prefer: false, |
| 344 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 345 | apex_available: ["myapex"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 346 | shared_library: false, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 347 | public: { |
| 348 | jars: ["sdk_library/public/mycoreplatform-stubs.jar"], |
| 349 | stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"], |
| 350 | current_api: "sdk_library/public/mycoreplatform.txt", |
| 351 | removed_api: "sdk_library/public/mycoreplatform-removed.txt", |
| 352 | sdk_version: "current", |
| 353 | }, |
| 354 | } |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 355 | `), |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 356 | checkVersionedAndroidBpContents(` |
| 357 | // This is auto-generated. DO NOT EDIT. |
| 358 | |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 359 | prebuilt_bootclasspath_fragment { |
| 360 | name: "mysdk_mybootclasspathfragment@current", |
| 361 | sdk_member_name: "mybootclasspathfragment", |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 362 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 363 | apex_available: ["myapex"], |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 364 | contents: [ |
| 365 | "mysdk_mybootlib@current", |
| 366 | "mysdk_myothersdklibrary@current", |
| 367 | ], |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 368 | api: { |
| 369 | stub_libs: ["mysdk_mysdklibrary@current"], |
| 370 | }, |
| 371 | core_platform_api: { |
| 372 | stub_libs: ["mysdk_mycoreplatform@current"], |
| 373 | }, |
Paul Duffin | 2fef136 | 2021-04-15 13:32:00 +0100 | [diff] [blame] | 374 | hidden_api: { |
| 375 | stub_flags: "hiddenapi/stub-flags.csv", |
| 376 | annotation_flags: "hiddenapi/annotation-flags.csv", |
| 377 | metadata: "hiddenapi/metadata.csv", |
| 378 | index: "hiddenapi/index.csv", |
| 379 | all_flags: "hiddenapi/all-flags.csv", |
| 380 | }, |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | java_import { |
| 384 | name: "mysdk_mybootlib@current", |
| 385 | sdk_member_name: "mybootlib", |
| 386 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 387 | apex_available: ["myapex"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 388 | jars: ["java/mybootlib.jar"], |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 389 | } |
| 390 | |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 391 | java_sdk_library_import { |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 392 | name: "mysdk_myothersdklibrary@current", |
| 393 | sdk_member_name: "myothersdklibrary", |
| 394 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 395 | apex_available: ["myapex"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 396 | shared_library: false, |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 397 | public: { |
| 398 | jars: ["sdk_library/public/myothersdklibrary-stubs.jar"], |
| 399 | stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"], |
| 400 | current_api: "sdk_library/public/myothersdklibrary.txt", |
| 401 | removed_api: "sdk_library/public/myothersdklibrary-removed.txt", |
| 402 | sdk_version: "current", |
| 403 | }, |
| 404 | } |
| 405 | |
| 406 | java_sdk_library_import { |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 407 | name: "mysdk_mysdklibrary@current", |
| 408 | sdk_member_name: "mysdklibrary", |
| 409 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 410 | apex_available: ["myapex"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 411 | shared_library: false, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 412 | public: { |
| 413 | jars: ["sdk_library/public/mysdklibrary-stubs.jar"], |
| 414 | stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"], |
| 415 | current_api: "sdk_library/public/mysdklibrary.txt", |
| 416 | removed_api: "sdk_library/public/mysdklibrary-removed.txt", |
| 417 | sdk_version: "current", |
| 418 | }, |
| 419 | } |
| 420 | |
| 421 | java_sdk_library_import { |
| 422 | name: "mysdk_mycoreplatform@current", |
| 423 | sdk_member_name: "mycoreplatform", |
| 424 | visibility: ["//visibility:public"], |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 425 | apex_available: ["myapex"], |
Paul Duffin | f4600f6 | 2021-05-13 22:34:45 +0100 | [diff] [blame] | 426 | shared_library: false, |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 427 | public: { |
| 428 | jars: ["sdk_library/public/mycoreplatform-stubs.jar"], |
| 429 | stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"], |
| 430 | current_api: "sdk_library/public/mycoreplatform.txt", |
| 431 | removed_api: "sdk_library/public/mycoreplatform-removed.txt", |
| 432 | sdk_version: "current", |
| 433 | }, |
| 434 | } |
| 435 | |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 436 | sdk_snapshot { |
| 437 | name: "mysdk@current", |
| 438 | visibility: ["//visibility:public"], |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 439 | bootclasspath_fragments: ["mysdk_mybootclasspathfragment@current"], |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 440 | java_boot_libs: ["mysdk_mybootlib@current"], |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 441 | java_sdk_libs: [ |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 442 | "mysdk_myothersdklibrary@current", |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 443 | "mysdk_mysdklibrary@current", |
| 444 | "mysdk_mycoreplatform@current", |
| 445 | ], |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 446 | } |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 447 | `), |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 448 | checkAllCopyRules(` |
Paul Duffin | 2fef136 | 2021-04-15 13:32:00 +0100 | [diff] [blame] | 449 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv |
| 450 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv |
| 451 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv |
| 452 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv |
| 453 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv |
Paul Duffin | a57835e | 2021-04-19 13:23:06 +0100 | [diff] [blame] | 454 | .intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar |
Paul Duffin | a10bd3c | 2021-05-12 13:46:54 +0100 | [diff] [blame] | 455 | .intermediates/myothersdklibrary.stubs/android_common/javac/myothersdklibrary.stubs.jar -> sdk_library/public/myothersdklibrary-stubs.jar |
| 456 | .intermediates/myothersdklibrary.stubs.source/android_common/metalava/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt |
| 457 | .intermediates/myothersdklibrary.stubs.source/android_common/metalava/myothersdklibrary.stubs.source_removed.txt -> sdk_library/public/myothersdklibrary-removed.txt |
Paul Duffin | 895c714 | 2021-04-25 13:40:15 +0100 | [diff] [blame] | 458 | .intermediates/mysdklibrary.stubs/android_common/javac/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar |
| 459 | .intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt |
| 460 | .intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt |
| 461 | .intermediates/mycoreplatform.stubs/android_common/javac/mycoreplatform.stubs.jar -> sdk_library/public/mycoreplatform-stubs.jar |
| 462 | .intermediates/mycoreplatform.stubs.source/android_common/metalava/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt |
| 463 | .intermediates/mycoreplatform.stubs.source/android_common/metalava/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 464 | `), |
| 465 | snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot), |
| 466 | snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot), |
| 467 | snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot), |
| 468 | ) |
Paul Duffin | f7f65da | 2021-03-10 15:00:46 +0000 | [diff] [blame] | 469 | } |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 470 | |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 471 | // Test that bootclasspath_fragment works with sdk. |
| 472 | func TestBasicSdkWithBootclasspathFragment(t *testing.T) { |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 473 | android.GroupFixturePreparers( |
| 474 | prepareForSdkTestWithApex, |
| 475 | prepareForSdkTestWithJava, |
Paul Duffin | 8018e50 | 2021-05-21 19:28:09 +0100 | [diff] [blame] | 476 | android.FixtureAddFile("java/mybootlib.jar", nil), |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 477 | android.FixtureWithRootAndroidBp(` |
| 478 | sdk { |
| 479 | name: "mysdk", |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 480 | bootclasspath_fragments: ["mybootclasspathfragment"], |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 481 | } |
| 482 | |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 483 | bootclasspath_fragment { |
| 484 | name: "mybootclasspathfragment", |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 485 | image_name: "art", |
Paul Duffin | 8018e50 | 2021-05-21 19:28:09 +0100 | [diff] [blame] | 486 | contents: ["mybootlib"], |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 487 | apex_available: ["myapex"], |
| 488 | } |
| 489 | |
Paul Duffin | 8018e50 | 2021-05-21 19:28:09 +0100 | [diff] [blame] | 490 | java_library { |
| 491 | name: "mybootlib", |
| 492 | apex_available: ["myapex"], |
| 493 | srcs: ["Test.java"], |
| 494 | system_modules: "none", |
| 495 | sdk_version: "none", |
| 496 | min_sdk_version: "1", |
| 497 | compile_dex: true, |
| 498 | } |
| 499 | |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 500 | sdk_snapshot { |
| 501 | name: "mysdk@1", |
Paul Duffin | 8018e50 | 2021-05-21 19:28:09 +0100 | [diff] [blame] | 502 | bootclasspath_fragments: ["mysdk_mybootclasspathfragment@1"], |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 503 | } |
| 504 | |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 505 | prebuilt_bootclasspath_fragment { |
Paul Duffin | 8018e50 | 2021-05-21 19:28:09 +0100 | [diff] [blame] | 506 | name: "mysdk_mybootclasspathfragment@1", |
Paul Duffin | 0b28a8d | 2021-04-21 23:38:34 +0100 | [diff] [blame] | 507 | sdk_member_name: "mybootclasspathfragment", |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 508 | prefer: false, |
| 509 | visibility: ["//visibility:public"], |
| 510 | apex_available: [ |
| 511 | "myapex", |
| 512 | ], |
| 513 | image_name: "art", |
Paul Duffin | 8018e50 | 2021-05-21 19:28:09 +0100 | [diff] [blame] | 514 | contents: ["mysdk_mybootlib@1"], |
| 515 | } |
| 516 | |
| 517 | java_import { |
| 518 | name: "mysdk_mybootlib@1", |
| 519 | sdk_member_name: "mybootlib", |
| 520 | visibility: ["//visibility:public"], |
| 521 | apex_available: ["com.android.art"], |
| 522 | jars: ["java/mybootlib.jar"], |
Paul Duffin | 04b4a19 | 2021-03-18 11:05:31 +0000 | [diff] [blame] | 523 | } |
| 524 | `), |
| 525 | ).RunTest(t) |
| 526 | } |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 527 | |
| 528 | func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) { |
| 529 | result := android.GroupFixturePreparers( |
| 530 | prepareForSdkTestWithJava, |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 531 | java.PrepareForTestWithJavaDefaultModules, |
| 532 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 533 | java.FixtureWithLastReleaseApis("mysdklibrary"), |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 534 | java.FixtureConfigureUpdatableBootJars("myapex:mybootlib"), |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 535 | prepareForSdkTestWithApex, |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 536 | |
| 537 | // Add a platform_bootclasspath that depends on the fragment. |
| 538 | fixtureAddPlatformBootclasspathForBootclasspathFragment("myapex", "mybootclasspathfragment"), |
| 539 | |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 540 | android.MockFS{ |
| 541 | "my-blocked.txt": nil, |
| 542 | "my-max-target-o-low-priority.txt": nil, |
| 543 | "my-max-target-p.txt": nil, |
| 544 | "my-max-target-q.txt": nil, |
| 545 | "my-max-target-r-low-priority.txt": nil, |
| 546 | "my-removed.txt": nil, |
| 547 | "my-unsupported-packages.txt": nil, |
| 548 | "my-unsupported.txt": nil, |
| 549 | }.AddToFixture(), |
| 550 | android.FixtureWithRootAndroidBp(` |
| 551 | sdk { |
| 552 | name: "mysdk", |
| 553 | bootclasspath_fragments: ["mybootclasspathfragment"], |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 554 | } |
| 555 | |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 556 | apex { |
| 557 | name: "myapex", |
| 558 | key: "myapex.key", |
| 559 | min_sdk_version: "1", |
| 560 | bootclasspath_fragments: ["mybootclasspathfragment"], |
| 561 | } |
| 562 | |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 563 | bootclasspath_fragment { |
| 564 | name: "mybootclasspathfragment", |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 565 | apex_available: ["myapex"], |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 566 | contents: ["mybootlib"], |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 567 | api: { |
| 568 | stub_libs: ["mysdklibrary"], |
| 569 | }, |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 570 | hidden_api: { |
| 571 | unsupported: [ |
| 572 | "my-unsupported.txt", |
| 573 | ], |
| 574 | removed: [ |
| 575 | "my-removed.txt", |
| 576 | ], |
| 577 | max_target_r_low_priority: [ |
| 578 | "my-max-target-r-low-priority.txt", |
| 579 | ], |
| 580 | max_target_q: [ |
| 581 | "my-max-target-q.txt", |
| 582 | ], |
| 583 | max_target_p: [ |
| 584 | "my-max-target-p.txt", |
| 585 | ], |
| 586 | max_target_o_low_priority: [ |
| 587 | "my-max-target-o-low-priority.txt", |
| 588 | ], |
| 589 | blocked: [ |
| 590 | "my-blocked.txt", |
| 591 | ], |
| 592 | unsupported_packages: [ |
| 593 | "my-unsupported-packages.txt", |
| 594 | ], |
| 595 | }, |
| 596 | } |
| 597 | |
| 598 | java_library { |
| 599 | name: "mybootlib", |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 600 | apex_available: ["myapex"], |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 601 | srcs: ["Test.java"], |
| 602 | system_modules: "none", |
| 603 | sdk_version: "none", |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 604 | min_sdk_version: "1", |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 605 | compile_dex: true, |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 606 | permitted_packages: ["mybootlib"], |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 607 | } |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 608 | |
| 609 | java_sdk_library { |
| 610 | name: "mysdklibrary", |
| 611 | srcs: ["Test.java"], |
| 612 | compile_dex: true, |
| 613 | public: {enabled: true}, |
| 614 | } |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 615 | `), |
| 616 | ).RunTest(t) |
| 617 | |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 618 | // A preparer to update the test fixture used when processing an unpackage snapshot. |
| 619 | preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("myapex", "mybootclasspathfragment") |
| 620 | |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 621 | CheckSnapshot(t, result, "mysdk", "", |
| 622 | checkUnversionedAndroidBpContents(` |
| 623 | // This is auto-generated. DO NOT EDIT. |
| 624 | |
| 625 | prebuilt_bootclasspath_fragment { |
| 626 | name: "mybootclasspathfragment", |
| 627 | prefer: false, |
| 628 | visibility: ["//visibility:public"], |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 629 | apex_available: ["myapex"], |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 630 | contents: ["mybootlib"], |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 631 | api: { |
| 632 | stub_libs: ["mysdklibrary"], |
| 633 | }, |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 634 | hidden_api: { |
| 635 | unsupported: ["hiddenapi/my-unsupported.txt"], |
| 636 | removed: ["hiddenapi/my-removed.txt"], |
| 637 | max_target_r_low_priority: ["hiddenapi/my-max-target-r-low-priority.txt"], |
| 638 | max_target_q: ["hiddenapi/my-max-target-q.txt"], |
| 639 | max_target_p: ["hiddenapi/my-max-target-p.txt"], |
| 640 | max_target_o_low_priority: ["hiddenapi/my-max-target-o-low-priority.txt"], |
| 641 | blocked: ["hiddenapi/my-blocked.txt"], |
| 642 | unsupported_packages: ["hiddenapi/my-unsupported-packages.txt"], |
Paul Duffin | 2fef136 | 2021-04-15 13:32:00 +0100 | [diff] [blame] | 643 | stub_flags: "hiddenapi/stub-flags.csv", |
| 644 | annotation_flags: "hiddenapi/annotation-flags.csv", |
| 645 | metadata: "hiddenapi/metadata.csv", |
| 646 | index: "hiddenapi/index.csv", |
| 647 | all_flags: "hiddenapi/all-flags.csv", |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 648 | }, |
| 649 | } |
| 650 | |
| 651 | java_import { |
| 652 | name: "mybootlib", |
| 653 | prefer: false, |
| 654 | visibility: ["//visibility:public"], |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 655 | apex_available: ["myapex"], |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 656 | jars: ["java/mybootlib.jar"], |
| 657 | } |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 658 | |
| 659 | java_sdk_library_import { |
| 660 | name: "mysdklibrary", |
| 661 | prefer: false, |
| 662 | visibility: ["//visibility:public"], |
| 663 | apex_available: ["//apex_available:platform"], |
| 664 | shared_library: true, |
| 665 | compile_dex: true, |
| 666 | public: { |
| 667 | jars: ["sdk_library/public/mysdklibrary-stubs.jar"], |
| 668 | stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"], |
| 669 | current_api: "sdk_library/public/mysdklibrary.txt", |
| 670 | removed_api: "sdk_library/public/mysdklibrary-removed.txt", |
| 671 | sdk_version: "current", |
| 672 | }, |
| 673 | } |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 674 | `), |
| 675 | checkAllCopyRules(` |
| 676 | my-unsupported.txt -> hiddenapi/my-unsupported.txt |
| 677 | my-removed.txt -> hiddenapi/my-removed.txt |
| 678 | my-max-target-r-low-priority.txt -> hiddenapi/my-max-target-r-low-priority.txt |
| 679 | my-max-target-q.txt -> hiddenapi/my-max-target-q.txt |
| 680 | my-max-target-p.txt -> hiddenapi/my-max-target-p.txt |
| 681 | my-max-target-o-low-priority.txt -> hiddenapi/my-max-target-o-low-priority.txt |
| 682 | my-blocked.txt -> hiddenapi/my-blocked.txt |
| 683 | my-unsupported-packages.txt -> hiddenapi/my-unsupported-packages.txt |
Paul Duffin | 2fef136 | 2021-04-15 13:32:00 +0100 | [diff] [blame] | 684 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv |
| 685 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv |
| 686 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv |
| 687 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv |
| 688 | .intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 689 | .intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar |
Paul Duffin | 475daaf | 2021-05-13 00:57:55 +0100 | [diff] [blame] | 690 | .intermediates/mysdklibrary.stubs/android_common/javac/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar |
| 691 | .intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt |
| 692 | .intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 693 | `), |
Paul Duffin | 7c47515 | 2021-06-09 16:17:58 +0100 | [diff] [blame^] | 694 | snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot), |
| 695 | snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot), |
| 696 | snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot), |
Paul Duffin | 7c95555 | 2021-04-19 13:23:53 +0100 | [diff] [blame] | 697 | ) |
| 698 | } |