Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
214 lines (171 sloc) 8.85 KB
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")}
}