diff --git a/.classpath b/.classpath
deleted file mode 100755
index 489b7d6c..00000000
--- a/.classpath
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
index 6ea56641..e56aff06 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,12 @@
-/screenlog.0*
+# Configuration and dependencies
/hal.conf
/hal.db*
-build
/lib/zutil-*
+
+# Runtime files
+/screenlog.0*
/OZW_Log.txt
-/zwscene.xml
-/zwcfg*.xml
+
+# Build and Ide files
+build
+.gradle
diff --git a/.project b/.project
deleted file mode 100644
index 2656b0ff..00000000
--- a/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- hal
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/Hal.iml b/Hal.iml
deleted file mode 100755
index b1470533..00000000
--- a/Hal.iml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
index 7b264f28..631624dd 100755
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -3,28 +3,27 @@ node {
// Configure environment
env.JAVA_HOME = tool name: 'jdk8'
env.REPO_URL = "repo.koc.se/hal.git" //scm.getUserRemoteConfigs()[0].getUrl()
- env.BUILD_NAME = "BUILD-" + env.BUILD_ID
+ env.BUILD_NAME = "BUILD-${env.BUILD_ID}"
checkout scm
stage('Build') {
- sh 'ant clean'
- sh 'ant build-all'
+ sh './gradlew clean'
+ sh './gradle build'
}
stage('Test') {
try {
- sh 'ant test-all'
+ sh './gradlew test'
} finally {
- step([$class: 'JUnitResultArchiver', testResults: 'build/reports/*.xml'])
+ step([$class: 'JUnitResultArchiver', testResults: 'build/test-results/test/*.xml'])
}
}
-
stage('Package') {
- sh 'ant package-all'
- archiveArtifacts artifacts: 'build/release/**', fingerprint: true
+ sh './gradlew distZip'
+ archiveArtifacts artifacts: 'build/distributions/Hal.zip', fingerprint: true
// Tag artifact
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491',
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 00000000..6352cc95
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,81 @@
+plugins {
+ id 'java'
+ id 'application'
+}
+
+allprojects {
+ apply plugin: 'java'
+
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ jcenter()
+ }
+
+ dependencies {
+ implementation 'se.koc:zutil:1.0.253'
+
+ testImplementation 'junit:junit:4.12'
+ testImplementation 'org.hamcrest:hamcrest-core:2.2'
+ }
+
+ sourceSets {
+ main {
+ java {
+ srcDirs 'src'
+ }
+ resources {
+ srcDir 'resource'
+ }
+ }
+ test {
+ java {
+ srcDirs 'test'
+ }
+ }
+ }
+}
+
+// ------------------------------------
+// Hal core configuration
+// ------------------------------------
+
+dependencies {
+ implementation 'org.xerial:sqlite-jdbc:3.32.3.2'
+}
+
+sourceSets {
+ main {
+ java {
+ exclude 'se/hal/SpeechManager.java'
+ exclude 'se/hal/tts/**'
+ exclude 'se/hal/bot/**'
+ exclude 'se/hal/stt/**'
+ }
+ resources {
+ exclude 'bots/**'
+ exclude 'marytts/**'
+ exclude 'sphinx-models/**'
+ }
+ }
+}
+
+distributions {
+ main {
+ contents {
+ from 'hal.conf.example'
+ from 'hal-default.db'
+ from 'logging.properties'
+ }
+ }
+}
+
+// ------------------------------------
+// Hal plugin common configuration
+// ------------------------------------
+
+subprojects {
+ dependencies {
+ implementation project(':')
+ }
+}
\ No newline at end of file
diff --git a/build.xml b/build.xml
deleted file mode 100755
index c4111d91..00000000
--- a/build.xml
+++ /dev/null
@@ -1,200 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build_plugin.xml b/build_plugin.xml
deleted file mode 100755
index 229481ce..00000000
--- a/build_plugin.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-assistant-google/build.gradle b/plugins/hal-assistant-google/build.gradle
new file mode 100644
index 00000000..31ca0b6a
--- /dev/null
+++ b/plugins/hal-assistant-google/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+ implementation 'com.google.actions:actions-on-google:1.8.0'
+}
diff --git a/plugins/hal-mqtt/build.gradle b/plugins/hal-mqtt/build.gradle
new file mode 100644
index 00000000..2e3ca6ab
--- /dev/null
+++ b/plugins/hal-mqtt/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+
+}
diff --git a/plugins/hal-mqtt/build.xml b/plugins/hal-mqtt/build.xml
deleted file mode 100644
index b89bfb7b..00000000
--- a/plugins/hal-mqtt/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-netscan/build.gradle b/plugins/hal-netscan/build.gradle
new file mode 100644
index 00000000..2e3ca6ab
--- /dev/null
+++ b/plugins/hal-netscan/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+
+}
diff --git a/plugins/hal-netscan/build.xml b/plugins/hal-netscan/build.xml
deleted file mode 100644
index 38dda20c..00000000
--- a/plugins/hal-netscan/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-nutups/build.gradle b/plugins/hal-nutups/build.gradle
new file mode 100644
index 00000000..2e3ca6ab
--- /dev/null
+++ b/plugins/hal-nutups/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+
+}
diff --git a/plugins/hal-nutups/build.xml b/plugins/hal-nutups/build.xml
deleted file mode 100644
index e2d94a23..00000000
--- a/plugins/hal-nutups/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-powerchallenge/build.gradle b/plugins/hal-powerchallenge/build.gradle
new file mode 100644
index 00000000..2e3ca6ab
--- /dev/null
+++ b/plugins/hal-powerchallenge/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+
+}
diff --git a/plugins/hal-powerchallenge/build.xml b/plugins/hal-powerchallenge/build.xml
deleted file mode 100644
index c210a678..00000000
--- a/plugins/hal-powerchallenge/build.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-raspberry/build.gradle b/plugins/hal-raspberry/build.gradle
new file mode 100644
index 00000000..67e8afe0
--- /dev/null
+++ b/plugins/hal-raspberry/build.gradle
@@ -0,0 +1,6 @@
+dependencies {
+ implementation 'com.pi4j:pi4j-core:1.1'
+ implementation 'com.pi4j:pi4j-device:1.1'
+ implementation 'com.pi4j:pi4j-gpio-extension:1.1'
+ implementation 'com.pi4j:pi4j-service:1.1'
+}
diff --git a/plugins/hal-raspberry/build.xml b/plugins/hal-raspberry/build.xml
deleted file mode 100644
index 33028f85..00000000
--- a/plugins/hal-raspberry/build.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-raspberry/lib/pi4j-core-1.1.jar b/plugins/hal-raspberry/lib/pi4j-core-1.1.jar
deleted file mode 100644
index 021a6c7e..00000000
Binary files a/plugins/hal-raspberry/lib/pi4j-core-1.1.jar and /dev/null differ
diff --git a/plugins/hal-raspberry/lib/pi4j-device-1.1.jar b/plugins/hal-raspberry/lib/pi4j-device-1.1.jar
deleted file mode 100644
index 9bd96903..00000000
Binary files a/plugins/hal-raspberry/lib/pi4j-device-1.1.jar and /dev/null differ
diff --git a/plugins/hal-raspberry/lib/pi4j-gpio-extension-1.1.jar b/plugins/hal-raspberry/lib/pi4j-gpio-extension-1.1.jar
deleted file mode 100644
index 32a3cbcb..00000000
Binary files a/plugins/hal-raspberry/lib/pi4j-gpio-extension-1.1.jar and /dev/null differ
diff --git a/plugins/hal-raspberry/lib/pi4j-service-1.1.jar b/plugins/hal-raspberry/lib/pi4j-service-1.1.jar
deleted file mode 100644
index 9e19f0c3..00000000
Binary files a/plugins/hal-raspberry/lib/pi4j-service-1.1.jar and /dev/null differ
diff --git a/plugins/hal-raspberry/lib/pi4j.LICENSE.txt b/plugins/hal-raspberry/lib/pi4j.LICENSE.txt
deleted file mode 100644
index cca7fc27..00000000
--- a/plugins/hal-raspberry/lib/pi4j.LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/plugins/hal-raspberry/lib/pi4j.NOTICE.txt b/plugins/hal-raspberry/lib/pi4j.NOTICE.txt
deleted file mode 100644
index 1da9e7b0..00000000
--- a/plugins/hal-raspberry/lib/pi4j.NOTICE.txt
+++ /dev/null
@@ -1,33 +0,0 @@
- =========================================================================
- Pi4J :: Java library for Raspberry Pi
- =========================================================================
-
- Pi4J Library
- Copyright (C) 2012-2016 Pi4J.com
-
- This product includes software developed at:
- The Pi4J Project (http://www.pi4j.com/).
-
- This product was originally authored by: Robert Savage
-
- This software is licensed under the GNU LGPLv3 license.
- More information about licensing terms can be found at:
- http://pi4j.com/license.html
-
- Additional information about this project and its authors can be found at:
- - http://www.pi4j.com/
- - http://www.raspicentral.com
- - http://www.savagehomeautomation.com
-
- This software compiles against libraries from the WiringPi project.
- The Wiring Pi project is provided by Gordon Henderson and is available
- from
- http://wiringpi.com/
-
- The WiringPi project is licensed under the GNU LGPLv3 license
- http://www.gnu.org/licenses/lgpl.html
-
- =========================================================================
- Subject to the terms of the software license, this NOTICE file must be
- included in any Derivative Works that You distribute as a readable copy.
- (Section 4d)
diff --git a/plugins/hal-tellstick/build.gradle b/plugins/hal-tellstick/build.gradle
new file mode 100644
index 00000000..0c3a0b10
--- /dev/null
+++ b/plugins/hal-tellstick/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+ implementation 'com.fazecast:jSerialComm:1.3.11'
+}
diff --git a/plugins/hal-tellstick/build.xml b/plugins/hal-tellstick/build.xml
deleted file mode 100644
index 34fddbfd..00000000
--- a/plugins/hal-tellstick/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-zigbee/build.gradle b/plugins/hal-zigbee/build.gradle
new file mode 100644
index 00000000..2e3ca6ab
--- /dev/null
+++ b/plugins/hal-zigbee/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+
+}
diff --git a/plugins/hal-zigbee/build.xml b/plugins/hal-zigbee/build.xml
deleted file mode 100755
index 49087e36..00000000
--- a/plugins/hal-zigbee/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/hal-zwave/build.gradle b/plugins/hal-zwave/build.gradle
new file mode 100644
index 00000000..a16699a2
--- /dev/null
+++ b/plugins/hal-zwave/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+ implementation 'com.github.zgmnkv:zwave4j:0.3'
+}
diff --git a/plugins/hal-zwave/build.xml b/plugins/hal-zwave/build.xml
deleted file mode 100644
index 37c121a3..00000000
--- a/plugins/hal-zwave/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/run.sh b/run.sh
index e53654f3..4b01521a 100755
--- a/run.sh
+++ b/run.sh
@@ -6,7 +6,7 @@ ant package-all
# Kill current session
screen -S hal -X kill
# Start new session
-screen -S hal -L -d -m ant run
+screen -S hal -L -d -m ./gradlew run
echo "-----------------"
screen -list
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 00000000..6bec40a4
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,9 @@
+import static groovy.io.FileType.*
+
+rootProject.name = "Hal"
+
+new File(rootDir, "plugins").traverse(type: DIRECTORIES) {dir->
+ if (new File(dir, '/build.gradle').exists()) {
+ include "plugins:${dir.getName()}"
+ }
+}
\ No newline at end of file
diff --git a/src/se/hal/ControllerManager.java b/src/se/hal/ControllerManager.java
index 37afce15..bf6c303a 100755
--- a/src/se/hal/ControllerManager.java
+++ b/src/se/hal/ControllerManager.java
@@ -1,6 +1,5 @@
package se.hal;
-import com.google.common.collect.Lists;
import se.hal.intf.*;
import se.hal.struct.Event;
import se.hal.struct.Sensor;