Skip to content

Commit

Permalink
fix(ci); add sitemap for sub api #4
Browse files Browse the repository at this point in the history
  • Loading branch information
zoobestik committed Nov 20, 2024
1 parent 9bcc30d commit 1ceb2f4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package builds.apiReferences.kotlinx.coroutines
import BuildParams.KOTLINX_COROUTINES_ID
import BuildParams.KOTLINX_COROUTINES_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.stdlib.copyDokkaFiles
import builds.apiReferences.stdlib.sitemapGenerate
import builds.apiReferences.templates.BuildApiReference
import jetbrains.buildServer.configs.kotlin.BuildType
Expand All @@ -26,6 +27,7 @@ object KotlinxCoroutinesBuildApiReference : BuildType({
}

steps {
copyDokkaFiles(KOTLINX_COROUTINES_ID)
sitemapGenerate(KOTLINX_COROUTINES_ID)
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package builds.apiReferences.kotlinx.datetime
import BuildParams.KOTLINX_DATETIME_ID
import BuildParams.KOTLINX_DATETIME_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.stdlib.copyDokkaFiles
import builds.apiReferences.stdlib.sitemapGenerate
import builds.apiReferences.templates.BuildApiReference
import builds.apiReferences.templates.buildDokkaHTML
Expand Down Expand Up @@ -42,6 +43,7 @@ object KotlinxDatetimeBuildApiReference : BuildType({
buildDokkaHTML {
tasks = ":kotlinx-datetime:dokkaHtml"
}
sitemapGenerate(KOTLINX_DATETIME_ID, HTML_RESULT)
copyDokkaFiles(KOTLINX_DATETIME_ID, HTML_RESULT)
sitemapGenerate(KOTLINX_DATETIME_ID)
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package builds.apiReferences.kotlinx.io
import BuildParams.KOTLINX_IO_ID
import BuildParams.KOTLINX_IO_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.stdlib.copyDokkaFiles
import builds.apiReferences.stdlib.sitemapGenerate
import builds.apiReferences.templates.BuildApiReference
import builds.apiReferences.templates.buildDokkaHTML
Expand Down Expand Up @@ -47,6 +48,7 @@ object KotlinxIOBuildApiReference : BuildType({
./gradlew dokkaHtmlMultiModule --no-daemon --no-configuration-cache
""".trimIndent()
}
copyDokkaFiles(KOTLINX_IO_ID)
sitemapGenerate(KOTLINX_IO_ID)
}
})
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package builds.apiReferences.kotlinx.metadataJvm

import BuildParams.KOTLINX_METADATA_ID
import BuildParams.KOTLINX_SERIALIZATION_ID
import BuildParams.KOTLIN_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.stdlib.copyDokkaFiles
import builds.apiReferences.stdlib.sitemapGenerate
import builds.apiReferences.templates.BuildApiReference
import builds.apiReferences.templates.buildDokkaHTML
Expand Down Expand Up @@ -53,7 +55,8 @@ object KotlinxMetadataJvmBuildApiReference : BuildType({
./gradlew :kotlin-metadata-jvm:dokkaHtml -PdeployVersion=${KOTLIN_RELEASE_TAG.removePrefix("v")} --no-daemon --no-configuration-cache
""".trimIndent()
}
sitemapGenerate(KOTLINX_METADATA_ID, "$LIB_DIR/build/dokka")
copyDokkaFiles(KOTLINX_METADATA_ID, "$LIB_DIR/build/dokka")
sitemapGenerate(KOTLINX_METADATA_ID)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package builds.apiReferences.kotlinx.serialization
import BuildParams.KOTLINX_SERIALIZATION_ID
import BuildParams.KOTLINX_SERIALIZATION_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.stdlib.copyDokkaFiles
import builds.apiReferences.stdlib.sitemapGenerate
import builds.apiReferences.templates.BuildApiReference
import jetbrains.buildServer.configs.kotlin.BuildType
Expand All @@ -26,6 +27,7 @@ object KotlinxSerializationBuildApiReference : BuildType({
}

steps {
copyDokkaFiles(KOTLINX_SERIALIZATION_ID)
sitemapGenerate(KOTLINX_SERIALIZATION_ID)
}
})
26 changes: 13 additions & 13 deletions .teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ import jetbrains.buildServer.configs.kotlin.BuildSteps
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.buildSteps.script

fun BuildSteps.sitemapGenerate(lib: String, resultPath: String = "build/dokka/htmlMultiModule") = {
if (lib != "core") script {
//language=bash
scriptContent = """
mkdir -p "dist/api"
cp -r "$resultPath" "dist/api/$lib"
""".trimIndent()
dockerImage = "alpine"
}
scriptDistAnalyze {
//language=bash
scriptContent += "\n" + """
fun BuildSteps.copyDokkaFiles(lib: String, resultPath: String = "build/dokka/htmlMultiModule") = script {
//language=bash
scriptContent = """
mkdir -p "dist/api"
cp -r "$resultPath" "dist/api/$lib"
""".trimIndent()
dockerImage = "alpine"
}

fun BuildSteps.sitemapGenerate(lib: String) = scriptDistAnalyze {
//language=bash
scriptContent += "\n" + """
cd ../../dist
mv sitemap.xml api/$lib/sitemap.xml
""".trimIndent()
}
}


object BuildStdlibApiReference : BuildType({
name = "Core API pages"
description = "Build pages for Kotlin Core API"
Expand Down

0 comments on commit 1ceb2f4

Please sign in to comment.