summaryrefslogtreecommitdiff
path: root/sh/sh_binary.go
diff options
context:
space:
mode:
author Ronald Braunstein <rbraunstein@google.com> 2024-10-29 11:09:00 -0700
committer Ronald Braunstein <rbraunstein@google.com> 2024-10-29 11:12:22 -0700
commit9820408a86c252fc8ea86772aefacc2b179a1034 (patch)
tree5d6f3f4908ef6e8de15c58b7eaa60b9a5e786ddb /sh/sh_binary.go
parent0ba7034bf723aaf35db29811f6709aec5828b487 (diff)
Add defaults for sh_ rules.
I was helping someone who wanted to use the same set of dependencies in multiple sh_test rules and we realized that there are no defaults on sh_test, sh_binary, etc. (see vts_ltp_test*) Bug: 277261121 # Related to this bug Change-Id: I81084771432e22e3de230511bdaba1b79a171406 Test: go test ./
Diffstat (limited to 'sh/sh_binary.go')
-rw-r--r--sh/sh_binary.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 9c0db73ba..853f3d368 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -45,6 +45,7 @@ func registerShBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("sh_binary_host", ShBinaryHostFactory)
ctx.RegisterModuleType("sh_test", ShTestFactory)
ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
+ ctx.RegisterModuleType("sh_defaults", ShDefaultsFactory)
}
// Test fixture preparer that will register most sh build components.
@@ -167,6 +168,7 @@ type TestProperties struct {
type ShBinary struct {
android.ModuleBase
+ android.DefaultableModuleBase
properties shBinaryProperties
@@ -548,6 +550,7 @@ func ShBinaryFactory() android.Module {
module := &ShBinary{}
initShBinaryModule(module)
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
return module
}
@@ -557,6 +560,7 @@ func ShBinaryHostFactory() android.Module {
module := &ShBinary{}
initShBinaryModule(module)
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
return module
}
@@ -567,6 +571,7 @@ func ShTestFactory() android.Module {
module.AddProperties(&module.testProperties)
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
return module
}
@@ -581,6 +586,21 @@ func ShTestHostFactory() android.Module {
}
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
+ return module
+}
+
+type ShDefaults struct {
+ android.ModuleBase
+ android.DefaultsModuleBase
+}
+
+func ShDefaultsFactory() android.Module {
+ module := &ShDefaults{}
+
+ module.AddProperties(&shBinaryProperties{}, &TestProperties{})
+ android.InitDefaultsModule(module)
+
return module
}