Merge "Move TestPlatformBootclasspath_Fragments to apex package" am: 2eddb50fd5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731416 Change-Id: Ia1f9004d5f214aff94012f95dcaaa840a4babac9
This commit is contained in:
commit
0d2a3ad17d
2 changed files with 112 additions and 112 deletions
|
@ -15,6 +15,8 @@
|
|||
package apex
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
|
@ -31,6 +33,116 @@ var prepareForTestWithPlatformBootclasspath = android.GroupFixturePreparers(
|
|||
PrepareForTestWithApexBuildComponents,
|
||||
)
|
||||
|
||||
func TestPlatformBootclasspath_Fragments(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||
java.FixtureWithLastReleaseApis("foo"),
|
||||
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"],
|
||||
api: {
|
||||
stub_libs: ["foo"],
|
||||
},
|
||||
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,
|
||||
}
|
||||
|
||||
java_sdk_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
public: {
|
||||
enabled: true,
|
||||
},
|
||||
compile_dex: true,
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
|
||||
pbcp := result.Module("platform-bootclasspath", "android_common")
|
||||
info := result.ModuleProvider(pbcp, java.MonolithicHiddenAPIInfoProvider).(java.MonolithicHiddenAPIInfo)
|
||||
|
||||
for _, category := range java.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.FlagsFilesByCategory[category])
|
||||
}
|
||||
|
||||
android.AssertPathsRelativeToTopEquals(t, "stub flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/stub-flags.csv"}, info.StubFlagsPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "annotation flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/annotation-flags.csv"}, info.AnnotationFlagsPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "metadata flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/metadata.csv"}, info.MetadataPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "index flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/index.csv"}, info.IndexPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "all flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/all-flags.csv"}, info.AllFlagsPaths)
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspathDependencies(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
package java
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
|
@ -152,116 +150,6 @@ func TestPlatformBootclasspath(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspath_Fragments(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
PrepareForTestWithJavaSdkLibraryFiles,
|
||||
FixtureWithLastReleaseApis("foo"),
|
||||
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"],
|
||||
api: {
|
||||
stub_libs: ["foo"],
|
||||
},
|
||||
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,
|
||||
}
|
||||
|
||||
java_sdk_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
public: {
|
||||
enabled: true,
|
||||
},
|
||||
compile_dex: true,
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
|
||||
pbcp := result.Module("platform-bootclasspath", "android_common")
|
||||
info := result.ModuleProvider(pbcp, MonolithicHiddenAPIInfoProvider).(MonolithicHiddenAPIInfo)
|
||||
|
||||
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.FlagsFilesByCategory[category])
|
||||
}
|
||||
|
||||
android.AssertPathsRelativeToTopEquals(t, "stub flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/stub-flags.csv"}, info.StubFlagsPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "annotation flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/annotation-flags.csv"}, info.AnnotationFlagsPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "metadata flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/metadata.csv"}, info.MetadataPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "index flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/index.csv"}, info.IndexPaths)
|
||||
android.AssertPathsRelativeToTopEquals(t, "all flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/all-flags.csv"}, info.AllFlagsPaths)
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspathVariant(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
|
|
Loading…
Reference in a new issue