forked from ow2-proactive/proactive-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
executable file
·202 lines (173 loc) · 5.91 KB
/
build.gradle
File metadata and controls
executable file
·202 lines (173 loc) · 5.91 KB
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
import com.github.jk1.license.render.*
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.github.jk1:gradle-license-report:1.7'
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.1"
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
}
}
repositories {
if (project.hasProperty('local')) {
mavenLocal()
}
mavenCentral()
maven {
url "http://repository.activeeon.com/content/groups/proactive/"
}
}
group 'org.ow2.proactive'
version projectVersion
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: "io.spring.dependency-management"
apply plugin: "com.github.johnrengelman.shadow"
licenseReport {
configurations = ['runtime']
renderers = [new InventoryHtmlReportRenderer()]
}
ext.findSourceFiles = { folder ->
def tree = fileTree(folder)
tree.include '*/resources/**'
tree.include '*/METADATA.json'
tree.include 'ordered_bucket_list'
tree.exclude 'classes'
tree.exclude 'build'
tree.exclude 'libs'
tree.exclude 'tmp'
tree.exclude 'reports'
tree.exclude 'test-results'
tree.exclude 'gradle'
tree.exclude '.gradle'
tree.exclude '.git'
tree.exclude '.idea'
tree.exclude 'src'
tree.exclude 'proactive-examples.zip'
return tree
}
task copyAll (type: Copy) {
destinationDir = file('build/')
from findSourceFiles('.')
}
class AddCopyrightsTask extends DefaultTask {
FileTree fileTree;
def getDate() {
return new Date().format('yyyy')
}
def errorIfCopyrightPresent(fileName, lines) {
lines.forEach({ line -> if (line.contains("Copyright Activeeon")) {
throw new RuntimeException("Error in " + fileName + ", line " + line + " contains copyright information, please remove it");
}})
}
@TaskAction
def exec() {
fileTree.forEach({ file ->
def lines = file.readLines()
def fileName = file.getName()
def fileHandled = false;
if (fileName.endsWith(".xml")) {
errorIfCopyrightPresent(fileName, lines)
lines = lines.plus(1, "<!-- Copyright Activeeon 2007-" + getDate() + ". All rights reserved. -->")
fileHandled = true
} else if (fileName.endsWith(".groovy")) {
errorIfCopyrightPresent(fileName, lines)
lines = lines.plus(0, "// Copyright Activeeon 2007-" + getDate() + ". All rights reserved.")
fileHandled = true
} else if (fileName.endsWith(".py")) {
errorIfCopyrightPresent(fileName, lines)
lines = lines.plus(0, "# Copyright Activeeon 2007-" + getDate() + ". All rights reserved.")
fileHandled = true
} else if (fileName.endsWith(".sh") || fileName.endsWith(".bash")) {
errorIfCopyrightPresent(fileName, lines)
if (lines.get(0) != null && lines.get(0).startsWith("#!")) {
lines = lines.plus(1, "# Copyright Activeeon 2007-" + getDate() + ". All rights reserved.")
} else {
lines = lines.plus(0, "# Copyright Activeeon 2007-" + getDate() + ". All rights reserved.")
}
fileHandled = true
}
if (fileHandled) {
def modifiedFileText = lines.join(System.lineSeparator())
Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "UTF8"));
out.append(modifiedFileText.toString())
out.flush()
}
})
}
}
ConfigurableFileTree objectsTree = findSourceFiles('build')
task addCopyrights (type: AddCopyrightsTask) {
fileTree = objectsTree
}
task zip (type: Zip){
archiveName="proactive-examples.zip"
destinationDir = file('build/')
from findSourceFiles('build')
}
configurations {
awsJar
azureJar
restJar
}
dependencies {
awsJar 'com.amazonaws:aws-java-sdk-s3:1.11.228'
azureJar 'com.microsoft.azure:azure-storage-blob:10.0.3-Preview'
restJar ('io.rest-assured:rest-assured:3.3.0') {
exclude group: 'org.codehaus.groovy'
}
restJar ('io.rest-assured:json-path:3.3.0') {
exclude group: 'org.codehaus.groovy'
}
restJar ('io.rest-assured:xml-path:3.3.0') {
exclude group: 'org.codehaus.groovy'
exclude group: 'com.sun.xml.bind'
exclude group: 'javax.xml.bind'
}
}
test {
dependencies {
compile "org.ow2.proactive:scheduler-api:$version"
compile 'junit:junit:4.12'
compile 'com.googlecode.json-simple:json-simple:1.1'
testCompile 'org.hamcrest:java-hamcrest:2.0.0.0'
}
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.228'
}
}
task shadowJarAzure(type: ShadowJar) {
archiveName = 'azure-storage-blob-fat-10.0.3-Preview.jar'
configurations = [project.configurations.azureJar]
exclude 'META-INF/**'
destinationDir = file("./DataConnectors/resources/dataspace/")
}
task shadowJarAws(type: ShadowJar) {
configurations = [project.configurations.awsJar]
archiveName = 'aws-java-sdk-fat-1.11.228.jar'
exclude 'META-INF/**'
destinationDir = file("./DataConnectors/resources/dataspace/")
}
task shadowJarRest(type: ShadowJar) {
configurations = [project.configurations.restJar]
archiveName = 'rest-assured-fat-3.3.0.jar'
exclude 'META-INF/**'
destinationDir = file("./Rest/resources/dataspace/")
}
addCopyrights.dependsOn(copyAll)
test.dependsOn addCopyrights
test.dependsOn shadowJarAws
test.dependsOn shadowJarAzure
test.dependsOn shadowJarRest
zip.dependsOn test
build.dependsOn zip
defaultTasks 'clean', 'test', 'zip'