diff --git a/site/build.gradle b/site/build.gradle deleted file mode 100644 index 6b2c5b7916..0000000000 --- a/site/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -def buildDocsDir = "$buildDir/docs" -def jekyllDockerImage = "jekyll/jekyll:$jekyll_version" - -task copyDocs(type: Copy, dependsOn: rootProject.getTasksByName("dokka", true)) { - from (rootProject.getTasksByName("dokka", true).collect { "$it.project.buildDir/dokka" }) { - include "**/*.md" - include "**/package-list" - } - from "docs" - into buildDocsDir -} - -task copyExampleFrontendJs(type: Copy, dependsOn: ':example-frontend-js:bundle') { - def srcBuildDir = project(':example-frontend-js').buildDir - from "$srcBuildDir/dist" - into "$buildDocsDir/example-frontend-js" -} - -task site(type: Exec, description: 'Generate github pages', dependsOn: [copyDocs, copyExampleFrontendJs]) { - 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' -} - -// A useful task for local debugging -- serves a site locally -task serve(type: Exec, dependsOn: [copyDocs, copyExampleFrontendJs]) { - 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' -} - -task clean(type: Delete) { - delete buildDir -} - diff --git a/site/build.gradle.kts b/site/build.gradle.kts new file mode 100644 index 0000000000..450589729e --- /dev/null +++ b/site/build.gradle.kts @@ -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("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("copyExampleFrontendJs") { + val srcBuildDir = project(":example-frontend-js").buildDir + from("$srcBuildDir/dist") + into("$buildDocsDir/example-frontend-js") + + dependsOn(":example-frontend-js:bundle") +} + +tasks.register("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("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("clean") { + delete(buildDir) +} +