Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin DSL - 'site' #1954

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions site/build.gradle

This file was deleted.

62 changes: 62 additions & 0 deletions site/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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)
}