From c7315286bb3abf2a7706400211dccd5e1eaa90ad Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Fri, 10 Jan 2025 15:37:01 -0800 Subject: _test module types shouldn't override user-set test property Android lint considers code "test" code depending on if the --test flag is passed. We pass it by default for *_test module types, but also allow the user to control it via the "lint: { test: true }" property. However, the module types were overriding the user-defined test property if the user-defined one was supplied via a defaults module. Split the test property into two so that modules can use a separate lower priority one from the user-controlled one. Fixes: 358643466 Test: m nothing --no-skip-soong-tests Change-Id: I1b1ef7a73ca9f413aa29e0c6025134fc52dc7caf --- java/robolectric.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'java/robolectric.go') diff --git a/java/robolectric.go b/java/robolectric.go index 6c137ba47..0d18ddf1c 100644 --- a/java/robolectric.go +++ b/java/robolectric.go @@ -20,6 +20,7 @@ import ( "android/soong/android" "android/soong/java/config" "android/soong/tradefed" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) @@ -104,8 +105,6 @@ func (r *robolectricTest) TestSuites() []string { var _ android.TestSuiteModule = (*robolectricTest)(nil) - - func (r *robolectricTest) DepsMutator(ctx android.BottomUpMutatorContext) { r.Library.DepsMutator(ctx) @@ -294,7 +293,7 @@ func RobolectricTestFactory() android.Module { &module.testProperties) module.Module.dexpreopter.isTest = true - module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true) + module.Module.linter.properties.Lint.Test_module_type = proptools.BoolPtr(true) module.testProperties.Test_suites = []string{"robolectric-tests"} -- cgit v1.2.3-59-g8ed1b