@@ -37,6 +37,7 @@ class InstrumentPlugin implements Plugin<Project> {
3737 @Override
3838 void apply (Project project ) {
3939 InstrumentExtension extension = project. extensions. create(' instrument' , InstrumentExtension )
40+ project. configurations. register(INSTRUMENT_PLUGIN_CLASSPATH_CONFIGURATION )
4041
4142 project. pluginManager. withPlugin(" java" ) { configurePostCompilationInstrumentation(" java" , project, extension) }
4243 project. pluginManager. withPlugin(" kotlin" ) { configurePostCompilationInstrumentation(" kotlin" , project, extension) }
@@ -68,21 +69,12 @@ class InstrumentPlugin implements Plugin<Project> {
6869 // - compileKotlin,
6970 // - compileScala,
7071 // - compileGroovy,
71- def compileTasks = project. tasks. withType(AbstractCompile ). matching {
72+ project. tasks. withType(AbstractCompile ). matching {
7273 it. name == compileTaskName && ! it. source. isEmpty()
73- }
74-
75- // TODO eager config
76- project. configurations. configureEach { config ->
77- if (config. name == INSTRUMENT_PLUGIN_CLASSPATH_CONFIGURATION ) {
78- logger. info(' [InstrumentPlugin] instrumentPluginClasspath configuration was created' )
79- compileTasks. configureEach {
80- it. inputs. files(config)
81- }
82- }
83- }
74+ }. configureEach {
75+ logger. info(' [InstrumentPlugin] Applying instrumentPluginClasspath configuration as compile task input' )
76+ it. inputs. files(project. configurations. named(INSTRUMENT_PLUGIN_CLASSPATH_CONFIGURATION ))
8477
85- compileTasks. configureEach {
8678 if (it. source. isEmpty()) {
8779 logger. debug(" [InstrumentPlugin] Skipping $compileTaskName for source set $sourceSetName as it has no source files" )
8880 return
@@ -192,8 +184,7 @@ abstract class InstrumentPostProcessingAction implements Action<AbstractCompile>
192184 workQueue(). submit(InstrumentAction . class, parameters -> {
193185 parameters. buildStartedTime. set(invocationDetails. buildStartedTime)
194186 parameters. pluginClassPath. from(
195- project. configurations. findByName(InstrumentPlugin . INSTRUMENT_PLUGIN_CLASSPATH_CONFIGURATION )
196- ?: project. files()
187+ project. configurations. named(InstrumentPlugin . INSTRUMENT_PLUGIN_CLASSPATH_CONFIGURATION )
197188 )
198189 parameters. plugins. set(postCompileAction. plugins)
199190 parameters. instrumentingClassPath. setFrom(postCompileAction. instrumentingClassPath)
0 commit comments