=sbt Fix StreamOperatorsIndexGenerator on Windows (#31347)

This commit is contained in:
kerr 2022-04-19 20:31:20 +08:00 committed by GitHub
parent bfafb8cf0f
commit dc480ac9da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -248,9 +248,15 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
s"There must be at least 5 lines in $file, including the title, description, category link and an empty line between each two of them")
// This forces the short description to be on a single line. We could make this smarter,
// but 'forcing' the short description to be really short seems nice as well.
val description = lines(2)
.replaceAll("ref:?\\[(.*?)\\]\\(", "ref[$1](" + file.getAbsolutePath.replaceFirst(".*/([^/]+/).*", "$1"))
require(!description.isEmpty, s"description in $file must be non-empty, single-line description at the 3rd line")
val separator = java.io.File.separatorChar
val path =
if (separator != '/')
file.getAbsolutePath.replace(separator, '/')
else
file.getAbsolutePath
val description =
lines(2).replaceAll("ref:?\\[(.*?)\\]\\(", "ref[$1](" + path.replaceFirst(".*/([^/]+/).*", "$1"))
require(description.nonEmpty, s"description in $file must be non-empty, single-line description at the 3rd line")
val categoryLink = lines(4)
require(
categoryLink.startsWith("@ref"),