This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
forked from beanit/iec61850bean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
287 lines (232 loc) · 6.89 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath group: "org.asciidoctor", name: "asciidoctorj-pdf", version: "1.5.0-alpha.16"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:3.5.0"
}
}
plugins {
id "org.asciidoctor.convert" version "1.5.6"
id "net.saliman.cobertura" version "2.5.1"
}
apply plugin: "org.asciidoctor.convert"
apply from: "configuration.gradle"
asciidoctor {
backends = ["pdf", "html5"]
attributes "stylesheet": "openmuc-asciidoc.css",
"toc2": "left",
"sampleSrc": file("src/sample/java"),
"source-highlighter" : "coderay",
"pdf-stylesdir": "./",
"pdf-style": "pdf"
resources {
from("$sourceDir") {
include "images/**"
}
}
}
configure(allprojects) {
version = cfgVersion
}
configure(javaProjects) {
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "osgi"
apply plugin: "maven"
apply plugin: "signing"
apply plugin: "biz.aQute.bnd.builder"
apply plugin: 'net.saliman.cobertura'
uploadArchives.enabled = false
group = cfgGroup
if (!project.properties.containsKey('cfgJavaVersion')) {
project.ext {
cfgJavaVersion = '1.7'
}
}
sourceCompatibility = cfgJavaVersion
targetCompatibility = cfgJavaVersion
repositories {
mavenCentral()
mavenLocal()
}
sourceSets {
sample
itest {
compileClasspath += sourceSets.main.runtimeClasspath
}
}
dependencies {
testCompile group: "junit", name: "junit", version: "4.12"
itestCompile group: "junit", name: "junit", version: "4.12"
}
jar {
manifest {
version = project.version.replace("-",".");
}
}
cobertura {
dependencies {
testCompile 'org.slf4j:slf4j-simple:1.6.1'
}
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = false
coverageIgnores = ['org.slf4j.Logger.*']
coverageExcludes = ['.*\\.app\\..*', '.*\\.cli-app\\..*', '.*\\.sample\\..*']
coverageReportDir = new File("$buildDir/reports/cobertura")
coverageTestTasks {
project.tasks.withType(Test).matching {it.name == 'test'}
}
}
task jarAll(type: Copy) {
dependsOn(configurations.default.getAllArtifacts().getBuildDependencies())
//only the jar file created:
from configurations.default.getAllArtifacts().getFiles()
if (cfgCopyDependencies) {
if (cfgCopyToRoot) {
into rootDir.getPath() + "/build/libs-all"
}
else {
into "build/libs-all"
}
//includes all the dependencies:
from configurations.default
}
else {
if (cfgCopyToRoot) {
into rootDir.getPath() + "/build/libs-all"
}
else {
into "build/libs-all"
}
}
}
build.dependsOn {asciidoctor}
build.dependsOn {jarAll}
eclipse.pathVariables([GRADLE_USER_HOME:file(gradle.gradleUserHomeDir)])
tasks.eclipse.dependsOn(cleanEclipse)
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
javadoc {
exclude "**/internal/**"
exclude "**/java-gen/**"
exclude "**/app/**"
}
}
configure(repositoryProjects) {
uploadArchives.enabled = true
if (cfgSignPom) {
signing {
if ( project.hasProperty("signing.keyId") ) {
sign configurations.archives
}
}
}
uploadArchives {
repositories {
mavenDeployer {
if (cfgSignPom) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: cfgRepository) {
authentication(userName: cfgRepositoryUser, password: cfgRepositoryPass)
if (cfgRepository != null && System.getProperty("https.proxyHost") != null && ((System.getProperty("https.nonProxyHosts") == null) || !cfgRepository.contains(System.getProperty("https.nonProxyHosts")))) {
proxy(host: System.getProperty("https.proxyHost"), port: Integer.parseInt(System.getProperty("https.proxyPort")), type: "https")
}
}
snapshotRepository(url: cfgSnapshotRepository) {
authentication(userName: cfgRepositoryUser, password: cfgRepositoryPass)
if (cfgSnapshotRepository != null && System.getProperty("https.proxyHost") != null && ((System.getProperty("https.nonProxyHosts") == null) || !cfgSnapshotRepository.contains(System.getProperty("https.nonProxyHosts")))) {
proxy(host: System.getProperty("https.proxyHost"), port: Integer.parseInt(System.getProperty("https.proxyPort")), type: "https")
}
}
pom.project {
//additional pom information can be found in subproject build.gradle files
packaging "jar"
url "http://www.openmuc.org/"
scm {
url "none"
connection "none"
}
developers {
developer {
id "openmuc"
name "OpenMUC Team"
}
}
}
}
}
}
}
task javadocAll(type: Javadoc) {
source docProjects.collect {
project -> project.sourceSets.main.allJava
}
exclude "**/internal/**"
exclude "**/java-gen/**"
exclude "**/app/**"
destinationDir = new File(buildDir, "docs/javadoc-all")
classpath = files(distributionProjects.collect { project ->
project.sourceSets.main.compileClasspath })
classpath += files(distributionProjects.collect { project ->
project.sourceSets.main.output })
}
task writeSettings {
doLast {
Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle"));
out.write("include ");
boolean first = true;
for (Project myproject: distributionProjects) {
if (!myproject.getProjectDir().equals(getProjectDir())) {
if (first == true) {
first = false;
}
else {
out.write ", ";
}
out.write '"' + myproject.name + '"'
}
}
out .write "\n\n";
for (Project myproject: distributionProjects) {
if (myproject.getProjectDir().equals(getProjectDir())) {
continue;
}
println myproject.name
out.write 'project(":' + myproject.name + '").projectDir = file("' + myproject.getProjectDir().toString().substring((int)(getProjectDir().toString().size() + 1)) + '")\n';
}
out.close();
}
}
task buildDistProjects {
dependsOn(distributionProjects.build)
}
tasks.withType(Tar) {
dependsOn(writeSettings)
dependsOn(distributionProjects.build)
dependsOn(javadocAll)
dependsOn(asciidoctor)
compression = Compression.GZIP
destinationDir = file("build/distributions/")
}
task (tar, type: Tar) {
archiveName = project.name + "-" + project.version + ".tgz"
}
task (tarFull, type: Tar) {
dependsOn(tar)
archiveName = project.name + "-" + project.version + "_full.tgz"
}