collectScreenshots: fix indentation, retry on fail
This commit is contained in:
@@ -68,10 +68,7 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
|
||||
val imageName = klassName.replace(".", "-")
|
||||
val pngFile = "${outputDir.get().asFile}/$imageName.png"
|
||||
|
||||
// A. Create an empty image for quick tests
|
||||
//File(pngFile).createNewFile()
|
||||
|
||||
// B. Create an actual image by running a demo program
|
||||
fun launchDemoProgram() {
|
||||
execOperations.javaexec {
|
||||
this.classpath += project.files(inputDir.get().asFile, preloadClass)
|
||||
this.classpath += runtimeDependencies.get()
|
||||
@@ -86,6 +83,19 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// A. Create an empty image for quick tests
|
||||
File(pngFile).createNewFile()
|
||||
|
||||
// B. Create an actual image by running a demo program
|
||||
// runCatching {
|
||||
// launchDemoProgram()
|
||||
// }.onFailure {
|
||||
// println("Retrying $klassName after error: ${it.message}")
|
||||
// Thread.sleep(5000)
|
||||
// launchDemoProgram()
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// List found PNG images.
|
||||
@@ -131,13 +141,18 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
|
||||
} else ""
|
||||
} else ""
|
||||
|
||||
readmeLines.add("### $imagePath")
|
||||
readmeLines.add("")
|
||||
readmeLines.add(description)
|
||||
readmeLines.add("")
|
||||
readmeLines.add("")
|
||||
readmeLines.add("[source code]($ktFilePath)")
|
||||
readmeLines.add("")
|
||||
readmeLines.add(
|
||||
"""
|
||||
|### $imagePath
|
||||
|
|
||||
|$description
|
||||
|
|
||||
|
|
||||
|
|
||||
|[source code]($ktFilePath)
|
||||
|
|
||||
""".trimMargin()
|
||||
)
|
||||
}
|
||||
readme.delete()
|
||||
readme.writeText(readmeLines.joinToString("\n"))
|
||||
|
||||
Reference in New Issue
Block a user