forked from Kotlin/kotlinx.coroutines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
62 lines (48 loc) · 1.62 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
val buildDocsDir = "$buildDir/docs"
val jekyllDockerImage = "jekyll/jekyll:${version("jekyll")}"
val copyDocs = tasks.register<Copy>("copyDocs") {
val dokkaTasks = rootProject.getTasksByName("dokka", true)
from(dokkaTasks.map { "${it.project.buildDir}/dokka" }) {
include("**/*.md")
include("**/package-list")
}
from("docs")
into(buildDocsDir)
dependsOn(dokkaTasks)
}
val copyExampleFrontendJs = tasks.register<Copy>("copyExampleFrontendJs") {
val srcBuildDir = project(":example-frontend-js").buildDir
from("$srcBuildDir/dist")
into("$buildDocsDir/example-frontend-js")
dependsOn(":example-frontend-js:bundle")
}
tasks.register<Exec>("site") {
description = "Generate github pages"
inputs.files(fileTree(buildDocsDir))
outputs.dir("$buildDir/dist")
workingDir = file(buildDocsDir)
commandLine(
"docker", "run", "--rm", "--volume=$buildDir:/srv/jekyll",
"-t", jekyllDockerImage,
"/bin/bash", "-c", "cd docs; jekyll build"
)
dependsOn(copyDocs)
dependsOn(copyExampleFrontendJs)
}
// A useful task for local debugging -- serves a site locally
tasks.register<Exec>("serve") {
commandLine(
"docker", "run", "--rm", "--volume=$buildDir:/srv/jekyll",
"-p", "8080:8080",
"-t", jekyllDockerImage,
"/bin/bash", "-c", "cd docs; jekyll serve --host 0.0.0.0 --port 8080"
)
dependsOn(copyDocs)
dependsOn(copyExampleFrontendJs)
}
tasks.register<Delete>("clean") {
delete(buildDir)
}