Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| 3 | */ |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 4 | |
Roman Elizarov | 9fcb24f | 2018-03-06 11:25:09 +0300 | [diff] [blame] | 5 | def buildDocsDir = "$buildDir/docs" |
| 6 | |
Roman Elizarov | 8fc0075 | 2017-10-27 13:35:36 +0300 | [diff] [blame] | 7 | task copyDocs(type: Copy, dependsOn: rootProject.getTasksByName("dokka", true)) { |
| 8 | from (rootProject.getTasksByName("dokka", true).collect { "$it.project.buildDir/dokka" }) { |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 9 | include "**/*.md" |
Roman Elizarov | b418074 | 2018-05-16 12:50:36 +0300 | [diff] [blame] | 10 | include "**/package-list" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 11 | } |
Roman Elizarov | 8fc0075 | 2017-10-27 13:35:36 +0300 | [diff] [blame] | 12 | from "docs" |
Roman Elizarov | 9fcb24f | 2018-03-06 11:25:09 +0300 | [diff] [blame] | 13 | into buildDocsDir |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 14 | } |
| 15 | |
Roman Elizarov | 88f5b9d | 2017-12-28 17:54:08 +0300 | [diff] [blame] | 16 | task copyExampleFrontendJs(type: Copy, dependsOn: ':example-frontend-js:bundle') { |
| 17 | def srcBuildDir = project(':example-frontend-js').buildDir |
| 18 | from "$srcBuildDir/dist" |
Roman Elizarov | 9fcb24f | 2018-03-06 11:25:09 +0300 | [diff] [blame] | 19 | into "$buildDocsDir/example-frontend-js" |
Roman Elizarov | 88f5b9d | 2017-12-28 17:54:08 +0300 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | task site(type: Exec, description: 'Generate github pages', dependsOn: [copyDocs, copyExampleFrontendJs]) { |
Roman Elizarov | 9fcb24f | 2018-03-06 11:25:09 +0300 | [diff] [blame] | 23 | inputs.files(fileTree(buildDocsDir)) |
| 24 | outputs.dir("$buildDir/dist") |
| 25 | workingDir file(buildDocsDir) |
Roman Elizarov | 97943c4 | 2018-01-13 12:20:25 +0300 | [diff] [blame] | 26 | commandLine 'bundle', 'exec', 'jekyll', 'build' |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | task clean(type: Delete) { |
| 30 | delete buildDir |
| 31 | } |
Roman Elizarov | 88f5b9d | 2017-12-28 17:54:08 +0300 | [diff] [blame] | 32 | |