Browse Source

Selective tutorial check ignore (#1716)

pull/1719/head
Nikolay Igotti 3 years ago committed by GitHub
parent
commit
c427f7c2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      tutorials/checker/build.gradle.kts
  2. 2
      tutorials/checker/gradle/wrapper/gradle-wrapper.properties

22
tutorials/checker/build.gradle.kts

@ -28,7 +28,7 @@ fun findSnippets(dirs: List<String>): List<SnippetData> {
currentSnippet.clear()
} else {
if (snippetStart != 0) {
currentSnippet.appendln(line)
currentSnippet.appendLine(line)
}
}
}
@ -50,6 +50,24 @@ fun cloneTemplate(template: String, index: Int, content: String): File {
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)
fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build") {
val snippets = findSnippets(dirs)
@ -83,7 +101,7 @@ fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build")
if (proc.exitValue() != 0) {
println(proc.inputStream.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}")
}
}
}

2
tutorials/checker/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Loading…
Cancel
Save