Skip to content

Commit

Permalink
ktl-1139 fix: metadata-jvm api reference build
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpachoo committed Jul 19, 2023
1 parent 3d485b0 commit 1e9122e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -16,7 +16,6 @@ object KotlinxDatetimeBuildApiReference : BuildType({

params {
param("release.tag", KOTLINX_DATETIME_RELEASE_TAG)
param("DOKKA_TEMPLATE_TASK", ":kotlinx-datetime:dokkaHtml")
}

vcs {
Expand All @@ -34,5 +33,8 @@ object KotlinxDatetimeBuildApiReference : BuildType({
sed -i -E "s/versionSuffix=SNAPSHOT//gi" ./gradle.properties
""".trimIndent()
}
buildDokkaHTML {
tasks = ":kotlinx-datetime:dokkaHtml"
}
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
}
Expand All @@ -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 {
Expand Down
30 changes: 21 additions & 9 deletions .teamcity/builds/apiReferences/templates/BuildApiReference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 = "+:<default>"
}.apply(block)
)

object BuildApiReference : Template({
name = "Dokka Reference Template"

Expand All @@ -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 = "+:<default>"
}
vcsDefaultTrigger {}
}

requirements {
Expand All @@ -60,9 +75,6 @@ object BuildApiReference : Template({
steps {
scriptDropSnapshot {}
scriptDokkaVersionSync {}
gradle {
name = "Build dokka html"
tasks = "%DOKKA_TEMPLATE_TASK%"
}
buildDokkaHTML {}
}
})

0 comments on commit 1e9122e

Please sign in to comment.