-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Set and Map java\kotlin types are not supported in the frontend using the Set and Map of typescript, because its not type safe and is an empty object when passed as parameter. - "contained" not a valid descriptor in pom.xml.
- Loading branch information
Showing
8 changed files
with
260 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>app.coffee</groupId> | ||
<artifactId>kotlin-maven</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<kotlin.code.style>official</kotlin.code.style> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<kotlin.version>1.9.22</kotlin.version> | ||
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>mavenCentral</id> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
</repository> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
</repositories> | ||
|
||
<build> | ||
<sourceDirectory>src/main/kotlin</sourceDirectory> | ||
<testSourceDirectory>src/test/kotlin</testSourceDirectory> | ||
<plugins> | ||
<!-- run mvn clean compile assembly:single to create self-contained jar --> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>MainKt</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
<version>1.9.21</version> | ||
<executions> | ||
<execution> | ||
<id>compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>test-compile</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>test-compile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>2.22.2</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.6.0</version> | ||
<configuration> | ||
<mainClass>MainKt</mainClass> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>11</source> | ||
<target>11</target> | ||
<includes> | ||
<include>**/*.java</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.YairLevi</groupId> | ||
<artifactId>Coffee</artifactId> | ||
<version>0.1.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-test-junit5</artifactId> | ||
<version>1.9.21</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>5.10.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib</artifactId> | ||
<version>1.9.21</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import org.levi.coffee.Ipc | ||
import org.levi.coffee.annotations.BindAllMethods | ||
|
||
@BindAllMethods | ||
class App( | ||
val persons: MutableList<Person> = mutableListOf() | ||
) { | ||
fun newPerson(person: Person) { | ||
persons.add(person) | ||
Ipc.invoke("ppl-count") | ||
} | ||
|
||
fun getPersonsByName(name: String): Person { | ||
return persons.first { it.name == name } | ||
} | ||
|
||
fun getAll(): List<Person> { | ||
return persons | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import org.levi.coffee.Ipc | ||
import org.levi.coffee.Window | ||
|
||
fun main() { | ||
val w = Window(dev = true) | ||
w.setSize(800, 600) | ||
w.setURL("http://localhost:5173") | ||
w.setTitle("Kotlin coffee app!") | ||
|
||
w.bind( | ||
App(), | ||
Person() | ||
) | ||
w.run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import org.levi.coffee.annotations.BindType | ||
|
||
@BindType | ||
class Person( | ||
var age: Int = 0, | ||
var name: String = "", | ||
var hobbies: MutableSet<String> = mutableSetOf() | ||
) { | ||
fun addHobby(hobby: String) { | ||
hobbies.add(hobby) | ||
} | ||
|
||
fun removeHobby(hobby: String) { | ||
hobbies.remove(hobby) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
import org.levi.coffee.Window | ||
import org.levi.coffee.annotations.BindType | ||
|
||
@BindType | ||
class App( | ||
val name: String = "", | ||
val age: Int = 0, | ||
val list: List<String> = emptyList(), | ||
val set: Set<String> = emptySet(), | ||
val map: Map<String, Int> = emptyMap(), | ||
val complex: Map<String, List<Set<App>>> = emptyMap() | ||
) | ||
|
||
fun main() { | ||
// val win = Window(isDev = true) | ||
// win.setSize(700, 700) | ||
// win.setTitle("My first Javatron app!") | ||
// | ||
// win.setURL("http://localhost:5173") | ||
// win.bind( | ||
// Calculator(), | ||
// ) | ||
// | ||
// win.addBeforeStartCallback { println("Started app...") } | ||
// win.addOnCloseCallback { println("Closed the app!") } | ||
// | ||
// win.run() | ||
val win = Window(dev = true) | ||
win.setSize(700, 700) | ||
win.setTitle("My first Javatron app!") | ||
|
||
win.setURL("http://localhost:5173") | ||
win.bind( | ||
App() | ||
) | ||
|
||
win.addBeforeStartCallback { println("Started app...") } | ||
win.addOnCloseCallback { println("Closed the app!") } | ||
|
||
win.run() | ||
} |