Skip to content

Commit

Permalink
fix: correctly support Gradle's configuration cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lppedd authored and ftomassetti committed Apr 11, 2024
1 parent 31183f1 commit 368f6b1
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import javax.inject.Inject
*/
@NonNullApi
@CacheableTask
public abstract class AntlrKotlinTask @Inject constructor(
private val deleter: Deleter,
private val projectLayout: ProjectLayout,
private val workerProcessBuilderFactory: WorkerProcessFactory,
) : SourceTask() {
public abstract class AntlrKotlinTask : SourceTask() {
private var sourceSetDirectories: FileCollection? = null

/**
Expand Down Expand Up @@ -100,6 +96,19 @@ public abstract class AntlrKotlinTask @Inject constructor(
@get:InputFiles
protected val stableSources: FileCollection = project.files({ this.source })

// Note(Edoardo): we had to move injected properties from
// constructor injection to method injection to correctly
// support Gradle's configuration cache

@get:Inject
protected abstract val deleter: Deleter

@get:Inject
protected abstract val projectLayout: ProjectLayout

@get:Inject
protected abstract val workerProcessBuilderFactory: WorkerProcessFactory

/**
* Generate the parsers.
*/
Expand Down

0 comments on commit 368f6b1

Please sign in to comment.