-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.gradle
213 lines (171 loc) · 8.85 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
configure(
[project(':iotsys-gateway'),
project(':iotsys-bacnet'), project(':iotsys-bacnet4j'),
project(':iotsys-calimero'), project(':iotsys-coap'),
project(':iotsys-common'), project(':iotsys-control'),
project(':iotsys-demoapp'), project(':iotsys-encoding-json'),
project(':iotsys-enocean'), project(':iotsys-enocean-library'),
project(':iotsys-knx'),
project(':iotsys-mbus'), project(':iotsys-mcast-forwarder'),
project(':iotsys-mdnssd'), project(':iotsys-obix'),
project(':iotsys-osgi'), project(':iotsys-rfid'),
project(':iotsys-tomcat'), project(':iotsys-virtual'),
project(':iotsys-weather-forecast'), project(':iotsys-wmbus'),
project(':iotsys-xacml'), project(':iotsys-xbee')]){
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'eclipse'
group = 'at.ac.tuwien.auto.iotsys'
version = '0.1'
repositories(){
mavenCentral()
maven{
url 'https://repository.jboss.org/nexus/content/repositories/releases/'
url 'https://repository.jboss.org/nexus/content/groups/public/'
}
flatDir { dirs "../lib/californium", "../lib/ektorp"}
}
sourceSets {
main {
java {
srcDir 'src'
}
}
}
task deploy(dependsOn: jar) << {
println "copying $jar.archivePath to $distLib"
ant.copy(file:jar.archivePath, todir:distLib)
}
task deployOsgi(dependsOn: jar) << {
println "copying $jar.archivePath to $felixBundle"
ant.copy(file:jar.archivePath, todir:felixBundle)
}
task clearOsgiCache(dependsOn: jar) << {
ant.delete (includeemptydirs:"true") {
fileset (dir:felixCache, includes:"**/*")
}
}
}
configure(
[project(':obelix')]){
apply plugin: 'eclipse'
}
ext{
configDir = file('iotsys-gateway/config')
resDir = file('iotsys-gateway/res')
knxConfigDir = file('iotsys-gateway/knx-config')
californiumProperties = file('iotsys-gateway/Californium.properties')
distLib = file('dist')
distLibRunFile = file('dist/rungateway.bat')
distLibRunFileSh = file('dist/rungateway.sh')
String felixDir = "felix-framework-4.2.1"
felix = file(felixDir)
felixConfFile = file(felixDir + '/conf/config.properties')
felixBundle = file(felixDir + '/bundle')
felixCache = file(felixDir + '/felix-cache')
}
description = 'IoTSyS - Integration middleware for the Internet of Things'
task deploy << {
ant.echo(message:'java -cp "iotsys-coap-0.1.jar;iotsys-rfid-0.1.jar;iotsys-bacnet-0.1.jar;iotsys-bacnet4j-0.1.jar;iotsys-calimero-0.1.jar;iotsys-common-0.1.jar;iotsys-control-0.1.jar;iotsys-encoding-json-0.1.jar;iotsys-gateway-0.1.jar;iotsys-knx-0.1.jar;iotsys-obix-0.1.jar;iotsys-virtual-0.1.jar;iotsys-wmbus-0.1.jar;iotsys-enocean-0.1.jar;iotsys-enocean-library-0.1.jar;iotsys-xacml-0.1.jar;res;iotsys-demoapp-0.1.jar;iotsys-xbee-0.1.jar;iotsys-mdnssd-0.1.jar;iotsys-tomcat-0.1.jar" at.ac.tuwien.auto.iotsys.gateway.IoTSySGateway', file:distLibRunFile)
ant.echo(message:'IOTSYS_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )${file.separator}"${line.separator}', file:distLibRunFileSh)
ant.echo(message:'cd $IOTSYS_PATH${line.separator}', file:distLibRunFileSh, append:true)
ant.echo(message:'sudo java -cp "${IOTSYS_PATH}iotsys-coap-0.1.jar:${IOTSYS_PATH}iotsys-rfid-0.1.jar:${IOTSYS_PATH}iotsys-bacnet-0.1.jar:${IOTSYS_PATH}iotsys-bacnet4j-0.1.jar:${IOTSYS_PATH}iotsys-calimero-0.1.jar:${IOTSYS_PATH}iotsys-common-0.1.jar:${IOTSYS_PATH}iotsys-control-0.1.jar:${IOTSYS_PATH}iotsys-encoding-json-0.1.jar:${IOTSYS_PATH}iotsys-gateway-0.1.jar:${IOTSYS_PATH}iotsys-knx-0.1.jar:${IOTSYS_PATH}iotsys-obix-0.1.jar:${IOTSYS_PATH}iotsys-virtual-0.1.jar:${IOTSYS_PATH}iotsys-wmbus-0.1.jar:${IOTSYS_PATH}iotsys-enocean-0.1.jar:${IOTSYS_PATH}iotsys-enocean-library-0.1.jar:${IOTSYS_PATH}iotsys-xacml-0.1.jar:${IOTSYS_PATH}res:${IOTSYS_PATH}iotsys-demoapp-0.1.jar:${IOTSYS_PATH}iotsys-xbee-0.1.jar:${IOTSYS_PATH}iotsys-mdnssd-0.1.jar:iotsys-tomcat-0.1.jar" at.ac.tuwien.auto.iotsys.gateway.IoTSySGateway', file:distLibRunFileSh, append:true)
File deployResDir = new File(distLib.absolutePath + '/res')
File deployConfDir = new File(distLib.absolutePath + '/config')
File deployKnxConfDir = new File(distLib.absolutePath + '/knx-config')
File deployCaliforniumProperties = new File(distLib.absolutePath + '/Californium.properties')
ant.copy(todir:deployConfDir){
fileset(dir:configDir)
}
ant.copy(todir:deployResDir){
fileset(dir:resDir)
}
ant.copy(todir:deployKnxConfDir){
fileset(dir:knxConfigDir)
}
if(californiumProperties.exists()){
ant.copy(file:californiumProperties, tofile:deployCaliforniumProperties)
}
else{
println "Californium properties does not exist."
}
}
task deployOsgi << {
File dstConfigDir = new File(felix.absolutePath + '/config')
File dstKnxConfigDir = new File(felix.absolutePath + '/knx-config')
File dstResDir = new File(felix.absolutePath + '/res')
if(felixCache.exists()){
ant.delete (includeemptydirs:"true") {
fileset (dir:felixCache, includes:"**/*")
}
}
if(dstConfigDir.exists()){
println "Copying configuration from " + configDir.absolutePath + " to " + dstConfigDir.absolutePath
ant.copy(todir:dstConfigDir){
fileset(dir:configDir)
}
}
if(dstKnxConfigDir.exists()){
println "Copying configuration from " + knxConfigDir.absolutePath + " to " + dstKnxConfigDir.absolutePath
ant.copy(todir:dstKnxConfigDir){
fileset(dir:knxConfigDir)
}
}
if(dstResDir.exists()){
println "Resource directory already available at " + dstResDir.absolutePath
println "Copying configuration from " + resDir.absolutePath + " to " + dstResDir.absolutePath
ant.copy(todir:dstResDir){
fileset(dir:resDir)
}
}
}
task setupFelix << {
println "Setting up the Felix 4.2 OSGI container at " + felix.absolutePath
println "This task copies the IoTSyS gateway configuration and resource files."
println "It overrides also the OSGI configuration to make required system libraries available!\n\n"
File dstConfigDir = new File(felix.absolutePath + '/config')
File dstResDir = new File(felix.absolutePath + '/res')
File dstKnxConfigDir = new File(felix.absolutePath + '/knx-config')
if(!felix.exists()){
println "Need to download felix 4.2.1 distribution"
ant.get(src:"http://www.auto.tuwien.ac.at/~mjung/org.apache.felix.main.distribution-4.2.1.zip", dest:"org.apache.felix.main.distribution-4.2.1.zip", verbose:true)
ant.unzip(src:"org.apache.felix.main.distribution-4.2.1.zip", dest:file('.').absolutePath)
}
if(dstConfigDir.exists()){
println "Configuration already available at " + dstConfigDir.absolutePath
}
else{
println "Copying configuration from " + configDir.absolutePath + " to " + dstConfigDir.absolutePath
ant.copy(todir:dstConfigDir){
fileset(dir:configDir)
}
}
if(dstKnxConfigDir.exists()){
println "KNX Configuration already available at " + dstKnxConfigDir.absolutePath
}
else{
println "Copying configuration from " + knxConfigDir.absolutePath + " to " + dstKnxConfigDir.absolutePath
ant.copy(todir:dstKnxConfigDir){
fileset(dir:knxConfigDir)
}
}
if(dstResDir.exists()){
println "Resource directory already available at " + dstResDir.absolutePath
}
else{
println "Copying configuration from " + resDir.absolutePath + " to " + dstResDir.absolutePath
ant.copy(todir:dstResDir){
fileset(dir:resDir)
}
}
println "Updating felix config.properties file. Setting org.osgi.framework.system.packages.extra property"
ant.propertyfile(file: felixConfFile.absolutePath){
entry( key: 'org.osgi.framework.system.packages.extra',
value: "javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.naming, javax.naming.directory,"+
"javax.naming.spi, javax.management, javax.management.loading, javax.management.modelmbean, javax.net," +
"javax.net.ssl, javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.security.auth," +
"javax.security.auth.spi, javax.security.auth.callback, javax.security.auth.login," +
"javax.security.cert, javax.xml.parsers, javax.xml.xpath, javax.xml.transform.sax," + "javax.xml.transform.dom, javax.xml.namespace, javax.xml.transform, javax.xml.transform.stream," +
"javax.xml.validation, javax.xml.datatype, org.xml.sax, org.xml.sax.helpers, org.xml.sax.ext," + "org.apache.xalan, org.apache.xalan.res," + "com.sun.org.apache.xml.internal.utils, com.sun.org.apache.xpath.internal," + "com.sun.org.apache.xpath.internal.jaxp, com.sun.org.apache.xpath.internal.objects," + "com.sun.org.apache.xml.internal, org.w3c.dom, org.w3c.dom.traversal, org.w3c.dom.ls, javax.sql," + "javax.transaction, sun.misc, com.sun.org.apache.xerces.internal.jaxp.validation, com.sun.org.apache.xerces.internal.jaxp, javax.naming.ldap, javax.naming, javax.xml.ws, com.sun.xml.internal.ws.api.message")}
}