Skip to content

Commit df7febe

Browse files
committed
accept "newer" types
1 parent 2a6bad2 commit df7febe

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.gradle.api.file.RegularFile
1212
import org.gradle.api.file.RegularFileProperty
1313
import org.gradle.api.provider.MapProperty
1414
import org.gradle.api.provider.Property
15+
import org.gradle.api.provider.Provider
1516
import java.io.File
1617

1718
/**
@@ -106,7 +107,19 @@ abstract class OpenApiProcessorExtension(private val project: Project): OpenApiP
106107
* set apiPath.
107108
*/
108109
fun apiPath(apiPath: String) {
109-
this.api.fileValue(File(apiPath))
110+
api.fileValue(File(apiPath))
111+
}
112+
113+
fun apiPath(apiPath: File) {
114+
api.fileValue(apiPath)
115+
}
116+
117+
fun apiPath(apiPath: RegularFile) {
118+
api.value(apiPath)
119+
}
120+
121+
fun apiPath(apiPath: Provider<RegularFile>) {
122+
api.value(apiPath.get())
110123
}
111124

112125
/**

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,16 @@ open class Processor(configName: String): ProcessorBase() {
115115
}
116116

117117
fun prop(key: String, value: Any) {
118-
if (value is RegularFile) {
119-
other[key] = value.toString()
120-
} else {
121-
other[key] = value
118+
when (value) {
119+
is RegularFile -> {
120+
other[key] = value.toString()
121+
}
122+
is Provider<*> -> {
123+
prop(key, value.get())
124+
}
125+
else -> {
126+
other[key] = value
127+
}
122128
}
123129
}
124130

0 commit comments

Comments
 (0)