Merge "Prevent non-app/non-test modules from statically including jacocoagent" into tm-dev
This commit is contained in:
@@ -909,6 +909,7 @@ func AndroidAppFactory() android.Module {
|
|||||||
module.Module.dexProperties.Optimize.Shrink = proptools.BoolPtr(true)
|
module.Module.dexProperties.Optimize.Shrink = proptools.BoolPtr(true)
|
||||||
|
|
||||||
module.Module.properties.Instrument = true
|
module.Module.properties.Instrument = true
|
||||||
|
module.Module.properties.Supports_static_instrumentation = true
|
||||||
module.Module.properties.Installable = proptools.BoolPtr(true)
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
module.addHostAndDeviceProperties()
|
module.addHostAndDeviceProperties()
|
||||||
@@ -1028,6 +1029,7 @@ func AndroidTestFactory() android.Module {
|
|||||||
module.Module.dexProperties.Optimize.EnabledByDefault = true
|
module.Module.dexProperties.Optimize.EnabledByDefault = true
|
||||||
|
|
||||||
module.Module.properties.Instrument = true
|
module.Module.properties.Instrument = true
|
||||||
|
module.Module.properties.Supports_static_instrumentation = true
|
||||||
module.Module.properties.Installable = proptools.BoolPtr(true)
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true)
|
module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true)
|
||||||
module.appProperties.AlwaysPackageNativeLibs = true
|
module.appProperties.AlwaysPackageNativeLibs = true
|
||||||
|
@@ -170,6 +170,9 @@ type CommonProperties struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Instrument bool `blueprint:"mutated"`
|
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.
|
// List of files to include in the META-INF/services folder of the resulting jar.
|
||||||
Services []string `android:"path,arch_variant"`
|
Services []string `android:"path,arch_variant"`
|
||||||
@@ -605,7 +608,8 @@ func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (j *Module) shouldInstrumentStatic(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().IsEnvTrue("EMMA_INSTRUMENT_STATIC") ||
|
||||||
ctx.Config().UnbundledBuild())
|
ctx.Config().UnbundledBuild())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user