summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rwxr-xr-xjava/app.go2
-rw-r--r--java/base.go6
-rw-r--r--java/kotlin.go1
-rw-r--r--java/kotlin_test.go8
4 files changed, 16 insertions, 1 deletions
diff --git a/java/app.go b/java/app.go
index 2b52eab15..d0a1db031 100755
--- a/java/app.go
+++ b/java/app.go
@@ -900,6 +900,7 @@ func AndroidAppFactory() android.Module {
module.Module.dexProperties.Optimize.Shrink = proptools.BoolPtr(true)
module.Module.properties.Instrument = true
+ module.Module.properties.Supports_static_instrumentation = true
module.Module.properties.Installable = proptools.BoolPtr(true)
module.addHostAndDeviceProperties()
@@ -1019,6 +1020,7 @@ func AndroidTestFactory() android.Module {
module.Module.dexProperties.Optimize.EnabledByDefault = true
module.Module.properties.Instrument = true
+ module.Module.properties.Supports_static_instrumentation = true
module.Module.properties.Installable = proptools.BoolPtr(true)
module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true)
module.appProperties.AlwaysPackageNativeLibs = true
diff --git a/java/base.go b/java/base.go
index 245ffbb3d..ff1ce8516 100644
--- a/java/base.go
+++ b/java/base.go
@@ -170,6 +170,9 @@ type CommonProperties struct {
}
Instrument bool `blueprint:"mutated"`
+ // If true, then the module supports statically including the jacocoagent
+ // into the library.
+ Supports_static_instrumentation bool `blueprint:"mutated"`
// List of files to include in the META-INF/services folder of the resulting jar.
Services []string `android:"path,arch_variant"`
@@ -602,7 +605,8 @@ func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool {
}
func (j *Module) shouldInstrumentStatic(ctx android.BaseModuleContext) bool {
- return j.shouldInstrument(ctx) &&
+ return j.properties.Supports_static_instrumentation &&
+ j.shouldInstrument(ctx) &&
(ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_STATIC") ||
ctx.Config().UnbundledBuild())
}
diff --git a/java/kotlin.go b/java/kotlin.go
index eff5bb53f..903c6249b 100644
--- a/java/kotlin.go
+++ b/java/kotlin.go
@@ -175,6 +175,7 @@ func kotlinKapt(ctx android.ModuleContext, srcJarOutputFile, resJarOutputFile an
var deps android.Paths
deps = append(deps, flags.kotlincClasspath...)
+ deps = append(deps, flags.kotlincDeps...)
deps = append(deps, srcJars...)
deps = append(deps, flags.processorPath...)
deps = append(deps, commonSrcFiles...)
diff --git a/java/kotlin_test.go b/java/kotlin_test.go
index f9ff98229..435d78294 100644
--- a/java/kotlin_test.go
+++ b/java/kotlin_test.go
@@ -325,6 +325,7 @@ func TestKotlinCompose(t *testing.T) {
java_library {
name: "withcompose",
srcs: ["a.kt"],
+ plugins: ["plugin"],
static_libs: ["androidx.compose.runtime_runtime"],
}
@@ -332,6 +333,10 @@ func TestKotlinCompose(t *testing.T) {
name: "nocompose",
srcs: ["a.kt"],
}
+
+ java_plugin {
+ name: "plugin",
+ }
`)
buildOS := result.Config.BuildOS.String()
@@ -346,6 +351,9 @@ func TestKotlinCompose(t *testing.T) {
android.AssertStringDoesContain(t, "missing compose compiler plugin",
withCompose.VariablesForTestsRelativeToTop()["kotlincFlags"], "-Xplugin="+composeCompiler.String())
+ android.AssertStringListContains(t, "missing kapt compose compiler dependency",
+ withCompose.Rule("kapt").Implicits.Strings(), composeCompiler.String())
+
android.AssertStringListDoesNotContain(t, "unexpected compose compiler dependency",
noCompose.Rule("kotlinc").Implicits.Strings(), composeCompiler.String())