summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjava/app.go4
-rw-r--r--java/java.go4
-rw-r--r--java/lint.go8
-rw-r--r--java/robolectric.go3
4 files changed, 12 insertions, 7 deletions
diff --git a/java/app.go b/java/app.go
index 3c8fcd382..7a45855e0 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1055,7 +1055,7 @@ func AndroidTestFactory() android.Module {
module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true)
module.appProperties.AlwaysPackageNativeLibs = true
module.Module.dexpreopter.isTest = true
- module.Module.linter.test = true
+ module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true)
module.addHostAndDeviceProperties()
module.AddProperties(
@@ -1108,7 +1108,7 @@ func AndroidTestHelperAppFactory() android.Module {
module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true)
module.appProperties.AlwaysPackageNativeLibs = true
module.Module.dexpreopter.isTest = true
- module.Module.linter.test = true
+ module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true)
module.addHostAndDeviceProperties()
module.AddProperties(
diff --git a/java/java.go b/java/java.go
index 481c625f3..77ab40279 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1262,7 +1262,7 @@ func TestFactory() android.Module {
module.Module.properties.Installable = proptools.BoolPtr(true)
module.Module.dexpreopter.isTest = true
- module.Module.linter.test = true
+ module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true)
android.InitSdkAwareModule(module)
InitJavaModule(module, android.HostAndDeviceSupported)
@@ -1278,7 +1278,7 @@ func TestHelperLibraryFactory() android.Module {
module.Module.properties.Installable = proptools.BoolPtr(true)
module.Module.dexpreopter.isTest = true
- module.Module.linter.test = true
+ module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true)
InitJavaModule(module, android.HostAndDeviceSupported)
return module
diff --git a/java/lint.go b/java/lint.go
index c27ca9821..8f14bbee8 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -61,6 +61,11 @@ type LintProperties struct {
// If true, baselining updatability lint checks (e.g. NewApi) is prohibited. Defaults to false.
Strict_updatability_linting *bool
+
+ // Treat the code in this module as test code for @VisibleForTesting enforcement.
+ // This will be true by default for test module types, false otherwise.
+ // If soong gets support for testonly, this flag should be replaced with that.
+ Test *bool
}
}
@@ -74,7 +79,6 @@ type linter struct {
classpath android.Paths
classes android.Path
extraLintCheckJars android.Paths
- test bool
library bool
minSdkVersion int
targetSdkVersion int
@@ -229,7 +233,7 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.Ru
if l.library {
cmd.Flag("--library")
}
- if l.test {
+ if proptools.BoolDefault(l.properties.Lint.Test, false) {
cmd.Flag("--test")
}
if l.manifest != nil {
diff --git a/java/robolectric.go b/java/robolectric.go
index f71952172..71ffdb175 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -23,6 +23,7 @@ import (
"android/soong/android"
"android/soong/java/config"
"android/soong/tradefed"
+ "github.com/google/blueprint/proptools"
)
func init() {
@@ -344,7 +345,7 @@ func RobolectricTestFactory() android.Module {
&module.testProperties)
module.Module.dexpreopter.isTest = true
- module.Module.linter.test = true
+ module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true)
module.testProperties.Test_suites = []string{"robolectric-tests"}