diff --git a/.gitignore b/.gitignore
index a670f96d3..1113d1ce4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,5 @@ parsetab.py
.gradle
/prog8compiler.jar
+sd*.img
+
diff --git a/.idea/libraries/javax_json_api_1_1_4.xml b/.idea/libraries/javax_json_api_1_1_4.xml
new file mode 100644
index 000000000..967286d8c
--- /dev/null
+++ b/.idea/libraries/javax_json_api_1_1_4.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/slf4j_api_1_7_30.xml b/.idea/libraries/slf4j_api_1_7_30.xml
new file mode 100644
index 000000000..20de6d972
--- /dev/null
+++ b/.idea/libraries/slf4j_api_1_7_30.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/takes_http.xml b/.idea/libraries/takes_http.xml
new file mode 100644
index 000000000..0fdcac0d5
--- /dev/null
+++ b/.idea/libraries/takes_http.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 68aa97a25..fce41442a 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -6,6 +6,7 @@
+
diff --git a/dbusCompilerService/build.gradle b/dbusCompilerService/build.gradle
index ea9a6b75c..af47e54d5 100644
--- a/dbusCompilerService/build.gradle
+++ b/dbusCompilerService/build.gradle
@@ -58,7 +58,7 @@ sourceSets {
}
}
-startScripts.enabled = false
+startScripts.enabled = true
application {
mainClassName = 'prog8.dbus.TestdbusKt'
@@ -71,7 +71,7 @@ artifacts {
shadowJar {
- archiveBaseName = 'prog8compilerservice'
+ archiveBaseName = 'prog8compilerservicedbus'
archiveVersion = '1.0'
// minimize()
}
diff --git a/httpCompilerService/build.gradle b/httpCompilerService/build.gradle
new file mode 100644
index 000000000..af641714e
--- /dev/null
+++ b/httpCompilerService/build.gradle
@@ -0,0 +1,98 @@
+
+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 project(':compiler')
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
+ // implementation "org.jetbrains.kotlin:kotlin-reflect"
+ implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.1'
+ implementation "org.takes:takes:1.19"
+ implementation "javax.json:javax.json-api:1.1.4"
+ implementation "org.glassfish:javax.json:1.1.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 = true
+
+application {
+ mainClassName = 'prog8.http.TestHttpKt'
+ applicationName = 'testhttp'
+}
+
+artifacts {
+ archives shadowJar
+}
+
+
+shadowJar {
+ archiveBaseName = 'prog8compilerservicehttp'
+ 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/httpCompilerService/httpCompilerService.iml b/httpCompilerService/httpCompilerService.iml
new file mode 100644
index 000000000..a65181582
--- /dev/null
+++ b/httpCompilerService/httpCompilerService.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/httpCompilerService/lib/cactoos-0.42.jar b/httpCompilerService/lib/cactoos-0.42.jar
new file mode 100644
index 000000000..d06fb37c8
Binary files /dev/null and b/httpCompilerService/lib/cactoos-0.42.jar differ
diff --git a/httpCompilerService/lib/commons-lang3-3.7.jar b/httpCompilerService/lib/commons-lang3-3.7.jar
new file mode 100644
index 000000000..f37ded60f
Binary files /dev/null and b/httpCompilerService/lib/commons-lang3-3.7.jar differ
diff --git a/httpCompilerService/lib/commons-text-1.4.jar b/httpCompilerService/lib/commons-text-1.4.jar
new file mode 100644
index 000000000..3e81a797c
Binary files /dev/null and b/httpCompilerService/lib/commons-text-1.4.jar differ
diff --git a/httpCompilerService/lib/javax.json-1.1.4.jar b/httpCompilerService/lib/javax.json-1.1.4.jar
new file mode 100644
index 000000000..f6ca0cc43
Binary files /dev/null and b/httpCompilerService/lib/javax.json-1.1.4.jar differ
diff --git a/httpCompilerService/lib/javax.json-api-1.1.4.jar b/httpCompilerService/lib/javax.json-api-1.1.4.jar
new file mode 100644
index 000000000..367f0ad4e
Binary files /dev/null and b/httpCompilerService/lib/javax.json-api-1.1.4.jar differ
diff --git a/httpCompilerService/lib/slf4j-api-1.7.30.jar b/httpCompilerService/lib/slf4j-api-1.7.30.jar
new file mode 100644
index 000000000..29ac26fb8
Binary files /dev/null and b/httpCompilerService/lib/slf4j-api-1.7.30.jar differ
diff --git a/httpCompilerService/lib/slf4j-simple-1.7.30.jar b/httpCompilerService/lib/slf4j-simple-1.7.30.jar
new file mode 100644
index 000000000..6debaa9de
Binary files /dev/null and b/httpCompilerService/lib/slf4j-simple-1.7.30.jar differ
diff --git a/httpCompilerService/lib/takes-1.19.jar b/httpCompilerService/lib/takes-1.19.jar
new file mode 100644
index 000000000..f118aceaf
Binary files /dev/null and b/httpCompilerService/lib/takes-1.19.jar differ
diff --git a/httpCompilerService/src/prog8/http/TestHttp.kt b/httpCompilerService/src/prog8/http/TestHttp.kt
new file mode 100644
index 000000000..e46e8c946
--- /dev/null
+++ b/httpCompilerService/src/prog8/http/TestHttp.kt
@@ -0,0 +1,52 @@
+package prog8.http
+
+import org.takes.Request
+import org.takes.Response
+import org.takes.Take
+import org.takes.facets.fork.FkMethods
+import org.takes.http.Exit;
+import org.takes.http.FtBasic;
+import org.takes.facets.fork.FkRegex;
+import org.takes.facets.fork.TkFork;
+import org.takes.rq.form.RqFormBase
+import org.takes.rs.RsJson
+import org.takes.tk.TkSlf4j
+import javax.json.Json
+import prog8.compiler.compileProgram
+import java.nio.file.Path
+
+
+class Jsonding: RsJson.Source {
+ override fun toJson(): javax.json.JsonStructure {
+ return Json.createObjectBuilder()
+ .add("name", "irmen")
+ .build()
+ }
+}
+
+class RequestParser : Take {
+ override fun act(request: Request): Response {
+ val form = RqFormBase(request)
+ val names = form.names()
+ val a = form.param("a").single()
+ val compilationResult = compileProgram(Path.of(a), true, true, true, "c64", Path.of("."))
+ return RsJson(Jsonding())
+ }
+}
+
+fun main() {
+ FtBasic(
+ TkSlf4j(
+ TkFork(
+ FkRegex("/", "hello, world!"),
+ FkRegex("/json",
+ TkFork(
+ FkMethods("GET", RsJson(Jsonding())),
+ FkMethods("POST", RequestParser())
+ )
+ ),
+ )
+ ),
+ 8080
+ ).start(Exit.NEVER)
+}
diff --git a/settings.gradle b/settings.gradle
index 98e5ef872..0555e0871 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,4 @@
include ':parser'
include ':compiler'
include ':dbusCompilerService'
+include ':httpCompilerService'