-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
118 lines (85 loc) · 2.71 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
buildscript {
repositories {
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
// in case of mavenLocal(), the following line is valid:
classpath(group: 'org.aim42',
// in case of using the official Gradle plugin repository:
//classpath (group: 'gradle.plugin.org.aim42',
name: 'htmlSanityCheck',
version: '1.1.4')
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.8'
}
project.version = "0.4.1"
// ==== path definitions =====
// ===========================
ext {
srcDir = "$projectDir/src/docs/asciidoc"
// location of images used in AsciiDoc documentation
srcImagesPath = "$srcDir/images"
// results of asciidoc compilation (HTML)
// (input for htmlSanityCheck)
// this is the default path for asciidoc-gradle-convert
htmlOutputPath = "$buildDir"
// images used by generated html
targetImagesPath = "$buildDir/images"
}
// ==== asciidoctor ==========
// ===========================
apply plugin: 'org.asciidoctor.convert'
asciidoctor {
outputDir = file(buildDir)
sourceDir = file(srcDir)
sources {
include "many-errors.adoc", "no-errors.adoc", "regressions.adoc"
}
attributes = [
doctype : 'book',
icons : 'font',
sectlink : true,
sectanchors: true]
resources {
from(srcImagesPath) { include '**' }
into "./images"
}
}
// ========================================================
apply plugin: 'org.aim42.htmlSanityCheck'
htmlSanityCheck {
// ensure asciidoctor->html runs first
// and images are copied to build directory
dependsOn asciidoctor
sourceDir = new File("${buildDir}/html5")
// files to check
sourceDocuments = fileTree(sourceDir) {
include "no-errors.html", "many-errors.html", "regressions.html"
}
// fail the build if any error is encountered
failOnErrors = false
// set the http connection timeout to 2 secs
httpConnectionTimeout = 2000
ignoreLocalHost = false
ignoreIPAddresses = false
}
// when called without arguments, gradle will execute the default:
defaultTasks 'htmlSanityCheck'
task info(
description: "info on several paths"
) { doLast
{
println "=" * 100
println "project.name : " + project.name
println "projectDir : " + projectDir
println "buildDir : " + buildDir
println "source images : " + srcImagesPath
println "asciidoc html output : " + htmlOutputPath
println "target images path : " + targetImagesPath
}
}