Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
vegarsti authored Jul 19, 2023
2 parents f7393d0 + 86fd01f commit 53cfb30
Show file tree
Hide file tree
Showing 119 changed files with 5,334 additions and 3,128 deletions.
4 changes: 3 additions & 1 deletion .idea/kotlin-web-site.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .teamcity/BuildParams.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
object BuildParams {
const val DOKKA_TEMPLATES_VERSION = "1.9.0-dev-218"

const val KOTLINX_COROUTINES_RELEASE_TAG = "1.7.1"
const val KOTLINX_SERIALIZATION_RELEASE_TAG = "v1.5.1"
const val KOTLINX_DATETIME_RELEASE_TAG = "v0.4.0"
const val KOTLINX_METADATA_JVM_RELEASE_TAG = "v0.7.0"

const val SEARCH_APP_ID = "7961PKYRXV"
const val SEARCH_INDEX_NAME = "prod_KOTLINLANG_WEBHELP"
Expand Down
9 changes: 9 additions & 0 deletions .teamcity/builds/apiReferences/BuildApiReferencesProject.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import builds.apiReferences.kotlinx.datetime.KotlinxDatetimePrepareDokkaTemplate
import builds.apiReferences.kotlinx.serialization.KotlinxSerializationBuildApiReference
import builds.apiReferences.kotlinx.serialization.KotlinxSerializationBuildSearchIndex
import builds.apiReferences.kotlinx.serialization.KotlinxSerializationPrepareDokkaTemplates
import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmBuildApiReference
import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmBuildSearchIndex
import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmPrepareDokkaTemplates
import builds.apiReferences.stdlib.BuildStdlibApiReference
import builds.apiReferences.stdlib.StdlibPrepareDokkaTemplates
import builds.apiReferences.templates.BuildApiReference
Expand All @@ -17,6 +20,7 @@ import builds.apiReferences.templates.PrepareDokkaTemplate
import builds.apiReferences.vcsRoots.KotlinxCoroutines
import builds.apiReferences.vcsRoots.KotlinxSerialization
import builds.apiReferences.vcsRoots.KotlinxDatetime
import builds.apiReferences.vcsRoots.Kotlin
import jetbrains.buildServer.configs.kotlin.Project

object BuildApiReferencesProject : Project({
Expand All @@ -35,12 +39,17 @@ object BuildApiReferencesProject : Project({
buildType(KotlinxCoroutinesBuildSearchIndex)
buildType(KotlinxCoroutinesPrepareDokkaTemplates)

buildType(KotlinxMetadataJvmBuildApiReference)
buildType(KotlinxMetadataJvmBuildSearchIndex)
buildType(KotlinxMetadataJvmPrepareDokkaTemplates)

buildType(BuildStdlibApiReference)
buildType(StdlibPrepareDokkaTemplates)

vcsRoot(KotlinxSerialization)
vcsRoot(KotlinxCoroutines)
vcsRoot(KotlinxDatetime)
vcsRoot(Kotlin)

template(PrepareDokkaTemplate)
template(BuildApiReference)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
package builds.apiReferences.kotlinx.coroutines

import BuildParams.KOTLINX_COROUTINES_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.templates.BuildApiReference
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.triggers.vcs

object KotlinxCoroutinesBuildApiReference: BuildType({
name = "kotlinx.coroutines API reference"
object KotlinxCoroutinesBuildApiReference : BuildType({
name = "kotlinx.coroutines API reference"

templates(BuildApiReference)
templates(BuildApiReference)

params {
param("release.tag", BuildParams.KOTLINX_COROUTINES_RELEASE_TAG)
}

vcs {
root(builds.apiReferences.vcsRoots.KotlinxCoroutines)
}
params {
param("release.tag", KOTLINX_COROUTINES_RELEASE_TAG)
}

triggers {
vcs {
branchFilter = "+:<default>"
root(builds.apiReferences.vcsRoots.KotlinxCoroutines)
}
}

dependencies {
dependsOnDokkaTemplate(KotlinxCoroutinesPrepareDokkaTemplates)
}
})
dependencies {
dependsOnDokkaTemplate(KotlinxCoroutinesPrepareDokkaTemplates)
}
})
Original file line number Diff line number Diff line change
@@ -1,52 +1,38 @@
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.scriptDropSnapshot
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.buildSteps.script
import jetbrains.buildServer.configs.kotlin.triggers.vcs

object KotlinxDatetimeBuildApiReference : BuildType({
name = "kotlinx-datetime API reference"
name = "kotlinx-datetime API reference"

artifactRules = "core/build/dokka/html/** => pages.zip"
templates(BuildApiReference)

steps {
script {
name = "Drop SNAPSHOT word for deploy"
scriptContent = """
#!/bin/bash
sed -i -E "s/versionSuffix=SNAPSHOT//gi" ./gradle.properties
""".trimIndent()
dockerImage = "debian"
}
gradle {
name = "Build dokka html"
tasks = ":kotlinx-datetime:dokkaHtml"
useGradleWrapper = true
}
}

params {
param("release.tag", BuildParams.KOTLINX_DATETIME_RELEASE_TAG)
param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true")
}
artifactRules = "core/build/dokka/html/** => pages.zip"

vcs {
root(builds.apiReferences.vcsRoots.KotlinxDatetime)
}
params {
param("release.tag", KOTLINX_DATETIME_RELEASE_TAG)
param("DOKKA_TEMPLATE_TASK", ":kotlinx-datetime:dokkaHtml")
}

triggers {
vcs {
branchFilter = "+:<default>"
root(builds.apiReferences.vcsRoots.KotlinxDatetime)
}
}

requirements {
doesNotContain("teamcity.agent.name", "windows")
}
dependencies {
dependsOnDokkaTemplate(KotlinxDatetimePrepareDokkaTemplates, "core/dokka-templates")
}

dependencies {
dependsOnDokkaTemplate(KotlinxDatetimePrepareDokkaTemplates, "core/dokka-templates")
}
steps {
scriptDropSnapshot {
scriptContent = """
#!/bin/bash
sed -i -E "s/versionSuffix=SNAPSHOT//gi" ./gradle.properties
""".trimIndent()
}
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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.scriptDropSnapshot
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.triggers.vcs

object KotlinxMetadataJvmBuildApiReference : BuildType({
name = "kotlinx-metadata-jvm API reference"

templates(BuildApiReference)

artifactRules = "libraries/kotlinx-metadata/jvm/build/dokka/** => pages.zip"

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 {
enabled = false
}
}

vcs {
root(builds.apiReferences.vcsRoots.Kotlin)
}

steps {
scriptDropSnapshot {
enabled = false
}
}

dependencies {
dependsOnDokkaTemplate(KotlinxMetadataJvmPrepareDokkaTemplates, "libraries/kotlinx-metadata/jvm/dokka-templates")
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package builds.apiReferences.kotlinx.metadataJvm

import builds.apiReferences.dependsOnDokkaPagesJson
import builds.apiReferences.templates.BuildApiReferenceSearchIndex
import jetbrains.buildServer.configs.kotlin.BuildType

object KotlinxMetadataJvmBuildSearchIndex: BuildType({
name = "Build search index for kotlinx-metadata-jvm"

templates(BuildApiReferenceSearchIndex)

params {
param("env.ALGOLIA_INDEX_NAME", "kotlinx-metadata-jvm")
param("env.API_REFERENCE_URL", "/api/kotlinx-metadata-jvm")
}

dependencies {
dependsOnDokkaPagesJson(KotlinxMetadataJvmBuildApiReference)
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package builds.apiReferences.kotlinx.metadataJvm

import builds.apiReferences.templates.PrepareDokkaTemplate
import jetbrains.buildServer.configs.kotlin.BuildType

object KotlinxMetadataJvmPrepareDokkaTemplates: BuildType({
name = "Prepare dokka templates for kotlinx-metadata-jvm"

templates(PrepareDokkaTemplate)

params {
param("env.ALGOLIA_INDEX_NAME", "kotlinx-metadata-jvm")
}
})
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
package builds.apiReferences.kotlinx.serialization

import BuildParams.KOTLINX_SERIALIZATION_RELEASE_TAG
import builds.apiReferences.dependsOnDokkaTemplate
import builds.apiReferences.templates.BuildApiReference
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.triggers.vcs

object KotlinxSerializationBuildApiReference : BuildType({
name = "kotlinx.serialization API reference"
name = "kotlinx.serialization API reference"

templates(BuildApiReference)
templates(BuildApiReference)

params {
param("release.tag", BuildParams.KOTLINX_SERIALIZATION_RELEASE_TAG)
}

vcs {
root(builds.apiReferences.vcsRoots.KotlinxSerialization)
}
params {
param("release.tag", KOTLINX_SERIALIZATION_RELEASE_TAG)
}

triggers {
vcs {
branchFilter = "+:<default>"
root(builds.apiReferences.vcsRoots.KotlinxSerialization)
}
}

dependencies {
dependsOnDokkaTemplate(KotlinxSerializationPrepareDokkaTemplates)
}
dependencies {
dependsOnDokkaTemplate(KotlinxSerializationPrepareDokkaTemplates)
}
})
79 changes: 55 additions & 24 deletions .teamcity/builds/apiReferences/templates/BuildApiReference.kt
Original file line number Diff line number Diff line change
@@ -1,37 +1,68 @@
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.buildSteps.ScriptBuildStep
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.buildSteps.script
import jetbrains.buildServer.configs.kotlin.triggers.vcs

fun BuildSteps.scriptDropSnapshot(block: ScriptBuildStep.() -> Unit) = step(
ScriptBuildStep {
id = "step-drop-snapshot-id"
name = "Drop SNAPSHOT word for deploy"
dockerImage = "debian"
scriptContent = """
#!/bin/bash
CURRENT_VERSION="$(sed -E s/^v?//g <<<%release.tag%)"
sed -i -E "s/^version=.+(-SNAPSHOT)?/version=${'$'}CURRENT_VERSION/gi" ./gradle.properties
""".trimIndent()
}.apply(block),
)

const val DOKKA_SPACE_REPO = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/"

fun BuildSteps.scriptDokkaVersionSync(block: ScriptBuildStep.() -> Unit) = step(
ScriptBuildStep {
id = "step-dokka-version-sync-id"
name = "Sync dokka version with main repository templates"
dockerImage = "debian"
scriptContent = """
#!/bin/bash
sed -i -E "s/^(dokka_version|dokkaVersion)=.+/\1=%DOKKA_TEMPLATES_VERSION%/gi" ./gradle.properties
find . -name "*.gradle.kts" -exec sed -i -E "s|mavenCentral|maven(url = \"$DOKKA_SPACE_REPO\")\nmavenCentral|" {} \;
find . -name "*.gradle" -exec sed -i -E "s|mavenCentral|maven \{ url \"$DOKKA_SPACE_REPO\" \}\nmavenCentral|" {} \;
""".trimIndent()
}.apply(block),
)

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

artifactRules = "build/dokka/htmlMultiModule/** => pages.zip"

steps {
script {
name = "Drop SNAPSHOT word for deploy"
scriptContent = """
#!/bin/bash
CURRENT_VERSION="$(sed -E s/^v?//g <<<%release.tag%)"
sed -i -E "s/^version=.+(-SNAPSHOT)?/version=${'$'}CURRENT_VERSION/gi" ./gradle.properties
""".trimIndent()
dockerImage = "debian"
name = "Dokka Reference Template"

artifactRules = "build/dokka/htmlMultiModule/** => pages.zip"

params {
param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true")
param("DOKKA_TEMPLATES_VERSION", DOKKA_TEMPLATES_VERSION)
param("DOKKA_TEMPLATE_TASK", "dokkaHtmlMultiModule")
}

gradle {
name = "Build dokka html"
tasks = "dokkaHtmlMultiModule"
triggers {
vcs {
branchFilter = "+:<default>"
}
}
}

requirements {
contains("docker.server.osType", "linux")
}
requirements {
contains("docker.server.osType", "linux")
}

params {
param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true")
}
steps {
scriptDropSnapshot {}
scriptDokkaVersionSync {}
gradle {
name = "Build dokka html"
tasks = "%DOKKA_TEMPLATE_TASK%"
}
}
})
Loading

0 comments on commit 53cfb30

Please sign in to comment.