blob: 796fcacaed72d1869c7c83b8542f1db02c6cd2f4 [file] [log] [blame]
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03001/*
2 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
Kirill Timofeeva5186962017-10-25 14:25:47 +03004
Roman Elizarov9fcb24f2018-03-06 11:25:09 +03005def buildDocsDir = "$buildDir/docs"
6
Roman Elizarov8fc00752017-10-27 13:35:36 +03007task copyDocs(type: Copy, dependsOn: rootProject.getTasksByName("dokka", true)) {
8 from (rootProject.getTasksByName("dokka", true).collect { "$it.project.buildDir/dokka" }) {
Kirill Timofeeva5186962017-10-25 14:25:47 +03009 include "**/*.md"
Roman Elizarovb4180742018-05-16 12:50:36 +030010 include "**/package-list"
Kirill Timofeeva5186962017-10-25 14:25:47 +030011 }
Roman Elizarov8fc00752017-10-27 13:35:36 +030012 from "docs"
Roman Elizarov9fcb24f2018-03-06 11:25:09 +030013 into buildDocsDir
Kirill Timofeeva5186962017-10-25 14:25:47 +030014}
15
Roman Elizarov88f5b9d2017-12-28 17:54:08 +030016task copyExampleFrontendJs(type: Copy, dependsOn: ':example-frontend-js:bundle') {
17 def srcBuildDir = project(':example-frontend-js').buildDir
18 from "$srcBuildDir/dist"
Roman Elizarov9fcb24f2018-03-06 11:25:09 +030019 into "$buildDocsDir/example-frontend-js"
Roman Elizarov88f5b9d2017-12-28 17:54:08 +030020}
21
22task site(type: Exec, description: 'Generate github pages', dependsOn: [copyDocs, copyExampleFrontendJs]) {
Roman Elizarov9fcb24f2018-03-06 11:25:09 +030023 inputs.files(fileTree(buildDocsDir))
24 outputs.dir("$buildDir/dist")
25 workingDir file(buildDocsDir)
Roman Elizarov97943c42018-01-13 12:20:25 +030026 commandLine 'bundle', 'exec', 'jekyll', 'build'
Kirill Timofeeva5186962017-10-25 14:25:47 +030027}
28
29task clean(type: Delete) {
30 delete buildDir
31}
Roman Elizarov88f5b9d2017-12-28 17:54:08 +030032