Skip to content

Commit 383f237

Browse files
authored
Merge pull request #4970 from JetBrains/playground/ezerskii-dsl-update-pdf-generator-ref
Playground/ezerskii refactor documentation builds
2 parents 484b2a9 + 6224618 commit 383f237

File tree

12 files changed

+217
-76
lines changed

12 files changed

+217
-76
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package documentation
2+
3+
import documentation.builds.KotlinMultiplatform
4+
import documentation.builds.KotlinWithCoroutines
5+
import documentation.vcsRoots.*
6+
import jetbrains.buildServer.configs.kotlin.Project
7+
8+
object DocumentationProject: Project({
9+
name = "Documentation"
10+
description = "Build kotlin documentation"
11+
12+
buildTypesOrder = arrayListOf(
13+
KotlinWithCoroutines,
14+
KotlinMultiplatform,
15+
)
16+
17+
buildTypesOrder.forEach {
18+
buildType(it)
19+
}
20+
21+
vcsRoot(KotlinMultiplatformVCS)
22+
vcsRoot(KotlinReferenceRoot)
23+
vcsRoot(KotlinxCoroutinesRoot)
24+
vcsRoot(KotlinxLincheckRoot)
25+
vcsRoot(DokkaRoot)
26+
vcsRoot(APIGuidelinesRoot)
27+
})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package documentation.builds
2+
3+
import documentation.vcsRoots.KotlinMultiplatformVCS
4+
5+
object KotlinMultiplatform: WritersideBuilder (
6+
module = "kotlin-multiplatform-docs",
7+
instance = "mpd",
8+
customInit = {
9+
name = "Kotlin Multiplatform Documentation"
10+
vcs {
11+
root(KotlinMultiplatformVCS)
12+
cleanCheckout = true
13+
}
14+
}
15+
)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package documentation.builds
2+
3+
import documentation.vcsRoots.*
4+
//import jetbrains.buildServer.configs.kotlin.BuildType
5+
//import jetbrains.buildServer.configs.kotlin.FailureAction
6+
//import jetbrains.buildServer.configs.kotlin.buildSteps.script
7+
8+
object KotlinWithCoroutines: WritersideBuilder(
9+
module = "kotlin-reference",
10+
instance = "kr",
11+
customInit = {
12+
name ="Kotlin Reference with coroutines"
13+
vcs {
14+
root(KotlinReferenceRoot, """
15+
+:docs => docs
16+
+:.git => .git
17+
+:.gitmodules => .gitmodules
18+
+:docs-test-submodule => docs-test-submodule
19+
""".trimIndent())
20+
root(KotlinxCoroutinesRoot,"""
21+
+:docs => kotlinx.coroutines/docs
22+
+:.git => kotlinx.coroutines/.git
23+
""".trimIndent())
24+
root(KotlinxLincheckRoot, """
25+
+:docs => kotlinx-lincheck/docs
26+
+:.git => kotlinx-lincheck/.git
27+
""".trimIndent())
28+
root(DokkaRoot, """
29+
+:docs => dokka/docs
30+
+:.git => dokka/.git
31+
""".trimIndent())
32+
root(APIGuidelinesRoot, """
33+
+:docs => api-guidelines/docs
34+
+:.git => api-guidelines/.git
35+
""".trimIndent())
36+
}
37+
}
38+
)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package documentation.builds
2+
3+
import jetbrains.buildServer.configs.kotlin.BuildType
4+
import jetbrains.buildServer.configs.kotlin.buildSteps.script
5+
6+
abstract class WritersideBuilder(
7+
module: String,
8+
instance: String,
9+
customInit: BuildType.() -> Unit = {}
10+
): BuildType({
11+
val dockerImageTag = "2.1.2176-p8483"
12+
val frontend = "https://kotlinlang.org/docs/static/v3/"
13+
14+
name = "${instance.uppercase()} documentation build"
15+
description = "Build $module/$instance documentation with the docker"
16+
17+
artifactRules = """
18+
artifacts/*
19+
""".trimIndent()
20+
21+
steps {
22+
script {
23+
name = "Build $module/$instance documentation with the docker"
24+
scriptContent = """
25+
docker run --rm -v %teamcity.build.checkoutDir%:/opt/sources \
26+
-e SOURCE_DIR=/opt/sources \
27+
-e MODULE_INSTANCE=$module/$instance \
28+
-e RUNNER=teamcity \
29+
-e FRONTEND=$frontend \
30+
-e OUTPUT_DIR=/opt/sources/artifacts \
31+
registry.jetbrains.team/p/writerside/builder/writerside-builder:$dockerImageTag
32+
"""
33+
}
34+
}
35+
36+
requirements {
37+
equals("container.engine","docker")
38+
}
39+
40+
customInit()
41+
})
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package documentation.vcsRoots
2+
3+
import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot
4+
5+
6+
// KmpRoots
7+
object KotlinMultiplatformVCS: GitVcsRoot ({
8+
name = "Kotlin Multiplatform root"
9+
url = "https://github.com/JetBrains/kotlin-multiplatform-dev-docs.git"
10+
branch = "refs/heads/master"
11+
branchSpec = "+:refs/heads/*"
12+
checkoutPolicy = AgentCheckoutPolicy.AUTO
13+
authMethod = uploadedKey {
14+
uploadedKey = "default teamcity key"
15+
}
16+
})
17+
18+
// Kotlin Reference With Coroutine Roots
19+
object KotlinReferenceRoot: GitVcsRoot ({
20+
name = "Kotlin Reference"
21+
url = "https://github.com/JetBrains/kotlin-web-site.git"
22+
branch = "refs/heads/master"
23+
branchSpec = "+:refs/heads/*"
24+
checkoutPolicy = AgentCheckoutPolicy.AUTO
25+
authMethod = uploadedKey {
26+
uploadedKey = "default teamcity key"
27+
}
28+
})
29+
30+
object KotlinxCoroutinesRoot: GitVcsRoot ({
31+
name = "Kotlinx Coroutines"
32+
url = "https://github.com/Kotlin/kotlinx.coroutines.git"
33+
branch = "refs/heads/master"
34+
branchSpec = "+:refs/heads/*"
35+
checkoutPolicy = AgentCheckoutPolicy.AUTO
36+
authMethod = uploadedKey {
37+
uploadedKey = "default teamcity key"
38+
}
39+
})
40+
41+
object KotlinxLincheckRoot: GitVcsRoot ({
42+
name = "Kotlinx Lincheck"
43+
url = "https://github.com/JetBrains/lincheck.git"
44+
branch = "refs/heads/master"
45+
branchSpec = "+:refs/heads/*"
46+
checkoutPolicy = AgentCheckoutPolicy.AUTO
47+
authMethod = uploadedKey {
48+
uploadedKey = "default teamcity key"
49+
}
50+
})
51+
52+
object DokkaRoot: GitVcsRoot ({
53+
name = "Dokka"
54+
url = "https://github.com/Kotlin/dokka.git"
55+
branch = "refs/heads/master"
56+
branchSpec = "+:refs/heads/*"
57+
checkoutPolicy = AgentCheckoutPolicy.AUTO
58+
authMethod = uploadedKey {
59+
uploadedKey = "default teamcity key"
60+
}
61+
})
62+
63+
object APIGuidelinesRoot: GitVcsRoot ({
64+
name = "API Guidelines"
65+
url = "https://github.com/Kotlin/api-guidelines.git"
66+
branch = "refs/heads/main"
67+
branchSpec = "+:refs/heads/*"
68+
checkoutPolicy = AgentCheckoutPolicy.AUTO
69+
authMethod = uploadedKey {
70+
uploadedKey = "default teamcity key"
71+
}
72+
})

