satayev | 333a173 | 2021-05-17 21:35:26 +0100 | [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 ( |
| 18 | "testing" |
| 19 | |
| 20 | "android/soong/android" |
| 21 | "android/soong/java" |
| 22 | ) |
| 23 | |
| 24 | var prepareForTestWithSystemserverclasspathFragment = android.GroupFixturePreparers( |
| 25 | java.PrepareForTestWithDexpreopt, |
| 26 | PrepareForTestWithApexBuildComponents, |
| 27 | ) |
| 28 | |
| 29 | func TestSystemserverclasspathFragmentContents(t *testing.T) { |
| 30 | result := android.GroupFixturePreparers( |
| 31 | prepareForTestWithSystemserverclasspathFragment, |
| 32 | prepareForTestWithMyapex, |
| 33 | ).RunTestWithBp(t, ` |
| 34 | apex { |
| 35 | name: "myapex", |
| 36 | key: "myapex.key", |
| 37 | systemserverclasspath_fragments: [ |
| 38 | "mysystemserverclasspathfragment", |
| 39 | ], |
| 40 | updatable: false, |
| 41 | } |
| 42 | |
| 43 | apex_key { |
| 44 | name: "myapex.key", |
| 45 | public_key: "testkey.avbpubkey", |
| 46 | private_key: "testkey.pem", |
| 47 | } |
| 48 | |
| 49 | java_library { |
| 50 | name: "foo", |
| 51 | srcs: ["b.java"], |
| 52 | installable: true, |
| 53 | apex_available: [ |
| 54 | "myapex", |
| 55 | ], |
| 56 | } |
| 57 | |
| 58 | systemserverclasspath_fragment { |
| 59 | name: "mysystemserverclasspathfragment", |
| 60 | contents: [ |
| 61 | "foo", |
| 62 | ], |
| 63 | apex_available: [ |
| 64 | "myapex", |
| 65 | ], |
| 66 | } |
| 67 | `) |
| 68 | |
| 69 | ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ |
| 70 | "etc/classpaths/mysystemserverclasspathfragment.pb", |
| 71 | "javalib/foo.jar", |
| 72 | }) |
| 73 | |
| 74 | java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ |
| 75 | `myapex.key`, |
| 76 | `mysystemserverclasspathfragment`, |
| 77 | }) |
| 78 | } |