This repository has been archived by the owner on May 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
executable file
·74 lines (62 loc) · 1.95 KB
/
build.gradle
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
62
63
64
65
66
67
68
69
70
71
72
73
74
buildscript {
repositories {
jcenter()
maven { url 'http://dl.bintray.com/content/aalmiray/kordamp' }
maven { url 'http://dl.bintray.com/melix/jbake-gradle-plugin' }
mavenLocal()
}
dependencies {
classpath 'org.kordamp:markdown-gradle-plugin:0.1.1'
classpath 'me.champeau.gradle:jbake-gradle-plugin:0.1'
classpath 'org.freemarker:freemarker:2.3.19'
}
}
apply plugin: 'java'
apply plugin: 'org.kordamp.gradle.markdown'
apply plugin: 'jbake'
def arc42InputDir = 'src/arc42-markdown/'
def jbakeDir = 'src/jbake/'
repositories {
mavenCentral()
}
dependencies {
compile 'net.sourceforge.plantuml:plantuml:8020'
}
task generatePlantumlImages(type: JavaExec) {
main 'net.sourceforge.plantuml.Run'
classpath configurations.runtime
// environment GRAPHVIZ_DOT: '/path/to/dot'
args arc42InputDir + '**/*.puml'
}
task addPagesToSearch(type: Copy) {
from 'src/assets/'
into jbakeDir + 'assets/js/'
include 'arcdoc.js'
filter { line ->
def pages = ''
fileTree(dir: arc42InputDir, include: '**/*.md').each {
def path = it.path
def startIndex = path.indexOf(arc42InputDir) + arc42InputDir.length()
def page = path.getAt(startIndex..-3) + "html"
pages += '"' + page + '", '
}
line.replaceAll('/\\* DO NOT REMOVE, WILL BE FILLED BY GRADLE \\*/', pages[0..-3])
}
}
task copyMarkdown(type: Copy) {
from arc42InputDir
into jbakeDir + 'content/'
include '**/*.md'
filter { line ->
line.replaceAll(/\[(.*)\]\((.*)(\.md)(.*)\)/) { all, caption, preSuffix, suffix, postSuffix ->
"[${caption}](${preSuffix}.html${postSuffix})"
}
}
}
task copyGraphics(type: Copy) {
from arc42InputDir
into jbakeDir + 'assets/'
include '**/*.png'
includeEmptyDirs = false
}
defaultTasks 'generatePlantumlImages', 'addPagesToSearch', 'copyMarkdown', 'copyGraphics', 'jbake'