blob: 7c2e52600de858bb7a86083faf57dd8e603104a0 [file] [log] [blame]
Paul Duffin6d448b72021-10-29 12:35:36 +01001// Copyright 2021 Google Inc. All rights reserved.
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
15package java
16
17import (
18 "sort"
19 "strings"
20 "testing"
21
22 "android/soong/android"
23 "github.com/google/blueprint"
24)
25
26func TestPrebuiltApis_SystemModulesCreation(t *testing.T) {
27 result := android.GroupFixturePreparers(
28 prepareForJavaTest,
29 FixtureWithPrebuiltApis(map[string][]string{
30 "31": {},
31 "current": {},
32 }),
33 ).RunTest(t)
34
35 sdkSystemModules := []string{}
36 result.VisitAllModules(func(module blueprint.Module) {
37 name := android.RemoveOptionalPrebuiltPrefix(module.Name())
38 if strings.HasPrefix(name, "sdk_") && strings.HasSuffix(name, "_system_modules") {
39 sdkSystemModules = append(sdkSystemModules, name)
40 }
41 })
42 sort.Strings(sdkSystemModules)
43 expected := []string{
44 // 31 only has public system modules.
45 "sdk_public_31_system_modules",
46
47 // current only has public system modules.
48 "sdk_public_current_system_modules",
49 }
50 sort.Strings(expected)
51 android.AssertArrayString(t, "sdk system modules", expected, sdkSystemModules)
52}