From 9bcc30d0c7816909b4ce01512019fca31aabe2cc Mon Sep 17 00:00:00 2001 From: zoobestik Date: Wed, 20 Nov 2024 21:17:52 +0100 Subject: [PATCH] fix(ci); add sitemap for sub api #3 --- .../datetime/KotlinxDatetimeBuildApiReference.kt | 7 ++++--- .../kotlinx/io/KotlinxIOBuildApiReference.kt | 3 --- .../KotlinxMetadataJvmBuildApiReference.kt | 11 +++++++---- .../KotlinxSerializationBuildApiReference.kt | 1 - .../stdlib/BuildStdlibApiReference.kt | 16 +++++++++++++--- .../apiReferences/templates/BuildApiReference.kt | 1 + 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt index e42dc44c7c7..87270394599 100644 --- a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt @@ -1,6 +1,5 @@ package builds.apiReferences.kotlinx.datetime -import BuildParams.KOTLINX_COROUTINES_ID import BuildParams.KOTLINX_DATETIME_ID import BuildParams.KOTLINX_DATETIME_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate @@ -10,13 +9,15 @@ import builds.apiReferences.templates.buildDokkaHTML import builds.apiReferences.templates.scriptDropSnapshot import jetbrains.buildServer.configs.kotlin.BuildType +private const val HTML_RESULT = "core/build/dokka/html" + object KotlinxDatetimeBuildApiReference : BuildType({ name = "$KOTLINX_DATETIME_ID pages" description = "Build pages for Kotlinx Datetime" templates(BuildApiReference) - artifactRules = "core/build/dokka/html/** => pages.zip" + artifactRules = "$HTML_RESULT/** => pages.zip" params { param("release.tag", KOTLINX_DATETIME_RELEASE_TAG) @@ -41,6 +42,6 @@ object KotlinxDatetimeBuildApiReference : BuildType({ buildDokkaHTML { tasks = ":kotlinx-datetime:dokkaHtml" } - sitemapGenerate(KOTLINX_DATETIME_ID) + sitemapGenerate(KOTLINX_DATETIME_ID, HTML_RESULT) } }) diff --git a/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt index a0c97889094..d1da1095d28 100644 --- a/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/io/KotlinxIOBuildApiReference.kt @@ -1,6 +1,5 @@ package builds.apiReferences.kotlinx.io -import BuildParams.KOTLINX_DATETIME_ID import BuildParams.KOTLINX_IO_ID import BuildParams.KOTLINX_IO_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate @@ -18,8 +17,6 @@ object KotlinxIOBuildApiReference : BuildType({ templates(BuildApiReference) - artifactRules = "build/dokka/htmlMultiModule/** => pages.zip" - params { param("release.tag", KOTLINX_IO_RELEASE_TAG.removePrefix("v")) } diff --git a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt index d5edfc53bdf..779758cd704 100644 --- a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt @@ -1,15 +1,18 @@ package builds.apiReferences.kotlinx.metadataJvm -import BuildParams.KOTLINX_IO_ID import BuildParams.KOTLINX_METADATA_ID import BuildParams.KOTLIN_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate import builds.apiReferences.stdlib.sitemapGenerate -import builds.apiReferences.templates.* +import builds.apiReferences.templates.BuildApiReference +import builds.apiReferences.templates.buildDokkaHTML +import builds.apiReferences.templates.scriptDropSnapshot +import builds.apiReferences.templates.vcsDefaultTrigger import jetbrains.buildServer.configs.kotlin.BuildType import jetbrains.buildServer.configs.kotlin.buildSteps.script private const val LIB_DIR = "libraries/kotlinx-metadata/jvm" +private const val HTML_RESULT = "$LIB_DIR/build/dokka" object KotlinxMetadataJvmBuildApiReference : BuildType({ name = "$KOTLINX_METADATA_ID pages" @@ -17,7 +20,7 @@ object KotlinxMetadataJvmBuildApiReference : BuildType({ templates(BuildApiReference) - artifactRules = "$LIB_DIR/build/dokka/** => pages.zip" + artifactRules = "$HTML_RESULT/** => pages.zip" params { param("release.tag", KOTLIN_RELEASE_TAG) @@ -50,7 +53,7 @@ object KotlinxMetadataJvmBuildApiReference : BuildType({ ./gradlew :kotlin-metadata-jvm:dokkaHtml -PdeployVersion=${KOTLIN_RELEASE_TAG.removePrefix("v")} --no-daemon --no-configuration-cache """.trimIndent() } - sitemapGenerate(KOTLINX_METADATA_ID) + sitemapGenerate(KOTLINX_METADATA_ID, "$LIB_DIR/build/dokka") } dependencies { diff --git a/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt index 88643dc7175..4d2e77399c8 100644 --- a/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt @@ -1,6 +1,5 @@ package builds.apiReferences.kotlinx.serialization -import BuildParams.KOTLINX_METADATA_ID import BuildParams.KOTLINX_SERIALIZATION_ID import BuildParams.KOTLINX_SERIALIZATION_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate diff --git a/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt b/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt index 51785a8525a..be1b08c817c 100644 --- a/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt +++ b/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt @@ -7,12 +7,22 @@ import jetbrains.buildServer.configs.kotlin.BuildSteps import jetbrains.buildServer.configs.kotlin.BuildType import jetbrains.buildServer.configs.kotlin.buildSteps.script -fun BuildSteps.sitemapGenerate(lib: String) = scriptDistAnalyze { - //language=bash - scriptContent += "\n" + """ +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" + """ cd ../../dist mv sitemap.xml api/$lib/sitemap.xml """.trimIndent() + } } object BuildStdlibApiReference : BuildType({ diff --git a/.teamcity/builds/apiReferences/templates/BuildApiReference.kt b/.teamcity/builds/apiReferences/templates/BuildApiReference.kt index 1a3f7edae3d..7e3244b7f59 100644 --- a/.teamcity/builds/apiReferences/templates/BuildApiReference.kt +++ b/.teamcity/builds/apiReferences/templates/BuildApiReference.kt @@ -68,6 +68,7 @@ fun Triggers.vcsDefaultTrigger(block: Trigger.() -> Unit) = trigger( object BuildApiReference : Template({ name = "Dokka Reference Template" + description = "Process pages for Core API" artifactRules = "build/dokka/htmlMultiModule/** => pages.zip"