summaryrefslogtreecommitdiff
path: root/java/bootclasspath_fragment.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2022-03-31 15:42:30 +0100
committer Paul Duffin <paulduffin@google.com> 2022-05-27 16:17:44 +0100
commitc15b9e99e5e208410a1f1c3766c97125e63c22b3 (patch)
treed18dea6fe0ace1b08c6057843cd3681ad320aa19 /java/bootclasspath_fragment.go
parent0e3d36c58291c6b71fd5523624687bbf3394fa8b (diff)
bootclasspath_fragment: Add test specific module type
This is needed to allow the behavior of the bootclasspath_fragment to be tweaked for test fragments. Bug: 194063708 Test: m nothing Change-Id: Iee5c09d5b580d088ba081d95a788dbde883078ed
Diffstat (limited to 'java/bootclasspath_fragment.go')
-rw-r--r--java/bootclasspath_fragment.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 0345aadfd..11634fabf 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -42,6 +42,7 @@ func init() {
func registerBootclasspathFragmentBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("bootclasspath_fragment", bootclasspathFragmentFactory)
+ ctx.RegisterModuleType("bootclasspath_fragment_test", testBootclasspathFragmentFactory)
ctx.RegisterModuleType("prebuilt_bootclasspath_fragment", prebuiltBootclasspathFragmentFactory)
}
@@ -227,6 +228,9 @@ type BootclasspathFragmentModule struct {
android.SdkBase
ClasspathFragmentBase
+ // True if this fragment is for testing purposes.
+ testFragment bool
+
properties bootclasspathFragmentProperties
sourceOnlyProperties SourceOnlyBootclasspathProperties
@@ -298,6 +302,12 @@ func bootclasspathFragmentFactory() android.Module {
return m
}
+func testBootclasspathFragmentFactory() android.Module {
+ m := bootclasspathFragmentFactory().(*BootclasspathFragmentModule)
+ m.testFragment = true
+ return m
+}
+
// bootclasspathFragmentInitContentsFromImage will initialize the contents property from the image_name if
// necessary.
func bootclasspathFragmentInitContentsFromImage(ctx android.EarlyModuleContext, m *BootclasspathFragmentModule) {
@@ -815,6 +825,11 @@ func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.Modul
return input
}
+// isTestFragment returns true if the current module is a test bootclasspath_fragment.
+func (b *BootclasspathFragmentModule) isTestFragment() bool {
+ return b.testFragment
+}
+
// produceHiddenAPIOutput produces the hidden API all-flags.csv file (and supporting files)
// for the fragment as well as encoding the flags in the boot dex jars.
func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {