Skip to content

Commit

Permalink
fix(ci); add sitemap for sub api #3
Browse files Browse the repository at this point in the history
  • Loading branch information
zoobestik committed Nov 20, 2024
1 parent a022252 commit 9bcc30d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand All @@ -41,6 +42,6 @@ object KotlinxDatetimeBuildApiReference : BuildType({
buildDokkaHTML {
tasks = ":kotlinx-datetime:dokkaHtml"
}
sitemapGenerate(KOTLINX_DATETIME_ID)
sitemapGenerate(KOTLINX_DATETIME_ID, HTML_RESULT)
}
})
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
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"
description = "Build pages for Kotlinx Metadata JVM"

templates(BuildApiReference)

artifactRules = "$LIB_DIR/build/dokka/** => pages.zip"
artifactRules = "$HTML_RESULT/** => pages.zip"

params {
param("release.tag", KOTLIN_RELEASE_TAG)
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 13 additions & 3 deletions .teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 9bcc30d

Please sign in to comment.