stdlib-gen: simpify copyright notice reading

This commit is contained in:
Ilya Gorbunov
2022-03-10 23:20:08 +03:00
committed by Space
parent d225399241
commit 4709e2c274
4 changed files with 4 additions and 13 deletions
@@ -16,7 +16,7 @@ fun autoGeneratedWarning(generator: String): String = """//
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//"""
lateinit var COPYRIGHT_NOTICE: String
val COPYRIGHT_NOTICE: String by lazy { readCopyrightNoticeFromResource() }
fun readCopyrightNoticeFromProfile(copyrightProfile: File): String = readCopyrightNoticeFromProfile { copyrightProfile.reader() }
@@ -31,6 +31,9 @@ fun readCopyrightNoticeFromProfile(getCopyrightReader: () -> Reader): String {
return template.replace(yearTemplate, year).lines().joinToString("", prefix = "/*\n", postfix = " */\n") { " * $it\n" }
}
fun readCopyrightNoticeFromResource() = readCopyrightNoticeFromProfile { Thread.currentThread().contextClassLoader.getResourceAsStream("apache.xml")!!.reader() }
data class TargetedSourceFile(
val target: KotlinTarget,