Skip to content

Commit b6a126d

Browse files
committed
log task classpath
1 parent 33d5b6c commit b6a126d

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/main/kotlin/io/openapiprocessor/gradle/OpenApiProcessorExtension.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import java.io.File
3939
* ...
4040
*
4141
* checkUpdates "never"|"daily"|"always"
42+
* logClasspath true|false
4243
* }
4344
* </pre>
4445
*/
@@ -55,6 +56,11 @@ abstract class OpenApiProcessorExtension(project: Project, objects: ObjectFactor
5556
*/
5657
val checkUpdates: Property<String> = project.objects.property(String::class.java)
5758

59+
/**
60+
* Log the classpath of a processor task. Default is false.
61+
*/
62+
val logClasspath: Property<Boolean> = project.objects.property(Boolean::class.java)
63+
5864
/**
5965
* properties of the nested processor configurations by processor name, e.g.
6066
* <pre>
@@ -79,6 +85,7 @@ abstract class OpenApiProcessorExtension(project: Project, objects: ObjectFactor
7985

8086
init {
8187
checkUpdates.set("never")
88+
logClasspath.set(false)
8289
}
8390

8491
/**

src/main/kotlin/io/openapiprocessor/gradle/OpenApiProcessorPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class OpenApiProcessorPlugin: Plugin<Project> {
136136

137137
task.getRootDir().set(project.rootDir.absolutePath)
138138
task.getCheckUpdates().set(extension.checkUpdates)
139+
task.getLogClasspath().set(extension.logClasspath)
139140
task.getProcessorName().set(processor.name)
140141
task.getProcessorProps().set(processor.other)
141142

src/main/kotlin/io/openapiprocessor/gradle/OpenApiProcessorTask.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ abstract class OpenApiProcessorTask: DefaultTask() {
8686
@Internal
8787
abstract fun getCheckUpdates(): Property<String>
8888

89+
@Internal
90+
abstract fun getLogClasspath(): Property<Boolean>
91+
8992
@Internal
9093
abstract fun getRootDir(): Property<String>
9194

@@ -97,6 +100,13 @@ abstract class OpenApiProcessorTask: DefaultTask() {
97100
*/
98101
@TaskAction
99102
fun runProcessor() {
103+
if (getLogClasspath().get()) {
104+
logger.lifecycle("classpath of processor ${getProcessorName().get()}:")
105+
getDependencies().files.forEach { file ->
106+
logger.lifecycle(" - ${file.name}")
107+
}
108+
}
109+
100110
val theRootDir = getRootDir()
101111
val theCheckUpdates = getCheckUpdates()
102112
val theProcessorName = getProcessorName()

0 commit comments

Comments
 (0)