Paul Duffin | 3451e16 | 2021-01-20 15:16:56 +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 apex |
| 16 | |
| 17 | import ( |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 18 | "fmt" |
Jiakai Zhang | 7d3c9e0 | 2021-12-13 17:19:05 +0000 | [diff] [blame] | 19 | "path" |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 20 | "sort" |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 21 | "strings" |
Paul Duffin | 3451e16 | 2021-01-20 15:16:56 +0000 | [diff] [blame] | 22 | "testing" |
| 23 | |
| 24 | "android/soong/android" |
Jiakai Zhang | 49b1eb6 | 2021-11-26 18:09:27 +0000 | [diff] [blame] | 25 | "android/soong/dexpreopt" |
Paul Duffin | 3451e16 | 2021-01-20 15:16:56 +0000 | [diff] [blame] | 26 | "android/soong/java" |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 27 | |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 28 | "github.com/google/blueprint/proptools" |
Paul Duffin | 3451e16 | 2021-01-20 15:16:56 +0000 | [diff] [blame] | 29 | ) |
| 30 | |
Paul Duffin | 7771eba | 2021-04-23 14:25:28 +0100 | [diff] [blame] | 31 | // Contains tests for bootclasspath_fragment logic from java/bootclasspath_fragment.go as the ART |
| 32 | // bootclasspath_fragment requires modules from the ART apex. |
Paul Duffin | 3451e16 | 2021-01-20 15:16:56 +0000 | [diff] [blame] | 33 | |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 34 | var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers( |
Paul Duffin | 52bfaa4 | 2021-03-23 23:40:12 +0000 | [diff] [blame] | 35 | java.PrepareForTestWithDexpreopt, |
| 36 | PrepareForTestWithApexBuildComponents, |
| 37 | ) |
| 38 | |
| 39 | // Some additional files needed for the art apex. |
Jiakai Zhang | 49b1eb6 | 2021-11-26 18:09:27 +0000 | [diff] [blame] | 40 | var prepareForTestWithArtApex = android.GroupFixturePreparers( |
| 41 | android.FixtureMergeMockFs(android.MockFS{ |
| 42 | "com.android.art.avbpubkey": nil, |
| 43 | "com.android.art.pem": nil, |
| 44 | "system/sepolicy/apex/com.android.art-file_contexts": nil, |
| 45 | }), |
| 46 | dexpreopt.FixtureSetBootImageProfiles("art/build/boot/boot-image-profile.txt"), |
| 47 | ) |
Paul Duffin | 52bfaa4 | 2021-03-23 23:40:12 +0000 | [diff] [blame] | 48 | |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 49 | func TestBootclasspathFragments_FragmentDependency(t *testing.T) { |
| 50 | result := android.GroupFixturePreparers( |
| 51 | prepareForTestWithBootclasspathFragment, |
| 52 | // Configure some libraries in the art bootclasspath_fragment and platform_bootclasspath. |
satayev | abcd597 | 2021-08-06 17:49:46 +0100 | [diff] [blame] | 53 | java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"), |
| 54 | java.FixtureConfigureApexBootJars("someapex:foo", "someapex:bar"), |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 55 | prepareForTestWithArtApex, |
| 56 | |
| 57 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 58 | java.FixtureWithLastReleaseApis("foo", "baz"), |
| 59 | ).RunTestWithBp(t, ` |
| 60 | java_sdk_library { |
| 61 | name: "foo", |
| 62 | srcs: ["b.java"], |
| 63 | shared_library: false, |
| 64 | public: { |
| 65 | enabled: true, |
| 66 | }, |
| 67 | system: { |
| 68 | enabled: true, |
| 69 | }, |
| 70 | } |
| 71 | |
| 72 | java_library { |
| 73 | name: "bar", |
| 74 | srcs: ["b.java"], |
| 75 | installable: true, |
| 76 | } |
| 77 | |
| 78 | apex { |
| 79 | name: "com.android.art", |
| 80 | key: "com.android.art.key", |
| 81 | bootclasspath_fragments: ["art-bootclasspath-fragment"], |
| 82 | updatable: false, |
| 83 | } |
| 84 | |
| 85 | apex_key { |
| 86 | name: "com.android.art.key", |
| 87 | public_key: "com.android.art.avbpubkey", |
| 88 | private_key: "com.android.art.pem", |
| 89 | } |
| 90 | |
| 91 | java_sdk_library { |
| 92 | name: "baz", |
| 93 | apex_available: [ |
| 94 | "com.android.art", |
| 95 | ], |
| 96 | srcs: ["b.java"], |
| 97 | shared_library: false, |
| 98 | public: { |
| 99 | enabled: true, |
| 100 | }, |
| 101 | system: { |
| 102 | enabled: true, |
| 103 | }, |
| 104 | test: { |
| 105 | enabled: true, |
| 106 | }, |
| 107 | } |
| 108 | |
| 109 | java_library { |
| 110 | name: "quuz", |
| 111 | apex_available: [ |
| 112 | "com.android.art", |
| 113 | ], |
| 114 | srcs: ["b.java"], |
| 115 | compile_dex: true, |
| 116 | } |
| 117 | |
| 118 | bootclasspath_fragment { |
| 119 | name: "art-bootclasspath-fragment", |
| 120 | image_name: "art", |
| 121 | // Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above. |
| 122 | contents: ["baz", "quuz"], |
| 123 | apex_available: [ |
| 124 | "com.android.art", |
| 125 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 126 | hidden_api: { |
| 127 | split_packages: ["*"], |
| 128 | }, |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | bootclasspath_fragment { |
| 132 | name: "other-bootclasspath-fragment", |
| 133 | contents: ["foo", "bar"], |
| 134 | fragments: [ |
| 135 | { |
| 136 | apex: "com.android.art", |
| 137 | module: "art-bootclasspath-fragment", |
| 138 | }, |
| 139 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 140 | hidden_api: { |
| 141 | split_packages: ["*"], |
| 142 | }, |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 143 | } |
| 144 | `, |
| 145 | ) |
| 146 | |
Paul Duffin | 31fad80 | 2021-06-18 18:14:25 +0100 | [diff] [blame] | 147 | checkAPIScopeStubs := func(message string, info java.HiddenAPIInfo, apiScope *java.HiddenAPIScope, expectedPaths ...string) { |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 148 | t.Helper() |
Paul Duffin | 280a31a | 2021-06-27 20:28:29 +0100 | [diff] [blame] | 149 | paths := info.TransitiveStubDexJarsByScope.StubDexJarsForScope(apiScope) |
| 150 | android.AssertPathsRelativeToTopEquals(t, fmt.Sprintf("%s %s", message, apiScope), expectedPaths, paths) |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | // Check stub dex paths exported by art. |
| 154 | artFragment := result.Module("art-bootclasspath-fragment", "android_common") |
| 155 | artInfo := result.ModuleProvider(artFragment, java.HiddenAPIInfoProvider).(java.HiddenAPIInfo) |
| 156 | |
| 157 | bazPublicStubs := "out/soong/.intermediates/baz.stubs/android_common/dex/baz.stubs.jar" |
| 158 | bazSystemStubs := "out/soong/.intermediates/baz.stubs.system/android_common/dex/baz.stubs.system.jar" |
| 159 | bazTestStubs := "out/soong/.intermediates/baz.stubs.test/android_common/dex/baz.stubs.test.jar" |
| 160 | |
Paul Duffin | 31fad80 | 2021-06-18 18:14:25 +0100 | [diff] [blame] | 161 | checkAPIScopeStubs("art", artInfo, java.PublicHiddenAPIScope, bazPublicStubs) |
| 162 | checkAPIScopeStubs("art", artInfo, java.SystemHiddenAPIScope, bazSystemStubs) |
| 163 | checkAPIScopeStubs("art", artInfo, java.TestHiddenAPIScope, bazTestStubs) |
| 164 | checkAPIScopeStubs("art", artInfo, java.CorePlatformHiddenAPIScope) |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 165 | |
| 166 | // Check stub dex paths exported by other. |
| 167 | otherFragment := result.Module("other-bootclasspath-fragment", "android_common") |
| 168 | otherInfo := result.ModuleProvider(otherFragment, java.HiddenAPIInfoProvider).(java.HiddenAPIInfo) |
| 169 | |
| 170 | fooPublicStubs := "out/soong/.intermediates/foo.stubs/android_common/dex/foo.stubs.jar" |
| 171 | fooSystemStubs := "out/soong/.intermediates/foo.stubs.system/android_common/dex/foo.stubs.system.jar" |
| 172 | |
Paul Duffin | 31fad80 | 2021-06-18 18:14:25 +0100 | [diff] [blame] | 173 | checkAPIScopeStubs("other", otherInfo, java.PublicHiddenAPIScope, bazPublicStubs, fooPublicStubs) |
| 174 | checkAPIScopeStubs("other", otherInfo, java.SystemHiddenAPIScope, bazSystemStubs, fooSystemStubs) |
| 175 | checkAPIScopeStubs("other", otherInfo, java.TestHiddenAPIScope, bazTestStubs, fooSystemStubs) |
| 176 | checkAPIScopeStubs("other", otherInfo, java.CorePlatformHiddenAPIScope) |
Paul Duffin | f1b358c | 2021-05-17 07:38:47 +0100 | [diff] [blame] | 177 | } |
| 178 | |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 179 | func TestBootclasspathFragmentInArtApex(t *testing.T) { |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 180 | commonPreparer := android.GroupFixturePreparers( |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 181 | prepareForTestWithBootclasspathFragment, |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 182 | prepareForTestWithArtApex, |
| 183 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 184 | android.FixtureWithRootAndroidBp(` |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 185 | apex { |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 186 | name: "com.android.art", |
| 187 | key: "com.android.art.key", |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 188 | bootclasspath_fragments: [ |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 189 | "art-bootclasspath-fragment", |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 190 | ], |
Paul Duffin | 4d101b6 | 2021-03-24 15:42:20 +0000 | [diff] [blame] | 191 | // bar (like foo) should be transitively included in this apex because it is part of the |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 192 | // art-bootclasspath-fragment bootclasspath_fragment. |
Mathew Inwood | f8dcf5e | 2021-02-16 11:40:16 +0000 | [diff] [blame] | 193 | updatable: false, |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | apex_key { |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 197 | name: "com.android.art.key", |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 198 | public_key: "testkey.avbpubkey", |
| 199 | private_key: "testkey.pem", |
| 200 | } |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 201 | `), |
| 202 | ) |
Paul Duffin | 6589805 | 2021-04-20 22:47:03 +0100 | [diff] [blame] | 203 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 204 | contentsInsert := func(contents []string) string { |
| 205 | insert := "" |
| 206 | if contents != nil { |
| 207 | insert = fmt.Sprintf(`contents: ["%s"],`, strings.Join(contents, `", "`)) |
Paul Duffin | 396229f | 2021-03-18 18:30:31 +0000 | [diff] [blame] | 208 | } |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 209 | return insert |
| 210 | } |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 211 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 212 | addSource := func(contents ...string) android.FixturePreparer { |
| 213 | text := fmt.Sprintf(` |
| 214 | bootclasspath_fragment { |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 215 | name: "art-bootclasspath-fragment", |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 216 | image_name: "art", |
| 217 | %s |
| 218 | apex_available: [ |
| 219 | "com.android.art", |
| 220 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 221 | hidden_api: { |
| 222 | split_packages: ["*"], |
| 223 | }, |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 224 | } |
| 225 | `, contentsInsert(contents)) |
| 226 | |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 227 | for _, content := range contents { |
| 228 | text += fmt.Sprintf(` |
| 229 | java_library { |
| 230 | name: "%[1]s", |
| 231 | srcs: ["%[1]s.java"], |
| 232 | installable: true, |
| 233 | apex_available: [ |
| 234 | "com.android.art", |
| 235 | ], |
| 236 | } |
| 237 | `, content) |
| 238 | } |
| 239 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 240 | return android.FixtureAddTextFile("art/build/boot/Android.bp", text) |
| 241 | } |
| 242 | |
| 243 | addPrebuilt := func(prefer bool, contents ...string) android.FixturePreparer { |
| 244 | text := fmt.Sprintf(` |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 245 | prebuilt_apex { |
| 246 | name: "com.android.art", |
| 247 | arch: { |
| 248 | arm64: { |
| 249 | src: "com.android.art-arm64.apex", |
| 250 | }, |
| 251 | arm: { |
| 252 | src: "com.android.art-arm.apex", |
| 253 | }, |
| 254 | }, |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 255 | exported_bootclasspath_fragments: ["art-bootclasspath-fragment"], |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 256 | } |
| 257 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 258 | prebuilt_bootclasspath_fragment { |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 259 | name: "art-bootclasspath-fragment", |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 260 | image_name: "art", |
| 261 | %s |
| 262 | prefer: %t, |
| 263 | apex_available: [ |
| 264 | "com.android.art", |
| 265 | ], |
Paul Duffin | 54e4197 | 2021-07-19 13:23:40 +0100 | [diff] [blame] | 266 | hidden_api: { |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 267 | annotation_flags: "hiddenapi/annotation-flags.csv", |
| 268 | metadata: "hiddenapi/metadata.csv", |
| 269 | index: "hiddenapi/index.csv", |
| 270 | stub_flags: "hiddenapi/stub-flags.csv", |
| 271 | all_flags: "hiddenapi/all-flags.csv", |
Paul Duffin | 54e4197 | 2021-07-19 13:23:40 +0100 | [diff] [blame] | 272 | }, |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 273 | } |
| 274 | `, contentsInsert(contents), prefer) |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 275 | |
| 276 | for _, content := range contents { |
| 277 | text += fmt.Sprintf(` |
| 278 | java_import { |
| 279 | name: "%[1]s", |
| 280 | prefer: %[2]t, |
| 281 | jars: ["%[1]s.jar"], |
| 282 | apex_available: [ |
| 283 | "com.android.art", |
| 284 | ], |
| 285 | compile_dex: true, |
| 286 | } |
| 287 | `, content, prefer) |
| 288 | } |
| 289 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 290 | return android.FixtureAddTextFile("prebuilts/module_sdk/art/Android.bp", text) |
| 291 | } |
| 292 | |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 293 | t.Run("boot image files from source", func(t *testing.T) { |
| 294 | result := android.GroupFixturePreparers( |
| 295 | commonPreparer, |
| 296 | |
| 297 | // Configure some libraries in the art bootclasspath_fragment that match the source |
| 298 | // bootclasspath_fragment's contents property. |
| 299 | java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"), |
| 300 | addSource("foo", "bar"), |
Jiakai Zhang | 6decef9 | 2022-01-12 17:56:19 +0000 | [diff] [blame] | 301 | java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"), |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 302 | ).RunTest(t) |
| 303 | |
| 304 | ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ |
Jiakai Zhang | 49b1eb6 | 2021-11-26 18:09:27 +0000 | [diff] [blame] | 305 | "etc/boot-image.prof", |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 306 | "etc/classpaths/bootclasspath.pb", |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 307 | "javalib/bar.jar", |
| 308 | "javalib/foo.jar", |
| 309 | }) |
| 310 | |
| 311 | java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 312 | `art-bootclasspath-fragment`, |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 313 | `com.android.art.key`, |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 314 | }) |
| 315 | |
| 316 | // Make sure that the source bootclasspath_fragment copies its dex files to the predefined |
| 317 | // locations for the art image. |
Jiakai Zhang | cb13b5d | 2023-07-13 11:03:38 +0100 | [diff] [blame] | 318 | module := result.ModuleForTests("dex_bootjars", "android_common") |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 319 | checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo") |
| 320 | }) |
| 321 | |
Jiakai Zhang | bc698cd | 2023-05-08 16:28:38 +0000 | [diff] [blame] | 322 | t.Run("generate boot image profile even if dexpreopt is disabled", func(t *testing.T) { |
| 323 | result := android.GroupFixturePreparers( |
| 324 | commonPreparer, |
| 325 | |
| 326 | // Configure some libraries in the art bootclasspath_fragment that match the source |
| 327 | // bootclasspath_fragment's contents property. |
| 328 | java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"), |
| 329 | addSource("foo", "bar"), |
| 330 | java.FixtureSetBootImageInstallDirOnDevice("art", "system/framework"), |
| 331 | dexpreopt.FixtureDisableDexpreoptBootImages(true), |
| 332 | ).RunTest(t) |
| 333 | |
| 334 | ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ |
| 335 | "etc/boot-image.prof", |
| 336 | "etc/classpaths/bootclasspath.pb", |
| 337 | "javalib/bar.jar", |
| 338 | "javalib/foo.jar", |
| 339 | }) |
| 340 | }) |
| 341 | |
Jiakai Zhang | 7d3c9e0 | 2021-12-13 17:19:05 +0000 | [diff] [blame] | 342 | t.Run("boot image disable generate profile", func(t *testing.T) { |
| 343 | result := android.GroupFixturePreparers( |
| 344 | commonPreparer, |
| 345 | |
| 346 | // Configure some libraries in the art bootclasspath_fragment that match the source |
| 347 | // bootclasspath_fragment's contents property. |
| 348 | java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"), |
| 349 | addSource("foo", "bar"), |
| 350 | dexpreopt.FixtureDisableGenerateProfile(true), |
| 351 | ).RunTest(t) |
| 352 | |
| 353 | files := getFiles(t, result.TestContext, "com.android.art", "android_common_com.android.art_image") |
| 354 | for _, file := range files { |
| 355 | matched, _ := path.Match("etc/boot-image.prof", file.path) |
| 356 | android.AssertBoolEquals(t, "\"etc/boot-image.prof\" should not be in the APEX", matched, false) |
| 357 | } |
| 358 | }) |
| 359 | |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 360 | t.Run("boot image files with preferred prebuilt", func(t *testing.T) { |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 361 | result := android.GroupFixturePreparers( |
| 362 | commonPreparer, |
| 363 | |
| 364 | // Configure some libraries in the art bootclasspath_fragment that match the source |
| 365 | // bootclasspath_fragment's contents property. |
| 366 | java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"), |
| 367 | addSource("foo", "bar"), |
| 368 | |
| 369 | // Make sure that a preferred prebuilt with consistent contents doesn't affect the apex. |
| 370 | addPrebuilt(true, "foo", "bar"), |
Jiakai Zhang | 6decef9 | 2022-01-12 17:56:19 +0000 | [diff] [blame] | 371 | |
| 372 | java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"), |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 373 | ).RunTest(t) |
| 374 | |
Jiakai Zhang | ebf48bf | 2023-02-10 01:51:53 +0800 | [diff] [blame] | 375 | ensureExactDeapexedContents(t, result.TestContext, "com.android.art", "android_common", []string{ |
Jiakai Zhang | 49b1eb6 | 2021-11-26 18:09:27 +0000 | [diff] [blame] | 376 | "etc/boot-image.prof", |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 377 | "javalib/bar.jar", |
| 378 | "javalib/foo.jar", |
| 379 | }) |
| 380 | |
| 381 | java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 382 | `art-bootclasspath-fragment`, |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 383 | `com.android.art.key`, |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 384 | `prebuilt_com.android.art`, |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 385 | }) |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 386 | |
| 387 | // Make sure that the prebuilt bootclasspath_fragment copies its dex files to the predefined |
| 388 | // locations for the art image. |
Jiakai Zhang | cb13b5d | 2023-07-13 11:03:38 +0100 | [diff] [blame] | 389 | module := result.ModuleForTests("dex_bootjars", "android_common") |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 390 | checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo") |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 391 | }) |
Paul Duffin | 396229f | 2021-03-18 18:30:31 +0000 | [diff] [blame] | 392 | |
Paul Duffin | ba6afd0 | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 393 | t.Run("source with inconsistency between config and contents", func(t *testing.T) { |
| 394 | android.GroupFixturePreparers( |
| 395 | commonPreparer, |
| 396 | |
| 397 | // Create an inconsistency between the ArtApexJars configuration and the art source |
| 398 | // bootclasspath_fragment module's contents property. |
| 399 | java.FixtureConfigureBootJars("com.android.art:foo"), |
| 400 | addSource("foo", "bar"), |
| 401 | ). |
| 402 | ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\QArtApexJars configuration specifies []string{"foo"}, contents property specifies []string{"foo", "bar"}\E`)). |
| 403 | RunTest(t) |
| 404 | }) |
| 405 | |
| 406 | t.Run("prebuilt with inconsistency between config and contents", func(t *testing.T) { |
| 407 | android.GroupFixturePreparers( |
| 408 | commonPreparer, |
| 409 | |
| 410 | // Create an inconsistency between the ArtApexJars configuration and the art |
| 411 | // prebuilt_bootclasspath_fragment module's contents property. |
| 412 | java.FixtureConfigureBootJars("com.android.art:foo"), |
| 413 | addPrebuilt(false, "foo", "bar"), |
| 414 | ). |
| 415 | ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\QArtApexJars configuration specifies []string{"foo"}, contents property specifies []string{"foo", "bar"}\E`)). |
| 416 | RunTest(t) |
| 417 | }) |
| 418 | |
| 419 | t.Run("preferred prebuilt with inconsistency between config and contents", func(t *testing.T) { |
| 420 | android.GroupFixturePreparers( |
| 421 | commonPreparer, |
| 422 | |
| 423 | // Create an inconsistency between the ArtApexJars configuration and the art |
| 424 | // prebuilt_bootclasspath_fragment module's contents property. |
| 425 | java.FixtureConfigureBootJars("com.android.art:foo"), |
| 426 | addPrebuilt(true, "foo", "bar"), |
| 427 | |
| 428 | // Source contents property is consistent with the config. |
| 429 | addSource("foo"), |
| 430 | ). |
| 431 | ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\QArtApexJars configuration specifies []string{"foo"}, contents property specifies []string{"foo", "bar"}\E`)). |
| 432 | RunTest(t) |
| 433 | }) |
| 434 | |
| 435 | t.Run("source preferred and prebuilt with inconsistency between config and contents", func(t *testing.T) { |
| 436 | android.GroupFixturePreparers( |
| 437 | commonPreparer, |
| 438 | |
| 439 | // Create an inconsistency between the ArtApexJars configuration and the art |
| 440 | // prebuilt_bootclasspath_fragment module's contents property. |
| 441 | java.FixtureConfigureBootJars("com.android.art:foo"), |
| 442 | addPrebuilt(false, "foo", "bar"), |
| 443 | |
| 444 | // Source contents property is consistent with the config. |
| 445 | addSource("foo"), |
| 446 | |
| 447 | // This should pass because while the prebuilt is inconsistent with the configuration it is |
| 448 | // not actually used. |
| 449 | ).RunTest(t) |
Paul Duffin | 396229f | 2021-03-18 18:30:31 +0000 | [diff] [blame] | 450 | }) |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 451 | } |
| 452 | |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 453 | func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 454 | preparers := android.GroupFixturePreparers( |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 455 | prepareForTestWithBootclasspathFragment, |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 456 | prepareForTestWithArtApex, |
| 457 | |
| 458 | android.FixtureMergeMockFs(android.MockFS{ |
| 459 | "com.android.art-arm64.apex": nil, |
| 460 | "com.android.art-arm.apex": nil, |
| 461 | }), |
| 462 | |
Paul Duffin | 7771eba | 2021-04-23 14:25:28 +0100 | [diff] [blame] | 463 | // Configure some libraries in the art bootclasspath_fragment. |
Paul Duffin | 60264a0 | 2021-04-12 20:02:36 +0100 | [diff] [blame] | 464 | java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"), |
Jiakai Zhang | e6e90db | 2022-01-28 14:58:56 +0000 | [diff] [blame] | 465 | java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"), |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 466 | ) |
| 467 | |
| 468 | bp := ` |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 469 | prebuilt_apex { |
| 470 | name: "com.android.art", |
| 471 | arch: { |
| 472 | arm64: { |
| 473 | src: "com.android.art-arm64.apex", |
| 474 | }, |
| 475 | arm: { |
| 476 | src: "com.android.art-arm.apex", |
| 477 | }, |
| 478 | }, |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 479 | exported_bootclasspath_fragments: ["art-bootclasspath-fragment"], |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | java_import { |
| 483 | name: "foo", |
| 484 | jars: ["foo.jar"], |
| 485 | apex_available: [ |
| 486 | "com.android.art", |
| 487 | ], |
| 488 | } |
| 489 | |
| 490 | java_import { |
| 491 | name: "bar", |
| 492 | jars: ["bar.jar"], |
| 493 | apex_available: [ |
| 494 | "com.android.art", |
| 495 | ], |
| 496 | } |
| 497 | |
Paul Duffin | 7771eba | 2021-04-23 14:25:28 +0100 | [diff] [blame] | 498 | prebuilt_bootclasspath_fragment { |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 499 | name: "art-bootclasspath-fragment", |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 500 | image_name: "art", |
Paul Duffin | f23bc47 | 2021-04-27 12:42:20 +0100 | [diff] [blame] | 501 | // Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above. |
| 502 | contents: ["foo", "bar"], |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 503 | apex_available: [ |
| 504 | "com.android.art", |
| 505 | ], |
Paul Duffin | 54e4197 | 2021-07-19 13:23:40 +0100 | [diff] [blame] | 506 | hidden_api: { |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 507 | annotation_flags: "hiddenapi/annotation-flags.csv", |
| 508 | metadata: "hiddenapi/metadata.csv", |
| 509 | index: "hiddenapi/index.csv", |
| 510 | stub_flags: "hiddenapi/stub-flags.csv", |
| 511 | all_flags: "hiddenapi/all-flags.csv", |
Paul Duffin | 54e4197 | 2021-07-19 13:23:40 +0100 | [diff] [blame] | 512 | }, |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 513 | } |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 514 | |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 515 | // A prebuilt apex with the same apex_name that shouldn't interfere when it isn't enabled. |
| 516 | prebuilt_apex { |
| 517 | name: "com.mycompany.android.art", |
| 518 | apex_name: "com.android.art", |
| 519 | %s |
| 520 | src: "com.mycompany.android.art.apex", |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 521 | exported_bootclasspath_fragments: ["art-bootclasspath-fragment"], |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 522 | } |
| 523 | ` |
| 524 | |
| 525 | t.Run("disabled alternative APEX", func(t *testing.T) { |
| 526 | result := preparers.RunTestWithBp(t, fmt.Sprintf(bp, "enabled: false,")) |
| 527 | |
| 528 | java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{ |
| 529 | `com.android.art.apex.selector`, |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 530 | `prebuilt_art-bootclasspath-fragment`, |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 531 | }) |
| 532 | |
Jiakai Zhang | b69e895 | 2023-07-11 14:31:22 +0100 | [diff] [blame] | 533 | java.CheckModuleDependencies(t, result.TestContext, "art-bootclasspath-fragment", "android_common_com.android.art", []string{ |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 534 | `com.android.art.deapexer`, |
| 535 | `dex2oatd`, |
| 536 | `prebuilt_bar`, |
| 537 | `prebuilt_foo`, |
| 538 | }) |
| 539 | |
Jiakai Zhang | cb13b5d | 2023-07-13 11:03:38 +0100 | [diff] [blame] | 540 | module := result.ModuleForTests("dex_bootjars", "android_common") |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 541 | checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo") |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 542 | }) |
| 543 | |
Martin Stjernholm | 43c44b0 | 2021-06-30 16:35:07 +0100 | [diff] [blame] | 544 | t.Run("enabled alternative APEX", func(t *testing.T) { |
| 545 | preparers.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern( |
| 546 | "Multiple installable prebuilt APEXes provide ambiguous deapexers: com.android.art and com.mycompany.android.art")). |
| 547 | RunTestWithBp(t, fmt.Sprintf(bp, "")) |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 548 | }) |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | // checkCopiesToPredefinedLocationForArt checks that the supplied modules are copied to the |
| 552 | // predefined locations of boot dex jars used as inputs for the ART boot image. |
| 553 | func checkCopiesToPredefinedLocationForArt(t *testing.T, config android.Config, module android.TestingModule, modules ...string) { |
| 554 | t.Helper() |
| 555 | bootJarLocations := []string{} |
| 556 | for _, output := range module.AllOutputs() { |
| 557 | output = android.StringRelativeToTop(config, output) |
Jeongik Cha | 4753b39 | 2023-04-19 23:25:41 +0900 | [diff] [blame] | 558 | if strings.HasPrefix(output, "out/soong/dexpreopt_arm64/dex_artjars_input/") { |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 559 | bootJarLocations = append(bootJarLocations, output) |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | sort.Strings(bootJarLocations) |
| 564 | expected := []string{} |
| 565 | for _, m := range modules { |
Jeongik Cha | 4753b39 | 2023-04-19 23:25:41 +0900 | [diff] [blame] | 566 | expected = append(expected, fmt.Sprintf("out/soong/dexpreopt_arm64/dex_artjars_input/%s.jar", m)) |
Paul Duffin | ce918b0 | 2021-06-07 14:33:47 +0100 | [diff] [blame] | 567 | } |
| 568 | sort.Strings(expected) |
| 569 | |
| 570 | android.AssertArrayString(t, "copies to predefined locations for art", expected, bootJarLocations) |
Paul Duffin | 9ea71c0 | 2021-03-23 22:53:07 +0000 | [diff] [blame] | 571 | } |
| 572 | |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 573 | func TestBootclasspathFragmentContentsNoName(t *testing.T) { |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 574 | result := android.GroupFixturePreparers( |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 575 | prepareForTestWithBootclasspathFragment, |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 576 | prepareForTestWithMyapex, |
Paul Duffin | f2fa0b5 | 2021-05-14 18:21:45 +0100 | [diff] [blame] | 577 | // Configure bootclasspath jars to ensure that hidden API encoding is performed on them. |
satayev | abcd597 | 2021-08-06 17:49:46 +0100 | [diff] [blame] | 578 | java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"), |
Paul Duffin | f2fa0b5 | 2021-05-14 18:21:45 +0100 | [diff] [blame] | 579 | // Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding |
| 580 | // is disabled. |
| 581 | android.FixtureAddTextFile("frameworks/base/Android.bp", ""), |
| 582 | |
| 583 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 584 | java.FixtureWithLastReleaseApis("foo"), |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 585 | ).RunTestWithBp(t, ` |
| 586 | apex { |
| 587 | name: "myapex", |
| 588 | key: "myapex.key", |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 589 | bootclasspath_fragments: [ |
| 590 | "mybootclasspathfragment", |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 591 | ], |
| 592 | updatable: false, |
| 593 | } |
| 594 | |
| 595 | apex_key { |
| 596 | name: "myapex.key", |
| 597 | public_key: "testkey.avbpubkey", |
| 598 | private_key: "testkey.pem", |
| 599 | } |
| 600 | |
Paul Duffin | f2fa0b5 | 2021-05-14 18:21:45 +0100 | [diff] [blame] | 601 | java_sdk_library { |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 602 | name: "foo", |
| 603 | srcs: ["b.java"], |
Paul Duffin | f2fa0b5 | 2021-05-14 18:21:45 +0100 | [diff] [blame] | 604 | shared_library: false, |
| 605 | public: {enabled: true}, |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 606 | apex_available: [ |
| 607 | "myapex", |
| 608 | ], |
| 609 | } |
| 610 | |
| 611 | java_library { |
| 612 | name: "bar", |
| 613 | srcs: ["b.java"], |
| 614 | installable: true, |
| 615 | apex_available: [ |
| 616 | "myapex", |
| 617 | ], |
| 618 | } |
| 619 | |
Paul Duffin | 7771eba | 2021-04-23 14:25:28 +0100 | [diff] [blame] | 620 | bootclasspath_fragment { |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 621 | name: "mybootclasspathfragment", |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 622 | contents: [ |
| 623 | "foo", |
| 624 | "bar", |
| 625 | ], |
| 626 | apex_available: [ |
| 627 | "myapex", |
| 628 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 629 | hidden_api: { |
| 630 | split_packages: ["*"], |
| 631 | }, |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 632 | } |
| 633 | `) |
| 634 | |
Paul Duffin | 4d101b6 | 2021-03-24 15:42:20 +0000 | [diff] [blame] | 635 | ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ |
| 636 | // This does not include art, oat or vdex files as they are only included for the art boot |
| 637 | // image. |
satayev | 227e745 | 2021-05-20 21:35:06 +0100 | [diff] [blame] | 638 | "etc/classpaths/bootclasspath.pb", |
Paul Duffin | 4d101b6 | 2021-03-24 15:42:20 +0000 | [diff] [blame] | 639 | "javalib/bar.jar", |
| 640 | "javalib/foo.jar", |
| 641 | }) |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 642 | |
| 643 | java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ |
| 644 | `myapex.key`, |
Paul Duffin | 94f1963 | 2021-04-20 12:40:07 +0100 | [diff] [blame] | 645 | `mybootclasspathfragment`, |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 646 | }) |
Paul Duffin | f2fa0b5 | 2021-05-14 18:21:45 +0100 | [diff] [blame] | 647 | |
| 648 | apex := result.ModuleForTests("myapex", "android_common_myapex_image") |
| 649 | apexRule := apex.Rule("apexRule") |
| 650 | copyCommands := apexRule.Args["copy_commands"] |
| 651 | |
| 652 | // Make sure that the fragment provides the hidden API encoded dex jars to the APEX. |
| 653 | fragment := result.Module("mybootclasspathfragment", "android_common_apex10000") |
| 654 | |
| 655 | info := result.ModuleProvider(fragment, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo) |
| 656 | |
| 657 | checkFragmentExportedDexJar := func(name string, expectedDexJar string) { |
| 658 | module := result.Module(name, "android_common_apex10000") |
Paul Duffin | 1a8010a | 2021-05-15 12:39:23 +0100 | [diff] [blame] | 659 | dexJar, err := info.DexBootJarPathForContentModule(module) |
| 660 | if err != nil { |
| 661 | t.Error(err) |
| 662 | } |
Paul Duffin | f2fa0b5 | 2021-05-14 18:21:45 +0100 | [diff] [blame] | 663 | android.AssertPathRelativeToTopEquals(t, name+" dex", expectedDexJar, dexJar) |
| 664 | |
| 665 | expectedCopyCommand := fmt.Sprintf("&& cp -f %s out/soong/.intermediates/myapex/android_common_myapex_image/image.apex/javalib/%s.jar", expectedDexJar, name) |
| 666 | android.AssertStringDoesContain(t, name+" apex copy command", copyCommands, expectedCopyCommand) |
| 667 | } |
| 668 | |
Paul Duffin | 54c98f5 | 2021-05-15 08:54:30 +0100 | [diff] [blame] | 669 | checkFragmentExportedDexJar("foo", "out/soong/.intermediates/mybootclasspathfragment/android_common_apex10000/hiddenapi-modular/encoded/foo.jar") |
| 670 | checkFragmentExportedDexJar("bar", "out/soong/.intermediates/mybootclasspathfragment/android_common_apex10000/hiddenapi-modular/encoded/bar.jar") |
Paul Duffin | 82886d6 | 2021-03-24 01:34:57 +0000 | [diff] [blame] | 671 | } |
| 672 | |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 673 | func getDexJarPath(result *android.TestResult, name string) string { |
| 674 | module := result.Module(name, "android_common") |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 675 | return module.(java.UsesLibraryDependency).DexJarBuildPath().Path().RelativeToTop().String() |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | // TestBootclasspathFragment_HiddenAPIList checks to make sure that the correct parameters are |
| 679 | // passed to the hiddenapi list tool. |
| 680 | func TestBootclasspathFragment_HiddenAPIList(t *testing.T) { |
| 681 | result := android.GroupFixturePreparers( |
| 682 | prepareForTestWithBootclasspathFragment, |
| 683 | prepareForTestWithArtApex, |
| 684 | prepareForTestWithMyapex, |
| 685 | // Configure bootclasspath jars to ensure that hidden API encoding is performed on them. |
| 686 | java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"), |
satayev | d604b21 | 2021-07-21 14:23:52 +0100 | [diff] [blame] | 687 | java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"), |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 688 | // Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding |
| 689 | // is disabled. |
| 690 | android.FixtureAddTextFile("frameworks/base/Android.bp", ""), |
| 691 | |
| 692 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 693 | java.FixtureWithLastReleaseApis("foo", "quuz"), |
| 694 | ).RunTestWithBp(t, ` |
| 695 | apex { |
| 696 | name: "com.android.art", |
| 697 | key: "com.android.art.key", |
| 698 | bootclasspath_fragments: ["art-bootclasspath-fragment"], |
| 699 | updatable: false, |
| 700 | } |
| 701 | |
| 702 | apex_key { |
| 703 | name: "com.android.art.key", |
| 704 | public_key: "com.android.art.avbpubkey", |
| 705 | private_key: "com.android.art.pem", |
| 706 | } |
| 707 | |
| 708 | java_library { |
| 709 | name: "baz", |
| 710 | apex_available: [ |
| 711 | "com.android.art", |
| 712 | ], |
| 713 | srcs: ["b.java"], |
| 714 | compile_dex: true, |
| 715 | } |
| 716 | |
| 717 | java_sdk_library { |
| 718 | name: "quuz", |
| 719 | apex_available: [ |
| 720 | "com.android.art", |
| 721 | ], |
| 722 | srcs: ["b.java"], |
| 723 | compile_dex: true, |
| 724 | public: {enabled: true}, |
| 725 | system: {enabled: true}, |
| 726 | test: {enabled: true}, |
| 727 | module_lib: {enabled: true}, |
| 728 | } |
| 729 | |
| 730 | bootclasspath_fragment { |
| 731 | name: "art-bootclasspath-fragment", |
| 732 | image_name: "art", |
| 733 | // Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above. |
| 734 | contents: ["baz", "quuz"], |
| 735 | apex_available: [ |
| 736 | "com.android.art", |
| 737 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 738 | hidden_api: { |
| 739 | split_packages: ["*"], |
| 740 | }, |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 741 | } |
| 742 | |
| 743 | apex { |
| 744 | name: "myapex", |
| 745 | key: "myapex.key", |
| 746 | bootclasspath_fragments: [ |
| 747 | "mybootclasspathfragment", |
| 748 | ], |
| 749 | updatable: false, |
| 750 | } |
| 751 | |
| 752 | apex_key { |
| 753 | name: "myapex.key", |
| 754 | public_key: "testkey.avbpubkey", |
| 755 | private_key: "testkey.pem", |
| 756 | } |
| 757 | |
| 758 | java_sdk_library { |
| 759 | name: "foo", |
| 760 | srcs: ["b.java"], |
| 761 | shared_library: false, |
| 762 | public: {enabled: true}, |
| 763 | apex_available: [ |
| 764 | "myapex", |
| 765 | ], |
| 766 | } |
| 767 | |
| 768 | java_library { |
| 769 | name: "bar", |
| 770 | srcs: ["b.java"], |
| 771 | installable: true, |
| 772 | apex_available: [ |
| 773 | "myapex", |
| 774 | ], |
| 775 | } |
| 776 | |
| 777 | bootclasspath_fragment { |
| 778 | name: "mybootclasspathfragment", |
| 779 | contents: [ |
| 780 | "foo", |
| 781 | "bar", |
| 782 | ], |
| 783 | apex_available: [ |
| 784 | "myapex", |
| 785 | ], |
| 786 | fragments: [ |
| 787 | { |
| 788 | apex: "com.android.art", |
| 789 | module: "art-bootclasspath-fragment", |
| 790 | }, |
| 791 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 792 | hidden_api: { |
| 793 | split_packages: ["*"], |
| 794 | }, |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 795 | } |
| 796 | `) |
| 797 | |
| 798 | java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ |
| 799 | "art-bootclasspath-fragment", |
| 800 | "bar", |
| 801 | "dex2oatd", |
| 802 | "foo", |
| 803 | }) |
| 804 | |
| 805 | fooStubs := getDexJarPath(result, "foo.stubs") |
| 806 | quuzPublicStubs := getDexJarPath(result, "quuz.stubs") |
| 807 | quuzSystemStubs := getDexJarPath(result, "quuz.stubs.system") |
| 808 | quuzTestStubs := getDexJarPath(result, "quuz.stubs.test") |
Paul Duffin | b51db2e | 2021-06-21 14:08:08 +0100 | [diff] [blame] | 809 | quuzModuleLibStubs := getDexJarPath(result, "quuz.stubs.module_lib") |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 810 | |
| 811 | // Make sure that the fragment uses the quuz stub dex jars when generating the hidden API flags. |
| 812 | fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") |
| 813 | |
| 814 | rule := fragment.Rule("modularHiddenAPIStubFlagsFile") |
| 815 | command := rule.RuleParams.Command |
| 816 | android.AssertStringDoesContain(t, "check correct rule", command, "hiddenapi list") |
| 817 | |
| 818 | // Make sure that the quuz stubs are available for resolving references from the implementation |
| 819 | // boot dex jars provided by this module. |
Paul Duffin | b51db2e | 2021-06-21 14:08:08 +0100 | [diff] [blame] | 820 | android.AssertStringDoesContain(t, "quuz widest", command, "--dependency-stub-dex="+quuzModuleLibStubs) |
Paul Duffin | 48b6741 | 2021-06-23 16:13:50 +0100 | [diff] [blame] | 821 | |
| 822 | // Make sure that the quuz stubs are available for resolving references from the different API |
| 823 | // stubs provided by this module. |
| 824 | android.AssertStringDoesContain(t, "public", command, "--public-stub-classpath="+quuzPublicStubs+":"+fooStubs) |
| 825 | android.AssertStringDoesContain(t, "system", command, "--system-stub-classpath="+quuzSystemStubs+":"+fooStubs) |
| 826 | android.AssertStringDoesContain(t, "test", command, "--test-stub-classpath="+quuzTestStubs+":"+fooStubs) |
| 827 | } |
| 828 | |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 829 | // TestBootclasspathFragment_AndroidNonUpdatable checks to make sure that setting |
| 830 | // additional_stubs: ["android-non-updatable"] causes the source android-non-updatable modules to be |
| 831 | // added to the hiddenapi list tool. |
| 832 | func TestBootclasspathFragment_AndroidNonUpdatable(t *testing.T) { |
| 833 | result := android.GroupFixturePreparers( |
| 834 | prepareForTestWithBootclasspathFragment, |
| 835 | prepareForTestWithArtApex, |
| 836 | prepareForTestWithMyapex, |
| 837 | // Configure bootclasspath jars to ensure that hidden API encoding is performed on them. |
satayev | abcd597 | 2021-08-06 17:49:46 +0100 | [diff] [blame] | 838 | java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"), |
| 839 | java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"), |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 840 | // Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding |
| 841 | // is disabled. |
| 842 | android.FixtureAddTextFile("frameworks/base/Android.bp", ""), |
| 843 | |
| 844 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 845 | java.FixtureWithLastReleaseApis("foo", "android-non-updatable"), |
| 846 | ).RunTestWithBp(t, ` |
| 847 | java_sdk_library { |
| 848 | name: "android-non-updatable", |
| 849 | srcs: ["b.java"], |
| 850 | compile_dex: true, |
| 851 | public: { |
| 852 | enabled: true, |
| 853 | }, |
| 854 | system: { |
| 855 | enabled: true, |
| 856 | }, |
| 857 | test: { |
| 858 | enabled: true, |
| 859 | }, |
| 860 | module_lib: { |
| 861 | enabled: true, |
| 862 | }, |
| 863 | } |
| 864 | |
| 865 | apex { |
| 866 | name: "com.android.art", |
| 867 | key: "com.android.art.key", |
| 868 | bootclasspath_fragments: ["art-bootclasspath-fragment"], |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 869 | updatable: false, |
| 870 | } |
| 871 | |
| 872 | apex_key { |
| 873 | name: "com.android.art.key", |
| 874 | public_key: "com.android.art.avbpubkey", |
| 875 | private_key: "com.android.art.pem", |
| 876 | } |
| 877 | |
| 878 | java_library { |
| 879 | name: "baz", |
| 880 | apex_available: [ |
| 881 | "com.android.art", |
| 882 | ], |
| 883 | srcs: ["b.java"], |
| 884 | compile_dex: true, |
| 885 | } |
| 886 | |
| 887 | java_library { |
| 888 | name: "quuz", |
| 889 | apex_available: [ |
| 890 | "com.android.art", |
| 891 | ], |
| 892 | srcs: ["b.java"], |
| 893 | compile_dex: true, |
| 894 | } |
| 895 | |
| 896 | bootclasspath_fragment { |
| 897 | name: "art-bootclasspath-fragment", |
| 898 | image_name: "art", |
| 899 | // Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above. |
| 900 | contents: ["baz", "quuz"], |
| 901 | apex_available: [ |
| 902 | "com.android.art", |
| 903 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 904 | hidden_api: { |
| 905 | split_packages: ["*"], |
| 906 | }, |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 907 | } |
| 908 | |
| 909 | apex { |
| 910 | name: "myapex", |
| 911 | key: "myapex.key", |
| 912 | bootclasspath_fragments: [ |
| 913 | "mybootclasspathfragment", |
| 914 | ], |
| 915 | updatable: false, |
| 916 | } |
| 917 | |
| 918 | apex_key { |
| 919 | name: "myapex.key", |
| 920 | public_key: "testkey.avbpubkey", |
| 921 | private_key: "testkey.pem", |
| 922 | } |
| 923 | |
| 924 | java_sdk_library { |
| 925 | name: "foo", |
| 926 | srcs: ["b.java"], |
| 927 | shared_library: false, |
| 928 | public: {enabled: true}, |
| 929 | apex_available: [ |
| 930 | "myapex", |
| 931 | ], |
| 932 | } |
| 933 | |
| 934 | java_library { |
| 935 | name: "bar", |
| 936 | srcs: ["b.java"], |
| 937 | installable: true, |
| 938 | apex_available: [ |
| 939 | "myapex", |
| 940 | ], |
| 941 | } |
| 942 | |
| 943 | bootclasspath_fragment { |
| 944 | name: "mybootclasspathfragment", |
| 945 | contents: [ |
| 946 | "foo", |
| 947 | "bar", |
| 948 | ], |
| 949 | apex_available: [ |
| 950 | "myapex", |
| 951 | ], |
| 952 | additional_stubs: ["android-non-updatable"], |
| 953 | fragments: [ |
| 954 | { |
| 955 | apex: "com.android.art", |
| 956 | module: "art-bootclasspath-fragment", |
| 957 | }, |
| 958 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 959 | hidden_api: { |
| 960 | split_packages: ["*"], |
| 961 | }, |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 962 | } |
| 963 | `) |
| 964 | |
| 965 | java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ |
| 966 | "android-non-updatable.stubs", |
| 967 | "android-non-updatable.stubs.module_lib", |
| 968 | "android-non-updatable.stubs.system", |
| 969 | "android-non-updatable.stubs.test", |
| 970 | "art-bootclasspath-fragment", |
| 971 | "bar", |
| 972 | "dex2oatd", |
| 973 | "foo", |
| 974 | }) |
| 975 | |
| 976 | nonUpdatablePublicStubs := getDexJarPath(result, "android-non-updatable.stubs") |
| 977 | nonUpdatableSystemStubs := getDexJarPath(result, "android-non-updatable.stubs.system") |
| 978 | nonUpdatableTestStubs := getDexJarPath(result, "android-non-updatable.stubs.test") |
| 979 | nonUpdatableModuleLibStubs := getDexJarPath(result, "android-non-updatable.stubs.module_lib") |
| 980 | |
| 981 | // Make sure that the fragment uses the android-non-updatable modules when generating the hidden |
| 982 | // API flags. |
| 983 | fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") |
| 984 | |
| 985 | rule := fragment.Rule("modularHiddenAPIStubFlagsFile") |
| 986 | command := rule.RuleParams.Command |
| 987 | android.AssertStringDoesContain(t, "check correct rule", command, "hiddenapi list") |
| 988 | |
| 989 | // Make sure that the module_lib non-updatable stubs are available for resolving references from |
| 990 | // the implementation boot dex jars provided by this module. |
| 991 | android.AssertStringDoesContain(t, "android-non-updatable widest", command, "--dependency-stub-dex="+nonUpdatableModuleLibStubs) |
| 992 | |
| 993 | // Make sure that the appropriate non-updatable stubs are available for resolving references from |
| 994 | // the different API stubs provided by this module. |
| 995 | android.AssertStringDoesContain(t, "public", command, "--public-stub-classpath="+nonUpdatablePublicStubs) |
| 996 | android.AssertStringDoesContain(t, "system", command, "--system-stub-classpath="+nonUpdatableSystemStubs) |
| 997 | android.AssertStringDoesContain(t, "test", command, "--test-stub-classpath="+nonUpdatableTestStubs) |
| 998 | } |
| 999 | |
| 1000 | // TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks checks to make sure that |
| 1001 | // setting additional_stubs: ["android-non-updatable"] causes the prebuilt android-non-updatable |
| 1002 | // modules to be added to the hiddenapi list tool. |
| 1003 | func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *testing.T) { |
| 1004 | result := android.GroupFixturePreparers( |
| 1005 | prepareForTestWithBootclasspathFragment, |
Jiakai Zhang | b95998b | 2023-05-11 16:39:27 +0100 | [diff] [blame] | 1006 | java.PrepareForTestWithDexpreopt, |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 1007 | prepareForTestWithArtApex, |
| 1008 | prepareForTestWithMyapex, |
| 1009 | // Configure bootclasspath jars to ensure that hidden API encoding is performed on them. |
satayev | abcd597 | 2021-08-06 17:49:46 +0100 | [diff] [blame] | 1010 | java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"), |
| 1011 | java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"), |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 1012 | // Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding |
| 1013 | // is disabled. |
| 1014 | android.FixtureAddTextFile("frameworks/base/Android.bp", ""), |
| 1015 | |
| 1016 | android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { |
| 1017 | variables.Always_use_prebuilt_sdks = proptools.BoolPtr(true) |
| 1018 | }), |
| 1019 | |
| 1020 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 1021 | java.FixtureWithPrebuiltApis(map[string][]string{ |
| 1022 | "current": {"android-non-updatable"}, |
| 1023 | "30": {"foo"}, |
| 1024 | }), |
| 1025 | ).RunTestWithBp(t, ` |
| 1026 | apex { |
| 1027 | name: "com.android.art", |
| 1028 | key: "com.android.art.key", |
| 1029 | bootclasspath_fragments: ["art-bootclasspath-fragment"], |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 1030 | updatable: false, |
| 1031 | } |
| 1032 | |
| 1033 | apex_key { |
| 1034 | name: "com.android.art.key", |
| 1035 | public_key: "com.android.art.avbpubkey", |
| 1036 | private_key: "com.android.art.pem", |
| 1037 | } |
| 1038 | |
| 1039 | java_library { |
| 1040 | name: "baz", |
| 1041 | apex_available: [ |
| 1042 | "com.android.art", |
| 1043 | ], |
| 1044 | srcs: ["b.java"], |
| 1045 | compile_dex: true, |
| 1046 | } |
| 1047 | |
| 1048 | java_library { |
| 1049 | name: "quuz", |
| 1050 | apex_available: [ |
| 1051 | "com.android.art", |
| 1052 | ], |
| 1053 | srcs: ["b.java"], |
| 1054 | compile_dex: true, |
| 1055 | } |
| 1056 | |
| 1057 | bootclasspath_fragment { |
| 1058 | name: "art-bootclasspath-fragment", |
| 1059 | image_name: "art", |
| 1060 | // Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above. |
| 1061 | contents: ["baz", "quuz"], |
| 1062 | apex_available: [ |
| 1063 | "com.android.art", |
| 1064 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 1065 | hidden_api: { |
| 1066 | split_packages: ["*"], |
| 1067 | }, |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | apex { |
| 1071 | name: "myapex", |
| 1072 | key: "myapex.key", |
| 1073 | bootclasspath_fragments: [ |
| 1074 | "mybootclasspathfragment", |
| 1075 | ], |
| 1076 | updatable: false, |
| 1077 | } |
| 1078 | |
| 1079 | apex_key { |
| 1080 | name: "myapex.key", |
| 1081 | public_key: "testkey.avbpubkey", |
| 1082 | private_key: "testkey.pem", |
| 1083 | } |
| 1084 | |
| 1085 | java_sdk_library { |
| 1086 | name: "foo", |
| 1087 | srcs: ["b.java"], |
| 1088 | shared_library: false, |
| 1089 | public: {enabled: true}, |
| 1090 | apex_available: [ |
| 1091 | "myapex", |
| 1092 | ], |
| 1093 | } |
| 1094 | |
| 1095 | java_library { |
| 1096 | name: "bar", |
| 1097 | srcs: ["b.java"], |
| 1098 | installable: true, |
| 1099 | apex_available: [ |
| 1100 | "myapex", |
| 1101 | ], |
| 1102 | } |
| 1103 | |
| 1104 | bootclasspath_fragment { |
| 1105 | name: "mybootclasspathfragment", |
| 1106 | contents: [ |
| 1107 | "foo", |
| 1108 | "bar", |
| 1109 | ], |
| 1110 | apex_available: [ |
| 1111 | "myapex", |
| 1112 | ], |
| 1113 | additional_stubs: ["android-non-updatable"], |
| 1114 | fragments: [ |
| 1115 | { |
| 1116 | apex: "com.android.art", |
| 1117 | module: "art-bootclasspath-fragment", |
| 1118 | }, |
| 1119 | ], |
Paul Duffin | 9fd5647 | 2022-03-31 15:42:30 +0100 | [diff] [blame] | 1120 | hidden_api: { |
| 1121 | split_packages: ["*"], |
| 1122 | }, |
Paul Duffin | 5cca7c4 | 2021-05-26 10:16:01 +0100 | [diff] [blame] | 1123 | } |
| 1124 | `) |
| 1125 | |
| 1126 | java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ |
| 1127 | "art-bootclasspath-fragment", |
| 1128 | "bar", |
| 1129 | "dex2oatd", |
| 1130 | "foo", |
| 1131 | "prebuilt_sdk_module-lib_current_android-non-updatable", |
| 1132 | "prebuilt_sdk_public_current_android-non-updatable", |
| 1133 | "prebuilt_sdk_system_current_android-non-updatable", |
| 1134 | "prebuilt_sdk_test_current_android-non-updatable", |
| 1135 | }) |
| 1136 | |
| 1137 | nonUpdatablePublicStubs := getDexJarPath(result, "sdk_public_current_android-non-updatable") |
| 1138 | nonUpdatableSystemStubs := getDexJarPath(result, "sdk_system_current_android-non-updatable") |
| 1139 | nonUpdatableTestStubs := getDexJarPath(result, "sdk_test_current_android-non-updatable") |
| 1140 | nonUpdatableModuleLibStubs := getDexJarPath(result, "sdk_module-lib_current_android-non-updatable") |
| 1141 | |
| 1142 | // Make sure that the fragment uses the android-non-updatable modules when generating the hidden |
| 1143 | // API flags. |
| 1144 | fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") |
| 1145 | |
| 1146 | rule := fragment.Rule("modularHiddenAPIStubFlagsFile") |
| 1147 | command := rule.RuleParams.Command |
| 1148 | android.AssertStringDoesContain(t, "check correct rule", command, "hiddenapi list") |
| 1149 | |
| 1150 | // Make sure that the module_lib non-updatable stubs are available for resolving references from |
| 1151 | // the implementation boot dex jars provided by this module. |
| 1152 | android.AssertStringDoesContain(t, "android-non-updatable widest", command, "--dependency-stub-dex="+nonUpdatableModuleLibStubs) |
| 1153 | |
| 1154 | // Make sure that the appropriate non-updatable stubs are available for resolving references from |
| 1155 | // the different API stubs provided by this module. |
| 1156 | android.AssertStringDoesContain(t, "public", command, "--public-stub-classpath="+nonUpdatablePublicStubs) |
| 1157 | android.AssertStringDoesContain(t, "system", command, "--system-stub-classpath="+nonUpdatableSystemStubs) |
| 1158 | android.AssertStringDoesContain(t, "test", command, "--test-stub-classpath="+nonUpdatableTestStubs) |
| 1159 | } |
| 1160 | |
Paul Duffin | a1d6025 | 2021-01-21 18:13:43 +0000 | [diff] [blame] | 1161 | // TODO(b/177892522) - add test for host apex. |