aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2022-04-12 18:20:14 +0100
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2022-07-12 12:01:00 +0000
commite2c7fd9b8cdde214c5d6d4addee1cd48dd5cab0a (patch)
tree69a6e2b3a0ef0adcd2b7ce5bedabec8c578e231b
parentab9fbab7ef165c1312f540899ab00301fab0de81 (diff)
downloadsoong-e2c7fd9b8cdde214c5d6d4addee1cd48dd5cab0a.tar.gz
bootclasspath_fragment: Treat some specific modules as test
Treats bootclasspath_fragment modules that have not yet been converted to test modules as if they were test modules. This is a temporary work around to ease the migration to bootclasspath_fragment_test modules and is expected to be reverted. Bug: 194063708 Test: m nothing Change-Id: I093fbec4e926719b644c64ebfc63f9e3070e28db (cherry picked from commit ff9b6faba2b9a949289c70657db87c0b1790cc07) Merged-In: I093fbec4e926719b644c64ebfc63f9e3070e28db
-rw-r--r--java/bootclasspath_fragment.go17
-rw-r--r--java/bootclasspath_fragment_test.go22
2 files changed, 38 insertions, 1 deletions
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 3dce64095..6e9492ad4 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -835,7 +835,22 @@ func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.Modul
// isTestFragment returns true if the current module is a test bootclasspath_fragment.
func (b *BootclasspathFragmentModule) isTestFragment() bool {
- return b.testFragment
+ if b.testFragment {
+ return true
+ }
+
+ // TODO(b/194063708): Once test fragments all use bootclasspath_fragment_test
+ // Some temporary exceptions until all test fragments use the
+ // bootclasspath_fragment_test module type.
+ name := b.BaseModuleName()
+ if strings.HasPrefix(name, "test_") {
+ return true
+ }
+ if name == "apex.apexd_test_bootclasspath-fragment" {
+ return true
+ }
+
+ return false
}
// produceHiddenAPIOutput produces the hidden API all-flags.csv file (and supporting files)
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index 2307ce02b..8ffe99a77 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -293,6 +293,22 @@ func TestBootclasspathFragment_Test(t *testing.T) {
},
}
+ bootclasspath_fragment {
+ name: "test_fragment",
+ contents: ["mysdklibrary"],
+ hidden_api: {
+ split_packages: [],
+ },
+ }
+
+ bootclasspath_fragment {
+ name: "apex.apexd_test_bootclasspath-fragment",
+ contents: ["mysdklibrary"],
+ hidden_api: {
+ split_packages: [],
+ },
+ }
+
bootclasspath_fragment_test {
name: "a_test_fragment",
contents: ["mysdklibrary"],
@@ -314,6 +330,12 @@ func TestBootclasspathFragment_Test(t *testing.T) {
fragment := result.Module("myfragment", "android_common").(*BootclasspathFragmentModule)
android.AssertBoolEquals(t, "not a test fragment", false, fragment.isTestFragment())
+ fragment = result.Module("test_fragment", "android_common").(*BootclasspathFragmentModule)
+ android.AssertBoolEquals(t, "is a test fragment by prefix", true, fragment.isTestFragment())
+
fragment = result.Module("a_test_fragment", "android_common").(*BootclasspathFragmentModule)
android.AssertBoolEquals(t, "is a test fragment by type", true, fragment.isTestFragment())
+
+ fragment = result.Module("apex.apexd_test_bootclasspath-fragment", "android_common").(*BootclasspathFragmentModule)
+ android.AssertBoolEquals(t, "is a test fragment by name", true, fragment.isTestFragment())
}