-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
190 lines (155 loc) · 3.84 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/* Gradle script for build of FIDATA Documentation
Copyright (C) 2014 Basil Peace
This file is part of FIDATA Documentation.
FIDATA Documentation is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
FIDATA Documentation is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with FIDATA Documentation. If not, see
<http://www.gnu.org/licenses/>. */
apply plugin: 'eclipse'
buildscript {
repositories {
jcenter()
maven {
url "$artifactory_contextUrl/plugins-release"
credentials {
username = artifactory_user
password = artifactory_password
}
}
}
dependencies {
classpath(
group: 'org.jfrog.buildinfo',
name: 'build-info-extractor-gradle',
version: '2.2.3'
)
}
}
// Plugins
apply plugin: 'distribution'
apply plugin: 'maven-publish'
apply plugin: 'artifactory-publish'
// Project info
group = 'FIDATA'
version = '0.3-SNAPSHOT'
// buildInfo.build.name = ''
// buildInfo.build.number = ''
// Sources
// sourceSets {
// main { resources { srcDir 'src/site/**' } }
// }
// Tasks
def stagingDir = buildDir
configurations {
compile
runtime
}
dependencies {
compile group: 'FIDATA', name: 'fonts', version: '0.3-SNAPSHOT', ext: 'zip'
compile group: 'FIDATA', name: 'report-template', version: "0.3-SNAPSHOT", ext: 'zip'
}
distributions {
main {
contents {
// TODO: make explicit list of files
// 1. Some images may happen to be converted in *.pdf
// 2. License should be included into documentation
from("$stagingDir") {
include '*.pdf'
}
}
}
}
artifactory {
contextUrl = artifactory_contextUrl
publish {
repository {
repoKey = 'libs-snapshot-local'
username = artifactory_user
password = artifactory_password
maven = true
}
defaults {
publications ('artifactPublication')
}
}
resolve {
repository {
repoKey = 'libs-snapshot'
username = artifactory_user
password = artifactory_password
maven = true
}
}
}
defaultTasks 'all'
task mkStagingDir << {
stagingDir.mkdirs()
}
task copySources(type: Copy) {
dependsOn mkStagingDir
from('src/site/tex') {
include '**'
}
into stagingDir
}
task explodeDeps {
dependsOn mkStagingDir
dependsOn configurations.compile
doLast {
configurations.compile.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact artifact ->
if ((artifact.moduleVersion.id.group == 'FIDATA') && (artifact.moduleVersion.id.name == 'fonts')) {
def fileName = "$stagingDir/${artifact.file.name}" - ".zip"
copy {
from(zipTree(artifact.file))
into stagingDir
}
file("$fileName/fonts").renameTo(file("$stagingDir/fonts"))
file(fileName).delete()
}
if ((artifact.moduleVersion.id.group == 'FIDATA') && (artifact.moduleVersion.id.name == 'report-template')) {
copy {
from(zipTree(artifact.file))
into stagingDir
}
def dir = file("$stagingDir/${artifact.file.name}" - ".zip")
fileTree(dir).each { File f ->
f.renameTo(file("$stagingDir/${f.name}"))
}
dir.delete()
}
}
}
}
task latexmkBuild(type: Exec) {
dependsOn copySources, explodeDeps
workingDir stagingDir
commandLine 'latexmk'
}
task build {
dependsOn latexmkBuild
}
distZip {
dependsOn build
}
artifactoryPublish {
dependsOn distZip
}
task all {
dependsOn artifactoryPublish
}
// Settings
publishing {
publications {
artifactPublication(MavenPublication) { // TODO: classifiers
artifact("$buildDir/distributions/${project.name}-${project.version}.zip")
}
}
}