From d37d62574c9e8aa7d549eb7c7e744ad4a21e2db6 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 27 Dec 2020 07:21:39 +0100 Subject: [PATCH] project restructure --- .idea/libraries/dbus_java_3_2_4.xml | 2 +- .idea/modules.xml | 1 + compiler/build.gradle | 13 +-- .../src/prog8/server/dbus/IrmenDbusTest.kt | 22 ---- compiler/src/prog8/server/dbus/clientmain.kt | 17 ---- compiler/src/prog8/server/dbus/testdbus.kt | 18 ---- dbusCompilerService/build.gradle | 95 ++++++++++++++++++ dbusCompilerService/dbusCompilerService.iml | 14 +++ .../lib/dbus-java-3.2.4.jar | Bin .../src/prog8/dbus/IrmenDbusTest.kt | 22 ++++ .../src/prog8/dbus/clientmain.kt | 17 ++++ .../src/prog8/dbus/testdbus.kt | 18 ++++ settings.gradle | 1 + 13 files changed, 171 insertions(+), 69 deletions(-) delete mode 100644 compiler/src/prog8/server/dbus/IrmenDbusTest.kt delete mode 100644 compiler/src/prog8/server/dbus/clientmain.kt delete mode 100644 compiler/src/prog8/server/dbus/testdbus.kt create mode 100644 dbusCompilerService/build.gradle create mode 100644 dbusCompilerService/dbusCompilerService.iml rename {compiler => dbusCompilerService}/lib/dbus-java-3.2.4.jar (100%) create mode 100644 dbusCompilerService/src/prog8/dbus/IrmenDbusTest.kt create mode 100644 dbusCompilerService/src/prog8/dbus/clientmain.kt create mode 100644 dbusCompilerService/src/prog8/dbus/testdbus.kt diff --git a/.idea/libraries/dbus_java_3_2_4.xml b/.idea/libraries/dbus_java_3_2_4.xml index 6acd1b359..bdfe4eb8d 100644 --- a/.idea/libraries/dbus_java_3_2_4.xml +++ b/.idea/libraries/dbus_java_3_2_4.xml @@ -1,7 +1,7 @@ - + diff --git a/.idea/modules.xml b/.idea/modules.xml index dbde0842a..68aa97a25 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,6 +3,7 @@ + diff --git a/compiler/build.gradle b/compiler/build.gradle index b5dc39077..ecdc690ac 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -1,20 +1,11 @@ -buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21" - } -} - plugins { - // id "org.jetbrains.kotlin.jvm" version "1.4.21" + id 'java' id 'application' + id "org.jetbrains.kotlin.jvm" version "1.4.21" id 'org.jetbrains.dokka' version "0.9.18" id 'com.github.johnrengelman.shadow' version '5.2.0' - id 'java' } -apply plugin: "kotlin" -apply plugin: "java" - targetCompatibility = 11 sourceCompatibility = 11 diff --git a/compiler/src/prog8/server/dbus/IrmenDbusTest.kt b/compiler/src/prog8/server/dbus/IrmenDbusTest.kt deleted file mode 100644 index 80c81dbac..000000000 --- a/compiler/src/prog8/server/dbus/IrmenDbusTest.kt +++ /dev/null @@ -1,22 +0,0 @@ -package prog8.server.dbus - -//import org.freedesktop.dbus.interfaces.DBusInterface -// -// -//interface IrmenDbusTest: DBusInterface -//{ -// fun Status(address: String): Map -//} -// -// -//internal class TestService: IrmenDbusTest { -// override fun Status(address: String): Map { -// return mapOf( -// 5 to "hello", -// 42 to address -// ) -// } -// -// override fun isRemote() = true -// override fun getObjectPath() = "/razorvine/TestService" -//} diff --git a/compiler/src/prog8/server/dbus/clientmain.kt b/compiler/src/prog8/server/dbus/clientmain.kt deleted file mode 100644 index 76ec64ebc..000000000 --- a/compiler/src/prog8/server/dbus/clientmain.kt +++ /dev/null @@ -1,17 +0,0 @@ -package prog8.server.dbus - - -//import org.freedesktop.dbus.connections.impl.DBusConnection -// -// -//fun main() { -// DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION).use { -// println(it.names.toList()) -// println(it.uniqueName) -// println(it.address) -// println(it.machineId) -// val obj = it.getRemoteObject("local.net.razorvine.dbus.test", "/razorvine/TestService", IrmenDbusTest::class.java) -// println(obj.Status("irmen")) -// } -//} -// diff --git a/compiler/src/prog8/server/dbus/testdbus.kt b/compiler/src/prog8/server/dbus/testdbus.kt deleted file mode 100644 index ad38aaef4..000000000 --- a/compiler/src/prog8/server/dbus/testdbus.kt +++ /dev/null @@ -1,18 +0,0 @@ -package prog8.server.dbus - -//import org.freedesktop.dbus.connections.impl.DBusConnection -// -// -//fun main() { -// DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION).use { -// it.requestBusName("local.net.razorvine.dbus.test") -// println(it.names.toList()) -// println(it.uniqueName) -// println(it.address) -// println(it.machineId) -// val service = TestService() -// it.exportObject(service.objectPath, service) -// -// Thread.sleep(100000) -// } -//} diff --git a/dbusCompilerService/build.gradle b/dbusCompilerService/build.gradle new file mode 100644 index 000000000..ea9a6b75c --- /dev/null +++ b/dbusCompilerService/build.gradle @@ -0,0 +1,95 @@ + +plugins { + id 'java' + id 'application' + id "org.jetbrains.kotlin.jvm" version "1.4.21" + id 'com.github.johnrengelman.shadow' version '5.2.0' +} + +targetCompatibility = 11 +sourceCompatibility = 11 + +repositories { + mavenLocal() + mavenCentral() + maven { url "https://kotlin.bintray.com/kotlinx" } +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" + // implementation "org.jetbrains.kotlin:kotlin-reflect" + implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.1' + implementation "com.github.hypfvieh:dbus-java:3.2.4" + implementation "org.slf4j:slf4j-simple:1.7.30" + + testImplementation "org.jetbrains.kotlin:kotlin-test-junit5" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.2' + testImplementation 'org.hamcrest:hamcrest-junit:2.0.0.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.2' +} + +compileKotlin { + kotlinOptions { + jvmTarget = "11" + // verbose = true + // freeCompilerArgs += "-XXLanguage:+NewInference" + } +} + +compileTestKotlin { + kotlinOptions { + jvmTarget = "11" + } +} + +sourceSets { + main { + java { + srcDirs = ["${project.projectDir}/src"] + } + resources { + srcDirs = ["${project.projectDir}/res"] + } + } + test { + java { + srcDirs = ["${project.projectDir}/test"] + } + } +} + +startScripts.enabled = false + +application { + mainClassName = 'prog8.dbus.TestdbusKt' + applicationName = 'testdbus' +} + +artifacts { + archives shadowJar +} + + +shadowJar { + archiveBaseName = 'prog8compilerservice' + archiveVersion = '1.0' + // minimize() +} + + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "skipped", "failed" + } +} + +task wrapper(type: Wrapper) { + gradleVersion = '6.1.1' +} diff --git a/dbusCompilerService/dbusCompilerService.iml b/dbusCompilerService/dbusCompilerService.iml new file mode 100644 index 000000000..9cc8bc298 --- /dev/null +++ b/dbusCompilerService/dbusCompilerService.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/compiler/lib/dbus-java-3.2.4.jar b/dbusCompilerService/lib/dbus-java-3.2.4.jar similarity index 100% rename from compiler/lib/dbus-java-3.2.4.jar rename to dbusCompilerService/lib/dbus-java-3.2.4.jar diff --git a/dbusCompilerService/src/prog8/dbus/IrmenDbusTest.kt b/dbusCompilerService/src/prog8/dbus/IrmenDbusTest.kt new file mode 100644 index 000000000..0788f1b33 --- /dev/null +++ b/dbusCompilerService/src/prog8/dbus/IrmenDbusTest.kt @@ -0,0 +1,22 @@ +package prog8.dbus + +import org.freedesktop.dbus.interfaces.DBusInterface + + +interface IrmenDbusTest: DBusInterface +{ + fun Status(address: String): Map +} + + +internal class TestService: IrmenDbusTest { + override fun Status(address: String): Map { + return mapOf( + 5 to "hello", + 42 to address + ) + } + + override fun isRemote() = true + override fun getObjectPath() = "/razorvine/TestService" +} diff --git a/dbusCompilerService/src/prog8/dbus/clientmain.kt b/dbusCompilerService/src/prog8/dbus/clientmain.kt new file mode 100644 index 000000000..994daa0c3 --- /dev/null +++ b/dbusCompilerService/src/prog8/dbus/clientmain.kt @@ -0,0 +1,17 @@ +package prog8.dbus + + +import org.freedesktop.dbus.connections.impl.DBusConnection + + +fun main() { + DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION).use { + println(it.names.toList()) + println(it.uniqueName) + println(it.address) + println(it.machineId) + val obj = it.getRemoteObject("local.net.razorvine.dbus.test", "/razorvine/TestService", IrmenDbusTest::class.java) + println(obj.Status("irmen")) + } +} + diff --git a/dbusCompilerService/src/prog8/dbus/testdbus.kt b/dbusCompilerService/src/prog8/dbus/testdbus.kt new file mode 100644 index 000000000..382cc2d02 --- /dev/null +++ b/dbusCompilerService/src/prog8/dbus/testdbus.kt @@ -0,0 +1,18 @@ +package prog8.dbus + +import org.freedesktop.dbus.connections.impl.DBusConnection + + +fun main() { + DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION).use { + it.requestBusName("local.net.razorvine.dbus.test") + println(it.names.toList()) + println(it.uniqueName) + println(it.address) + println(it.machineId) + val service = TestService() + it.exportObject(service.objectPath, service) + + Thread.sleep(100000) + } +} diff --git a/settings.gradle b/settings.gradle index d0e60f756..98e5ef872 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,3 @@ include ':parser' include ':compiler' +include ':dbusCompilerService'