InstrumentationParameters

Added in 4.2.0

interface InstrumentationParameters : Serializable


Parameters for a registered AsmClassVisitorFactory.

Build authors should extend this interface with any additional inputs needed for their ASM visitor, or use InstrumentationParameters.None if no parameters are needed.

The parameters will be instantiated using ObjectFactory.newInstance, configured using the given config when registering the visitor, and injected to the factory on instantiation.

The parameters will be used as Gradle inputs. Make sure to declare the inputs by annotating them using Gradle's input annotations so that it's compatible with Gradle's up-to-date checks.

Example:

interface ParametersImpl : InstrumentationParameters {
@get:Input
val intValue: Property<Int>

@get:Internal
val listOfStrings: ListProperty<String>
}

androidComponents {
onVariants(selector().all(), {
instrumentation.transformClassesWith(AsmClassVisitorFactoryImpl.class,
InstrumentationScope.Project) { params ->
// parameters configuration
params.intValue.set(1)
params.listOfStrings.set(listOf("a", "b"))
}
})
}

Summary