platform_bootclasspath: aggregate hidden API flag files from fragments

Aggregates hidden API flag files from the bootclasspath_fragments which
will allow the hidden API flag files in frameworks/base/boot/hiddenapi
to be modularized and moved to the appropriate repo.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
      also verified that changes to the fragment provided files do
      affect the monolithic files.
Change-Id: Ifce14c9ef24c58c7ab1085475d85b61cfbfefecd
This commit is contained in:
Paul Duffin
2021-04-08 23:01:37 +01:00
parent 192131e36b
commit 9b381ef2b8
4 changed files with 128 additions and 4 deletions

View File

@@ -15,6 +15,8 @@
package java
import (
"fmt"
"strings"
"testing"
"android/soong/android"
@@ -132,6 +134,96 @@ func TestPlatformBootclasspath(t *testing.T) {
})
}
func TestPlatformBootclasspath_Fragments(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
android.FixtureWithRootAndroidBp(`
platform_bootclasspath {
name: "platform-bootclasspath",
fragments: [
{module:"bar-fragment"},
],
hidden_api: {
unsupported: [
"unsupported.txt",
],
removed: [
"removed.txt",
],
max_target_r_low_priority: [
"max-target-r-low-priority.txt",
],
max_target_q: [
"max-target-q.txt",
],
max_target_p: [
"max-target-p.txt",
],
max_target_o_low_priority: [
"max-target-o-low-priority.txt",
],
blocked: [
"blocked.txt",
],
unsupported_packages: [
"unsupported-packages.txt",
],
},
}
bootclasspath_fragment {
name: "bar-fragment",
contents: ["bar"],
hidden_api: {
unsupported: [
"bar-unsupported.txt",
],
removed: [
"bar-removed.txt",
],
max_target_r_low_priority: [
"bar-max-target-r-low-priority.txt",
],
max_target_q: [
"bar-max-target-q.txt",
],
max_target_p: [
"bar-max-target-p.txt",
],
max_target_o_low_priority: [
"bar-max-target-o-low-priority.txt",
],
blocked: [
"bar-blocked.txt",
],
unsupported_packages: [
"bar-unsupported-packages.txt",
],
},
}
java_library {
name: "bar",
srcs: ["a.java"],
system_modules: "none",
sdk_version: "none",
compile_dex: true,
}
`),
).RunTest(t)
pbcp := result.Module("platform-bootclasspath", "android_common")
info := result.ModuleProvider(pbcp, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo)
for _, category := range hiddenAPIFlagFileCategories {
name := category.propertyName
message := fmt.Sprintf("category %s", name)
filename := strings.ReplaceAll(name, "_", "-")
expected := []string{fmt.Sprintf("%s.txt", filename), fmt.Sprintf("bar-%s.txt", filename)}
android.AssertPathsRelativeToTopEquals(t, message, expected, info.categoryToPaths[category])
}
}
func TestPlatformBootclasspathVariant(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,