From 03041544e7d61b13c422e9b783b808827abeabcc Mon Sep 17 00:00:00 2001 From: Jeff Lockhart Date: Fri, 27 Dec 2024 17:38:13 -0700 Subject: [PATCH] Work around https://github.com/Kotlin/dokka/issues/3965 --- build.gradle.kts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 10d46bfcd..de2255521 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -57,6 +57,19 @@ tasks.dokkaGeneratePublicationHtml { doLast { apiDocsDir.deleteRecursively() outputDirectory.get().asFile.renameTo(apiDocsDir) + + // work around https://github.com/Kotlin/dokka/issues/3965 + fun removeExtraNewlines(dir: File) { + dir.listFiles()?.forEach { file -> + if (file.isDirectory) { + removeExtraNewlines(file) + } else if (file.extension == "html") { + val contents = file.readText().dropLast(1) + file.writeText(contents) + } + } + } + removeExtraNewlines(olderDir) } }