-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
111 lines (95 loc) · 3.04 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
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'org.nosphere.apache.rat' version '0.3.0'
id 'org.ajoberstar.grgit' version '1.6.0'
}
apply plugin: 'org.ajoberstar.grgit'
task clean << {
delete buildDir
}
def dockerCmd = "docker run -v '${projectDir}':/geode-site -p 3000:3000 -w /geode-site/website apachegeode/geode-site-build "
task compile(type:Exec, dependsOn: rat) {
inputs.dir "${projectDir}/website"
outputs.dir "${buildDir}/content"
executable 'bash'
args "-c", dockerCmd + "nanoc compile"
}
task view(type:Exec, dependsOn: compile) {
executable 'bash'
args "-c", dockerCmd + "nanoc view"
}
task publish(dependsOn: compile) {
doLast {
def branch = grgit.branch.current.name
if (branch != 'master') {
throw new GradleException("Cannot publish from branch ${branch}, only from master")
}
def status = grgit.branch.status(name: 'master')
if (status.aheadCount != 0) {
throw new GradleException("Cannot publish with $status.aheadCount unpushed changes")
}
grgit.checkout(branch: 'asf-site')
grgit.pull()
copy {
from "${buildDir}/content"
into projectDir
}
}
}
rat {
xmlOutput = false
htmlOutput = false
plainOutput = true
excludes = [
// git
'.git/**',
'**/.gitignore',
'**/.gitkeep',
// gradle
'**/.gradle/**',
'gradle/wrapper/gradle-wrapper.properties',
'caches/**',
'daemon/**',
'native/**',
'wrapper/**',
'build/**',
// geode-site: Adding exceptions to MIT/BSD licensed files
'website/content/js/head.js',
'website/content/js/html5shiv.js',
'website/content/js/jquery-1.10.1.min.js',
'website/content/js/jquery.icheck.js',
'website/content/js/respond.min.js',
'website/content/css/bootflat-extensions.css',
'website/content/css/bootflat-square.css',
'website/content/css/bootflat.css',
'website/content/css/font-awesome.min.css',
'website/lib/pandoc.template',
'website/content/font/**',
'website/content/fonts/**',
'website/content/stylesheets/**',
// graphics
'website/content/docs/guide/**/*.svg',
// compiled logs and locks
'website/utilities/markers.txt',
'website/tmp/**',
'website/layouts/**',
]
}
task assemble {
description "Empty task for travis to call. Travis always invokes assemble"
}