forked from grails/grails-doc
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
118 lines (91 loc) · 3.5 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
apply plugin: "base"
version = System.getProperty("grails.version") ?: "2.0.2"
archivesBaseName = "grails-docs"
ext.checkOutDir = "${buildDir.path}/checkout"
ext.outputDir = "${buildDir.path}/docs"
ext.explicitGrailsHome = System.getProperty("grails.home")
ext.grailsHome = explicitGrailsHome ? file(explicitGrailsHome).absolutePath : "$checkOutDir/grails-src"
configurations {
publish
}
buildscript {
repositories {
mavenRepo url: "http://repo.grails.org/grails/core"
}
dependencies {
classpath "org.grails:grails-docs:2.0.3"
}
}
task fetchGrailsSource << {
ant.mkdir dir: checkOutDir
println "Downloading Grails source code. If you already have a copy " +
"of the Grails source code checked out you can avoid this download " +
"by setting the grails.home system property to point to your local " +
"copy of the source. See README.txt for more information."
def zipFile = "${checkOutDir}/grails-src.zip"
ant.get src: "http://github.com/grails/grails-core/zipball/2.0.x", dest: zipFile, verbose: true
ant.unzip src: zipFile, dest: checkOutDir, {
mapper type: "regexp", from: "(grails-grails-core-\\S*?/)(.*)", to: "grails-src/\\2"
}
println "Grails source code has been downloaded to ${relativePath(grailsHome)}"
}
fetchGrailsSource.onlyIf { !explicitGrailsHome }
task apiDocs(type: GradleBuild, dependsOn: 'fetchGrailsSource') {
tasks = ["groovydoc"]
buildFile = "${project.grailsHome}/build.gradle"
}
apiDocs.onlyIf { !System.getProperty("disable.groovydocs") }
task copyApiDocs(type: Copy) {
from "${project.grailsHome}/doc/api"
into "${outputDir}/api"
}
task migrate(type: grails.doc.gradle.MigrateLegacyDocs)
task publishGuide(type: grails.doc.gradle.PublishGuide, dependsOn: ['apiDocs', 'copyApiDocs']) {
def searchDirs = project.file(project.grailsHome).listFiles().findAll {
new File(it, "src/main/groovy/org/codehaus/groovy/grails").exists()
}.collect {
new File(it, "src/main/groovy/org/codehaus/groovy/grails")
}
// No language setting because we want the English guide to be
// generated with a 'en' in the path, but the source is in 'en'
// so that it's easy to track with git.
sourceDir = new File(projectDir, "src/en")
propertiesFiles = [ new File(project.grailsHome, "build.properties") ]
macros = [ new grails.doc.macros.GspTagSourceMacro(searchDirs) ]
}
task publishPdf(type: grails.doc.gradle.PublishPdf, dependsOn: ['publishGuide'])
tasks.addRule("Pattern: publishGuide_<lang>") { String taskName ->
def m = taskName =~ /publishGuide_(\w+)/
if (m) {
def lang = m[0][1]
task(taskName, type: grails.doc.gradle.PublishGuide, dependsOn: ['apiDocs', 'copyApiDocs']) {
language = lang
}
}
}
tasks.addRule("Pattern: publishPdf_<lang>") { String taskName ->
def m = taskName =~ /publishPdf_(\w+)/
if (m) {
def lang = m[0][1]
task(taskName, type: grails.doc.gradle.PublishPdf, dependsOn: "publishGuide_${lang}") {
language = lang
}
}
}
task docs(dependsOn: ['publishPdf'])
if (!System.getProperty("en.only")) {
for (f in new File(projectDir, "src").listFiles()) {
if (f.directory && !(f.name in ["en", "guide", "ref"])) {
docs.dependsOn << "publishPdf_${f.name}"
}
}
}
task dist(type: Zip, dependsOn: 'docs') {
from outputDir
}
artifacts {
archives dist
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-9'
}