|
|
@ -28,7 +28,7 @@ fun findSnippets(dirs: List<String>): List<SnippetData> { |
|
|
|
currentSnippet.clear() |
|
|
|
currentSnippet.clear() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (snippetStart != 0) { |
|
|
|
if (snippetStart != 0) { |
|
|
|
currentSnippet.appendln(line) |
|
|
|
currentSnippet.appendLine(line) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -50,6 +50,24 @@ fun cloneTemplate(template: String, index: Int, content: String): File { |
|
|
|
return tempDir |
|
|
|
return tempDir |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val ignoreTill = java.time.LocalDate.parse("2022-02-01") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun isIgnored(tutorial: String): Boolean { |
|
|
|
|
|
|
|
if (java.time.LocalDate.now() > ignoreTill) return false |
|
|
|
|
|
|
|
return when (tutorial) { |
|
|
|
|
|
|
|
"IGNORED" -> true |
|
|
|
|
|
|
|
else -> false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun maybeFail(tutorial: String, message: String) { |
|
|
|
|
|
|
|
if (!isIgnored(tutorial)) { |
|
|
|
|
|
|
|
throw GradleException(message) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
println("IGNORED ERROR: $message") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalStdlibApi::class) |
|
|
|
@OptIn(ExperimentalStdlibApi::class) |
|
|
|
fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build") { |
|
|
|
fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build") { |
|
|
|
val snippets = findSnippets(dirs) |
|
|
|
val snippets = findSnippets(dirs) |
|
|
@ -83,7 +101,7 @@ fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build") |
|
|
|
if (proc.exitValue() != 0) { |
|
|
|
if (proc.exitValue() != 0) { |
|
|
|
println(proc.inputStream.bufferedReader().readText()) |
|
|
|
println(proc.inputStream.bufferedReader().readText()) |
|
|
|
println(proc.errorStream.bufferedReader().readText()) |
|
|
|
println(proc.errorStream.bufferedReader().readText()) |
|
|
|
throw GradleException("Error in snippet at ${snippet.file}:${snippet.lineNumber}") |
|
|
|
maybeFail(snippet.file.parentFile.name, "Error in snippet at ${snippet.file}:${snippet.lineNumber}") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|