Fix stdlib docs generator after adding new enums
This commit is contained in:
committed by
Space
parent
f38654740e
commit
57bbc335f4
@@ -50,10 +50,10 @@ task callDokka(type: Exec, dependsOn: setupCallDokka) {
|
|||||||
def logFile = file("$buildDir/dokka.log")
|
def logFile = file("$buildDir/dokka.log")
|
||||||
standardOutput = new org.apache.tools.ant.util.TeeOutputStream(System.out, new FileOutputStream(logFile))
|
standardOutput = new org.apache.tools.ant.util.TeeOutputStream(System.out, new FileOutputStream(logFile))
|
||||||
|
|
||||||
pKotlinBig().commentOutSinceKotlinForPathWalkOption.call()
|
pKotlinBig().commentOutSinceKotlinForNewEnums.call()
|
||||||
}
|
}
|
||||||
doLast {
|
doLast {
|
||||||
pKotlinBig().uncommentSinceKotlinForPathWalkOption.call()
|
pKotlinBig().uncommentSinceKotlinForNewEnums.call()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,24 +67,32 @@ project.extensions.kotlin_root = kotlinRootDir
|
|||||||
project.extensions.kotlin_libs = kotlinLibsDir
|
project.extensions.kotlin_libs = kotlinLibsDir
|
||||||
|
|
||||||
// TODO: Eliminate this workaround when KT-52977 gets fixed in the Kotlin compiler used in Dokka
|
// TODO: Eliminate this workaround when KT-52977 gets fixed in the Kotlin compiler used in Dokka
|
||||||
final File pathWalkOption = new File("$kotlinRootDir/libraries/stdlib/jdk7/src/kotlin/io/path/PathWalkOption.kt")
|
final List<File> enumsToComment = [
|
||||||
|
"$kotlinRootDir/libraries/stdlib/jdk7/src/kotlin/io/path/PathWalkOption.kt",
|
||||||
|
"$kotlinRootDir/libraries/stdlib/jdk7/src/kotlin/io/path/CopyActionResult.kt",
|
||||||
|
"$kotlinRootDir/libraries/stdlib/jdk7/src/kotlin/io/path/OnErrorResult.kt",
|
||||||
|
].collect { new File(it) }
|
||||||
|
|
||||||
project.extensions.commentOutSinceKotlinForPathWalkOption = {
|
project.extensions.commentOutSinceKotlinForNewEnums = {
|
||||||
final List<String> lines = pathWalkOption.readLines()
|
for (file in enumsToComment) {
|
||||||
for (def i = 0; i < lines.size(); i++) {
|
final List<String> lines = file.readLines()
|
||||||
if (lines[i] == "@SinceKotlin(\"1.7\")") {
|
for (def i = 0; i < lines.size(); i++) {
|
||||||
lines[i] = "//" + lines[i]
|
if (lines[i].startsWith("@SinceKotlin")) {
|
||||||
|
lines[i] = "//" + lines[i]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
file.write(String.join("\n", lines))
|
||||||
}
|
}
|
||||||
pathWalkOption.write(String.join("\n", lines))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
project.extensions.uncommentSinceKotlinForPathWalkOption = {
|
project.extensions.uncommentSinceKotlinForNewEnums = {
|
||||||
final List<String> lines = pathWalkOption.readLines()
|
for (file in enumsToComment) {
|
||||||
for (def i = 0; i < lines.size(); i++) {
|
final List<String> lines = file.readLines()
|
||||||
if (lines[i] == "//@SinceKotlin(\"1.7\")") {
|
for (def i = 0; i < lines.size(); i++) {
|
||||||
lines[i] = lines[i].substring(2)
|
if (lines[i].startsWith("//@SinceKotlin")) {
|
||||||
|
lines[i] = lines[i].substring(2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
file.write(String.join("\n", lines))
|
||||||
}
|
}
|
||||||
pathWalkOption.write(String.join("\n", lines))
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user