@@ -11,6 +11,7 @@ import org.gradle.api.attributes.java.TargetJvmEnvironment.TARGET_JVM_ENVIRONMEN
11
11
import org.gradle.api.attributes.plugin.GradlePluginApiVersion
12
12
import org.gradle.api.attributes.plugin.GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE
13
13
import org.gradle.api.file.DuplicatesStrategy
14
+ import org.gradle.api.file.RegularFileProperty
14
15
import org.gradle.api.tasks.*
15
16
import java.io.File
16
17
import java.time.ZonedDateTime
@@ -176,8 +177,7 @@ fun Copy.configureCreateVersionClassTask(
176
177
* Using a template file, the plugin's version constants & other dependency versions
177
178
* are automatically injected into the README.
178
179
*/
179
- open class GenerateReadme : DefaultTask () {
180
-
180
+ abstract class GenerateReadme : DefaultTask () {
181
181
companion object {
182
182
private val PLACEHOLDER_REGEX = Regex (" \\ \$ \\ {(.+)}" )
183
183
private val EXTERNAL_DEP_REGEX = Regex (" libs\\ .(.+)" )
@@ -204,18 +204,19 @@ open class GenerateReadme : DefaultTask() {
204
204
""" .trimIndent()
205
205
}
206
206
207
- @InputFile
208
- lateinit var inputTemplateFile: File
207
+ @get: InputFile
208
+ abstract val inputTemplateFile: RegularFileProperty
209
209
210
- @OutputFile
211
- lateinit var outputFile: File
210
+ @get: OutputFile
211
+ abstract val outputFile: RegularFileProperty
212
212
213
213
@TaskAction
214
214
fun doWork () {
215
- val templateText = inputTemplateFile.readText()
215
+ val templateText = inputTemplateFile.asFile.get(). readText()
216
216
val constants = parseConstantsFile()
217
217
val replacedText = replacePlaceholdersInTemplate(templateText, constants)
218
- outputFile.writeText(replacedText)
218
+
219
+ outputFile.asFile.get().writeText(replacedText)
219
220
}
220
221
221
222
/* Private */
0 commit comments