.teamcity/kotlinlang/SiteProject.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ object SiteProject : Project({
1515
FetchBlogNews,
1616
PdfGenerator,
1717
BuildSearchIndex,
18-
BuildReferenceDocs,
1918
BuildWebHelpFrontend,
2019
BuildKotlinGrammar,
2120
BuildKotlinSpec,
@@ -32,4 +31,4 @@ object SiteProject : Project({
3231
vcsRoot(GrammarGenerator)
3332
vcsRoot(KotlinSpec)
3433
vcsRoot(WebHelp)
35-
})
34+
})
Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +0,0 @@
1-
package kotlinlang.builds
2-
3-
import jetbrains.buildServer.configs.kotlin.AbsoluteId
4-
import jetbrains.buildServer.configs.kotlin.BuildType
5-
import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep
6-
import jetbrains.buildServer.configs.kotlin.buildSteps.script
7-
import java.io.File
8-
import java.nio.file.Paths
9-
10-
private fun readScript(name: String): String {
11-
val file = File(Paths.get("scripts/$name.mjs").toAbsolutePath().toString())
12-
return file.readText()
13-
}
14-
15-
object BuildReferenceDocs : BuildType({
16-
name = "Reference Docs"
17-
description = "Build documentation pages https://kotlinlang.org/docs/"
18-
19-
artifactRules = """
20-
+:images => docs.zip!images
21-
+:static => docs.zip!static
22-
+:pages/*.html => docs.zip
23-
+:pages/*.json => docs.zip
24-
""".trimIndent()
25-
26-
params {
27-
param("WEBHELP_FRONTEND_VERSION", "6.24.0-api-nav")
28-
param("WH_DOCS_PATH_REGEX", "docs")
29-
param("WH_PROJECT_NAME", "kotlin-reference")
30-
}
31-
32-
steps {
33-
script {
34-
name = "Fix paths"
35-
scriptContent = """
36-
find pages -type f -name '*.html' -exec sed -i -E 's/((https?:)?\/\/resources.jetbrains.com)?\/storage\/help-app\/v[0-9]\//static\/v3\//g' {} +
37-
find pages -type f -name '*.html' -exec sed -i -E "s/((https?:)?\/\/resources.jetbrains.com)?\/help\/app\//static\//g" {} +
38-
39-
find pages -type f -name '*.html' -exec sed -i -E "s/(static\/v3\/app.css)/\1?v=%WEBHELP_FRONTEND_VERSION%/g" {} +
40-
""".trimIndent()
41-
dockerImage = "alpine"
42-
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
43-
}
44-
}
45-
46-
dependencies {
47-
dependency(AbsoluteId("Documentation_TransitioningProducts_KotlinReferenceWithCoroutines")) {
48-
snapshot {}
49-
50-
artifacts {
51-
cleanDestination = true
52-
artifactRules = """
53-
+:webHelpImages.zip!** => images/
54-
+:webHelpKR2.zip!** => pages/
55-
""".trimIndent()
56-
}
57-
}
58-
artifacts(BuildWebHelpFrontend) {
59-
buildRule = lastPinned("+:*")
60-
cleanDestination = true
61-
artifactRules = "+:static.zip!** => static/v3"
62-
}
63-
}
64-
})

