Skip to content

Commit

Permalink
Move/copy legacy docs build to a separate directory
Browse files Browse the repository at this point in the history
(cherry picked from commit 9bceb6c)
  • Loading branch information
ilya-g committed Apr 27, 2023
1 parent ec1553a commit 2088bc8
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 7 deletions.
1 change: 1 addition & 0 deletions .space/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
/libraries/tools/kotlin-serialization/ "Kotlin Build Tools"
/libraries/tools/kotlin-serialization-unshaded/ "Kotlin Build Tools"
/libraries/tools/kotlin-stdlib-docs/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov
/libraries/tools/kotlin-stdlib-docs-legacy/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov
/libraries/tools/kotlin-stdlib-gen/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov
/libraries/tools/kotlin-test-js-runner/ "Kotlin JS"
/libraries/tools/kotlin-tooling-core/ "Kotlin Build Tools" "Kotlin Multiplatform"
Expand Down
7 changes: 7 additions & 0 deletions libraries/tools/kotlin-stdlib-docs-legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kotlin-stdlib-docs-legacy
===================

Legacy scripts to build API documentation for kotlin stdlib, kotlin test (and others?) libraries for
kotlinlang.org web-site.


File renamed without changes.
98 changes: 98 additions & 0 deletions libraries/tools/kotlin-stdlib-docs-legacy/kotlin_big/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
apply plugin: 'base'

final boolean isTeamcityBuild = System.getenv("TEAMCITY_VERSION") != null

// kotlin/libraries/tools/kotlin-stdlib-docs -> kotlin
final String kotlinRootDir = rootProject.file("../../../").absolutePath.replace('\\', '/')
final String kotlinLibsDir = "$buildDir/libs"

final String githubRevision = isTeamcityBuild ? project.property("githubRevision") : "master"
final String kotlinVersion = isTeamcityBuild ? project.property("deployVersion") : "1.8.255-SNAPSHOT"
final String repo = isTeamcityBuild ? project.property("kotlinLibsRepo") : "$kotlinRootDir/build/repo"

println("# Extracting info:")
println(" isTeamcityBuild: $isTeamcityBuild")
println(" githubRevision: $githubRevision")
println(" kotlinVersion: $kotlinVersion")
println(" repo: $repo")

repositories {
maven { url = repo }
mavenCentral()
}

final List<String> modules = [
"kotlin-stdlib",
"kotlin-stdlib-common",
"kotlin-stdlib-jdk7",
"kotlin-stdlib-jdk8",
"kotlin-stdlib-js",
"kotlin-test",
"kotlin-test-js",
"kotlin-test-junit5",
"kotlin-test-junit",
"kotlin-test-testng",
"kotlin-test-common",
]


task extractLibs() { }


modules.forEach { module ->
final String lib = "kotlin_lib_$module"

final Configuration lib_src = configurations.create(lib)

if (module == "kotlin-test-js") {
lib_src.attributes {attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, "kotlin-runtime")) }
}

dependencies {
"$lib"(group: 'org.jetbrains.kotlin', name: module, version: kotlinVersion)
}

final Task libsTask = tasks.create("extract_lib_$module", Sync) {
dependsOn lib_src

from { lib_src }
into "$kotlinLibsDir/$module"
}

extractLibs.dependsOn libsTask
}

project.extensions.github_revision = githubRevision
project.extensions.kotlin_root = kotlinRootDir
project.extensions.kotlin_libs = kotlinLibsDir

// TODO: Eliminate this workaround when KT-52977 gets fixed in the Kotlin compiler used in Dokka
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.commentOutSinceKotlinForNewEnums = {
for (file in enumsToComment) {
final List<String> lines = file.readLines()
for (def i = 0; i < lines.size(); i++) {
if (lines[i].startsWith("@SinceKotlin")) {
lines[i] = "//" + lines[i]
}
}
file.write(String.join("\n", lines))
}
}

project.extensions.uncommentSinceKotlinForNewEnums = {
for (file in enumsToComment) {
final List<String> lines = file.readLines()
for (def i = 0; i < lines.size(); i++) {
if (lines[i].startsWith("//@SinceKotlin")) {
lines[i] = lines[i].substring(2)
}
}
file.write(String.join("\n", lines))
}
}
7 changes: 0 additions & 7 deletions libraries/tools/kotlin-stdlib-docs/README.md

This file was deleted.

0 comments on commit 2088bc8

Please sign in to comment.