From 1e9122ef8410690d7181f46b6fdd255a6da00697 Mon Sep 17 00:00:00 2001 From: Nikolay Pachkov Date: Wed, 19 Jul 2023 09:35:26 +0200 Subject: [PATCH] ktl-1139 fix: metadata-jvm api reference build --- .../KotlinxDatetimeBuildApiReference.kt | 6 ++-- .../KotlinxMetadataJvmBuildApiReference.kt | 16 ++++++++-- .../templates/BuildApiReference.kt | 30 +++++++++++++------ 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt index fd3f787c904..c2dbc884a4c 100644 --- a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt @@ -3,7 +3,7 @@ package builds.apiReferences.kotlinx.datetime import BuildParams.KOTLINX_DATETIME_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate import builds.apiReferences.templates.BuildApiReference -import builds.apiReferences.templates.scriptDokkaVersionSync +import builds.apiReferences.templates.buildDokkaHTML import builds.apiReferences.templates.scriptDropSnapshot import jetbrains.buildServer.configs.kotlin.BuildType @@ -16,7 +16,6 @@ object KotlinxDatetimeBuildApiReference : BuildType({ params { param("release.tag", KOTLINX_DATETIME_RELEASE_TAG) - param("DOKKA_TEMPLATE_TASK", ":kotlinx-datetime:dokkaHtml") } vcs { @@ -34,5 +33,8 @@ object KotlinxDatetimeBuildApiReference : BuildType({ sed -i -E "s/versionSuffix=SNAPSHOT//gi" ./gradle.properties """.trimIndent() } + buildDokkaHTML { + tasks = ":kotlinx-datetime:dokkaHtml" + } } }) diff --git a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt index 63c33b9722f..d068cb584eb 100644 --- a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt @@ -3,9 +3,11 @@ package builds.apiReferences.kotlinx.metadataJvm import BuildParams.KOTLINX_METADATA_JVM_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate 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.triggers.vcs +import jetbrains.buildServer.configs.kotlin.buildSteps.script object KotlinxMetadataJvmBuildApiReference : BuildType({ name = "kotlinx-metadata-jvm API reference" @@ -16,11 +18,10 @@ object KotlinxMetadataJvmBuildApiReference : BuildType({ params { param("release.tag", KOTLINX_METADATA_JVM_RELEASE_TAG) - param("DOKKA_TEMPLATE_TASK", ":kotlinx-metadata-jvm:dokkaHtml -PkotlinxMetadataDeployVersion=${KOTLINX_METADATA_JVM_RELEASE_TAG}") } triggers { - vcs { + vcsDefaultTrigger { enabled = false } } @@ -33,6 +34,15 @@ object KotlinxMetadataJvmBuildApiReference : BuildType({ scriptDropSnapshot { enabled = false } + buildDokkaHTML { + enabled = false + } + script { + name = "build api reference" + scriptContent = """ + ./gradlew :kotlinx-metadata-jvm:dokkaHtml -PkotlinxMetadataDeployVersion=${KOTLINX_METADATA_JVM_RELEASE_TAG} + """.trimIndent() + } } dependencies { diff --git a/.teamcity/builds/apiReferences/templates/BuildApiReference.kt b/.teamcity/builds/apiReferences/templates/BuildApiReference.kt index e32c2ce60a0..fe1bfb00681 100644 --- a/.teamcity/builds/apiReferences/templates/BuildApiReference.kt +++ b/.teamcity/builds/apiReferences/templates/BuildApiReference.kt @@ -3,8 +3,11 @@ package builds.apiReferences.templates import BuildParams.DOKKA_TEMPLATES_VERSION import jetbrains.buildServer.configs.kotlin.BuildSteps import jetbrains.buildServer.configs.kotlin.Template +import jetbrains.buildServer.configs.kotlin.Trigger +import jetbrains.buildServer.configs.kotlin.Triggers +import jetbrains.buildServer.configs.kotlin.buildSteps.GradleBuildStep import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep -import jetbrains.buildServer.configs.kotlin.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.triggers.VcsTrigger import jetbrains.buildServer.configs.kotlin.triggers.vcs fun BuildSteps.scriptDropSnapshot(block: ScriptBuildStep.() -> Unit) = step( @@ -36,6 +39,21 @@ fun BuildSteps.scriptDokkaVersionSync(block: ScriptBuildStep.() -> Unit) = step( }.apply(block), ) +fun BuildSteps.buildDokkaHTML(block: GradleBuildStep.() -> Unit) = step( + GradleBuildStep { + id = "step-build-dokka-html-id" + name = "Build dokka html" + tasks = "dokkaHtmlMultiModule" + }.apply(block), +) + +fun Triggers.vcsDefaultTrigger(block: Trigger.() -> Unit) = trigger( + VcsTrigger { + id = "trigger-vcs-default-trigger-id" + branchFilter = "+:" + }.apply(block) +) + object BuildApiReference : Template({ name = "Dokka Reference Template" @@ -44,13 +62,10 @@ object BuildApiReference : Template({ params { param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true") param("DOKKA_TEMPLATES_VERSION", DOKKA_TEMPLATES_VERSION) - param("DOKKA_TEMPLATE_TASK", "dokkaHtmlMultiModule") } triggers { - vcs { - branchFilter = "+:" - } + vcsDefaultTrigger {} } requirements { @@ -60,9 +75,6 @@ object BuildApiReference : Template({ steps { scriptDropSnapshot {} scriptDokkaVersionSync {} - gradle { - name = "Build dokka html" - tasks = "%DOKKA_TEMPLATE_TASK%" - } + buildDokkaHTML {} } })