.teamcity/kotlinlang/builds/BuildSitePages.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package kotlinlang.builds
22

33
import BuildParams.API_URLS
4+
import documentation.builds.KotlinWithCoroutines
45
import jetbrains.buildServer.configs.kotlin.BuildType
56
import jetbrains.buildServer.configs.kotlin.FailureAction
67
import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep
@@ -141,12 +142,16 @@ object BuildSitePages : BuildType({
141142
}
142143
}
143144

144-
dependency(BuildReferenceDocs) {
145+
dependency(KotlinWithCoroutines) {
145146
snapshot {
146147
onDependencyFailure = FailureAction.FAIL_TO_START
148+
onDependencyCancel = FailureAction.CANCEL
147149
}
148150
artifacts {
149-
artifactRules = "+:docs.zip!** => _webhelp/reference/"
151+
artifactRules = """
152+
+:webHelpImages.zip!** => _webhelp/reference/images/
153+
+:webHelpKR2.zip!** => _webhelp/reference/
154+
""".trimIndent()
150155
}
151156
}
152157
}

.teamcity/kotlinlang/builds/PdfGenerator.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package kotlinlang.builds
22

3+
import documentation.builds.KotlinWithCoroutines
34
import jetbrains.buildServer.configs.kotlin.BuildType
45
import jetbrains.buildServer.configs.kotlin.FailureAction
56
import jetbrains.buildServer.configs.kotlin.buildSteps.script
@@ -52,13 +53,16 @@ object PdfGenerator : BuildType({
5253
}
5354

5455
dependencies {
55-
dependency(BuildReferenceDocs) {
56+
dependency(KotlinWithCoroutines) {
5657
snapshot {
5758
onDependencyFailure = FailureAction.FAIL_TO_START
5859
onDependencyCancel = FailureAction.CANCEL
5960
}
6061
artifacts {
61-
artifactRules = "+:docs.zip!** => dist/docs/"
62+
artifactRules = """
63+
+:webHelpImages.zip!** => dist/docs/images/
64+
+:webHelpKR2.zip!** => dist/docs/
65+
""".trimIndent()
6266
}
6367
}
6468
}

.teamcity/settings.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ project {
2929
subProjectsOrder = arrayListOf(
3030
kotlinlang.SiteProject,
3131
references.BuildApiReferencesProject,
32-
tests.TestsProject
32+
tests.TestsProject,
33+
documentation.DocumentationProject,
3334
).also {
3435
it.forEach { subProject(it) }
3536
}

0 commit comments

Comments
 (0)