diff options
author | 2022-08-17 15:22:18 +0000 | |
---|---|---|
committer | 2022-08-17 15:22:18 +0000 | |
commit | 852d0c48593fb2a17d301d7274edac907e8e194f (patch) | |
tree | b47943204e5e9ca140d7074daa5677858b6d5425 /android/module.go | |
parent | b2f584ba5855a016e66fc951d405655f74114a80 (diff) | |
parent | 0ac5a431a98d6f0fbc9434d4c7955981117f781f (diff) |
Merge "Move common test_options properties into the android package"
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/android/module.go b/android/module.go index 450dba997..a75a3cc8e 100644 --- a/android/module.go +++ b/android/module.go @@ -936,6 +936,20 @@ type distProperties struct { Dists []Dist `android:"arch_variant"` } +// CommonTestOptions represents the common `test_options` properties in +// Android.bp. +type CommonTestOptions struct { + // If the test is a hostside (no device required) unittest that shall be run + // during presubmit check. + Unit_test *bool +} + +// SetAndroidMkEntries sets AndroidMkEntries according to the value of base +// `test_options`. +func (t *CommonTestOptions) SetAndroidMkEntries(entries *AndroidMkEntries) { + entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", Bool(t.Unit_test)) +} + // The key to use in TaggedDistFiles when a Dist structure does not specify a // tag property. This intentionally does not use "" as the default because that // would mean that an empty tag would have a different meaning when used in a dist @@ -1095,7 +1109,7 @@ func InitAndroidModule(m Module) { // property structs for architecture-specific versions of generic properties tagged with // `android:"arch_variant"`. // -// InitAndroidModule should not be called if InitAndroidArchModule was called. +// InitAndroidModule should not be called if InitAndroidArchModule was called. func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) { InitAndroidModule(m) @@ -1336,30 +1350,30 @@ func productVariableConfigEnableLabels(ctx *topDownMutatorContext) []bazel.Label // // For example: // -// import ( -// "android/soong/android" -// ) +// import ( +// "android/soong/android" +// ) // -// type myModule struct { -// android.ModuleBase -// properties struct { -// MyProperty string -// } -// } +// type myModule struct { +// android.ModuleBase +// properties struct { +// MyProperty string +// } +// } // -// func NewMyModule() android.Module { -// m := &myModule{} -// m.AddProperties(&m.properties) -// android.InitAndroidModule(m) -// return m -// } +// func NewMyModule() android.Module { +// m := &myModule{} +// m.AddProperties(&m.properties) +// android.InitAndroidModule(m) +// return m +// } // -// func (m *myModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { -// // Get the CPU architecture for the current build variant. -// variantArch := ctx.Arch() +// func (m *myModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { +// // Get the CPU architecture for the current build variant. +// variantArch := ctx.Arch() // -// // ... -// } +// // ... +// } type ModuleBase struct { // Putting the curiously recurring thing pointing to the thing that contains // the thing pattern to good use. |