forked from aim42/aim42
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
119 lines (92 loc) · 2.98 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// gradle build script for the aim42 documentation
//
// free software - without guarantee, use at your own risk
// ========================================================
println """compiling with Java ${System.getProperty("java.version")}"""
println "building project version " + project.project_version
buildscript {
// these are the BUILDSCRIPT deps - required to execute
// build targets and -operations
repositories {
maven {
name 'Bintray Asciidoctor repo'
url 'http://dl.bintray.com/content/aalmiray/asciidoctor'
}
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
mavenCentral()
}
dependencies {
classpath ('gradle.plugin.org.aim42:htmlSanityCheck:0.9.7')
classpath ( group: 'org.asciidoctor',
name: 'asciidoctor-gradle-plugin',
version: '1.5.6')
}
}
ext {
srcDir = "$projectDir/src/main"
targetDir = "$buildDir/docs"
currentDate = new Date().format("MMM d. yyyy")
}
// =========== asciidoctor stuff ===============
apply plugin: 'org.asciidoctor.convert'
asciidoctor {
outputDir = file( targetDir )
sourceDir = file("$srcDir/asciidoc")
sources { include "index.adoc" }
attributes = [
separateOutputDirs: false,
imagesdir : 'images',
doctype: 'book',
icons: 'font',
toc: 'left',
sectlink: true,
sectanchors: true,
numbered: true,
'source-highlighter': 'coderay',
'coderay-css': 'class',
stylesheet: 'aim42.css',
stylesdir: "$srcDir/resources/css/",
version: project.project_version,
'currentDate': "$currentDate"
]
resources {
from("${srcDir}/resources/") {
include 'images/**'
}
from("${srcDir}/resources/") {
include 'docs/**'
}
}
}
defaultTasks 'aim42'
task aim42(
dependsOn: 'htmlSanityCheck',
description: 'collects all required tasks for creating aim42 documentation'
)
task publish(type: GradleBuild) {
String travisPr = System.getenv('TRAVIS_PULL_REQUEST')
if ("false".equals(travisPr)) {
buildFile = 'publish.gradle'
tasks = ['gitPublishPush']
} else {
println 'env var TRAVIS_PULL_REQUEST says we build for PR #' + travisPr + ', won\'t publish docs!'
}
}
// ============ validation
apply plugin: 'org.aim42.htmlSanityCheck'
htmlSanityCheck {
// ensure asciidoctor->html runs first
// and images are copied to build directory
dependsOn asciidoctor
sourceDir = new File( "$targetDir/html5" )
// files to check, in Set-notation
sourceDocuments = [ "index.html"]
// where to put results of sanityChecks...
checkingResultsDir = new File( "$buildDir/report/htmlchecks" )
// false: restrict checks to local resources
// true: also check external (e.g. http, https...) links.
checkExternalLinks = false
}