From 1ceb2f489ef30269de2e40a99d489959fe725d1b Mon Sep 17 00:00:00 2001 From: zoobestik Date: Wed, 20 Nov 2024 21:28:35 +0100 Subject: [PATCH] fix(ci); add sitemap for sub api #4 --- .../KotlinxCoroutinesBuildApiReference.kt | 2 ++ .../KotlinxDatetimeBuildApiReference.kt | 4 ++- .../kotlinx/io/KotlinxIOBuildApiReference.kt | 2 ++ .../KotlinxMetadataJvmBuildApiReference.kt | 5 +++- .../KotlinxSerializationBuildApiReference.kt | 2 ++ .../stdlib/BuildStdlibApiReference.kt | 26 +++++++++---------- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt index 5b3133c0fe4..71eed1931dc 100644 --- a/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt @@ -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 @@ -26,6 +27,7 @@ object KotlinxCoroutinesBuildApiReference : BuildType({ } steps { + copyDokkaFiles(KOTLINX_COROUTINES_ID) sitemapGenerate(KOTLINX_COROUTINES_ID) } }) diff --git a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt index 87270394599..2dba3f2e2dc 100644 --- a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt @@ -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 @@ -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) } }) diff --git a/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt index d1da1095d28..962674d1d36 100644 --- a/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt @@ -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 @@ -47,6 +48,7 @@ object KotlinxIOBuildApiReference : BuildType({ ./gradlew dokkaHtmlMultiModule --no-daemon --no-configuration-cache """.trimIndent() } + copyDokkaFiles(KOTLINX_IO_ID) sitemapGenerate(KOTLINX_IO_ID) } }) diff --git a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt index 779758cd704..f0c8cad7af1 100644 --- a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt @@ -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 @@ -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 { diff --git a/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt index 4d2e77399c8..a1d3e88db13 100644 --- a/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt @@ -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 @@ -26,6 +27,7 @@ object KotlinxSerializationBuildApiReference : BuildType({ } steps { + copyDokkaFiles(KOTLINX_SERIALIZATION_ID) sitemapGenerate(KOTLINX_SERIALIZATION_ID) } }) diff --git a/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt b/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt index be1b08c817c..a61d6809b07 100644 --- a/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt +++ b/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt @@ -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"