project restructure

This commit is contained in:
Irmen de Jong 2020-12-27 07:21:39 +01:00
parent f2380457d6
commit d37d62574c
13 changed files with 171 additions and 69 deletions

View File

@ -1,7 +1,7 @@
<component name="libraryTable">
<library name="dbus-java-3.2.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/compiler/lib/dbus-java-3.2.4.jar!/" />
<root url="jar://$PROJECT_DIR$/dbusCompilerService/lib/dbus-java-3.2.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -3,6 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/compiler/compiler.iml" filepath="$PROJECT_DIR$/compiler/compiler.iml" />
<module fileurl="file://$PROJECT_DIR$/dbusCompilerService/dbusCompilerService.iml" filepath="$PROJECT_DIR$/dbusCompilerService/dbusCompilerService.iml" />
<module fileurl="file://$PROJECT_DIR$/docs/docs.iml" filepath="$PROJECT_DIR$/docs/docs.iml" />
<module fileurl="file://$PROJECT_DIR$/examples/examples.iml" filepath="$PROJECT_DIR$/examples/examples.iml" />
<module fileurl="file://$PROJECT_DIR$/parser/parser.iml" filepath="$PROJECT_DIR$/parser/parser.iml" />

View File

@ -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

View File

@ -1,22 +0,0 @@
package prog8.server.dbus
//import org.freedesktop.dbus.interfaces.DBusInterface
//
//
//interface IrmenDbusTest: DBusInterface
//{
// fun Status(address: String): Map<Int, String>
//}
//
//
//internal class TestService: IrmenDbusTest {
// override fun Status(address: String): Map<Int, String> {
// return mapOf(
// 5 to "hello",
// 42 to address
// )
// }
//
// override fun isRemote() = true
// override fun getObjectPath() = "/razorvine/TestService"
//}

View File

@ -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"))
// }
//}
//

View File

@ -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)
// }
//}

View File

@ -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'
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../dbusCompilerService">
<sourceFolder url="file://$MODULE_DIR$/../dbusCompilerService/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="11" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="library" name="kotlinx-cli-jvm" level="project" />
<orderEntry type="library" name="dbus-java-3.2.4" level="project" />
</component>
</module>

View File

@ -0,0 +1,22 @@
package prog8.dbus
import org.freedesktop.dbus.interfaces.DBusInterface
interface IrmenDbusTest: DBusInterface
{
fun Status(address: String): Map<Int, String>
}
internal class TestService: IrmenDbusTest {
override fun Status(address: String): Map<Int, String> {
return mapOf(
5 to "hello",
42 to address
)
}
override fun isRemote() = true
override fun getObjectPath() = "/razorvine/TestService"
}

View File

@ -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"))
}
}

View File

@ -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)
}
}

View File

@ -1,2 +1,3 @@
include ':parser'
include ':compiler'
include ':dbusCompilerService'