Skip to content

Commit

Permalink
Upgrade to KVision 7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaros committed Aug 17, 2023
1 parent c09c6b4 commit b13b080
Show file tree
Hide file tree
Showing 823 changed files with 2,322 additions and 3,294 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,18 @@ endpoints). The example project utilizes:
The architecture of the project is heavily based on Kotlin coroutines, wrapping asynchronous client-server calls into
easy-to-read synchronous-like code.

[See live demo on Heroku](https://kvision-address-book.herokuapp.com/)

## Number converter - fullstack

A simple application to convert integer numbers to words by using JVM [Tradukisto](https://github.com/allegro/tradukisto) library.

[See live demo on Heroku](https://kvision-numbers.herokuapp.com/)

## Encoder - fullstack

A simple application to encode the given text, based on the overview chapter from the [KVision guide](https://kvision.gitbook.io/kvision-guide/part-3-server-side-interface/overview).

[See live demo on Heroku](https://kvision-encoder.herokuapp.com/)

## Tweets - fullstack

A simple, multiplatform, message board application based on websocket communication.

[See live demo on Heroku](https://kvision-tweets.herokuapp.com/)

## Template - fullstack

A fullstack application template (versions for all supported frameworks). A starting point for a new application.
Expand Down
4 changes: 2 additions & 2 deletions addressbook-fullstack-javalin/.gettext.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
}
],
"glob": {
"pattern": "src/**/*.kt"
"pattern": "src/jsMain/**/*.kt"
}
},
"headers": {
"Language": ""
},
"output": "src/frontendMain/resources/i18n/messages.pot"
"output": "src/jsMain/resources/i18n/messages.pot"
}
16 changes: 8 additions & 8 deletions addressbook-fullstack-javalin/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## Gradle Tasks

### Resource Processing
* generatePotFile - Generates a `src/frontendMain/resources/i18n/messages.pot` translation template file.
* generatePotFile - Generates a `src/jsMain/resources/i18n/messages.pot` translation template file.
### Compiling
* compileKotlinFrontend - Compiles frontend sources.
* compileKotlinBackend - Compiles backend sources.
* compileKotlinJs - Compiles frontend sources.
* compileKotlinJvm - Compiles backend sources.
### Running
* frontendRun - Starts a webpack dev server on port 3000
* backendRun - Starts a dev server on port 8080
* jsRun - Starts a webpack dev server on port 3000
* jvmRun - Starts a dev server on port 8080
### Packaging
* frontendBrowserWebpack - Bundles the compiled js files into `build/distributions`
* frontendJar - Packages a standalone "web" frontend jar with all required files into `build/libs/*.jar`
* backendJar - Packages a backend jar with compiled source files into `build/libs/*.jar`
* jsBrowserWebpack - Bundles the compiled js files into `build/dist/js/productionExecutable`
* jsJar - Packages a standalone "web" frontend jar with all required files into `build/libs/*.jar`
* jvmJar - Packages a backend jar with compiled source files into `build/libs/*.jar`
* jar - Packages a "fat" jar with all backend sources and dependencies while also embedding frontend resources into `build/libs/*.jar`
116 changes: 21 additions & 95 deletions addressbook-fullstack-javalin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig

plugins {
Expand Down Expand Up @@ -29,26 +29,26 @@ val kweryVersion: String by project
val commonsCodecVersion: String by project
val jdbcNamedParametersVersion: String by project

val webDir = file("src/frontendMain/web")
val mainClassName = "com.example.MainKt"

kotlin {
jvm("backend") {
jvmToolchain(17)
jvm {
withJava()
compilations.all {
java {
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
@OptIn(ExperimentalKotlinGradlePluginApi::class)
mainRun {
mainClass.set(mainClassName)
}
}
js("frontend") {
js(IR) {
browser {
runTask {
outputFileName = "main.bundle.js"
runTask(Action {
mainOutputFileName = "main.bundle.js"
sourceMaps = false
devServer = KotlinWebpackConfig.DevServer(
open = false,
Expand All @@ -59,17 +59,17 @@ kotlin {
"/logout" to "http://localhost:8080",
"/kvws/*" to mapOf("target" to "ws://localhost:8080", "ws" to true)
),
static = mutableListOf("$buildDir/processedResources/frontend/main")
static = mutableListOf("$buildDir/processedResources/js/main")
)
}
webpackTask {
outputFileName = "main.bundle.js"
}
testTask {
})
webpackTask(Action {
mainOutputFileName = "main.bundle.js"
})
testTask(Action {
useKarma {
useChromeHeadless()
}
}
})
}
binaries.executable()
}
Expand All @@ -78,15 +78,14 @@ kotlin {
dependencies {
api("io.kvision:kvision-server-javalin:$kvisionVersion")
}
kotlin.srcDir("build/generated-src/common")
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val backendMain by getting {
val jvmMain by getting {
dependencies {
implementation(kotlin("reflect"))
implementation("org.slf4j:slf4j-simple:$slf4jVersion")
Expand All @@ -99,99 +98,26 @@ kotlin {
implementation("com.github.andrewoma.kwery:core:$kweryVersion")
}
}
val backendTest by getting {
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
val frontendMain by getting {
resources.srcDir(webDir)
val jsMain by getting {
dependencies {
implementation("io.kvision:kvision:$kvisionVersion")
implementation("io.kvision:kvision-bootstrap:$kvisionVersion")
implementation("io.kvision:kvision-state:$kvisionVersion")
implementation("io.kvision:kvision-fontawesome:$kvisionVersion")
implementation("io.kvision:kvision-i18n:$kvisionVersion")
}
kotlin.srcDir("build/generated-src/frontend")
}
val frontendTest by getting {
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
implementation("io.kvision:kvision-testutils:$kvisionVersion")
}
}
}
}

afterEvaluate {
tasks {
create("frontendArchive", Jar::class).apply {
dependsOn("frontendBrowserProductionWebpack")
group = "package"
archiveAppendix.set("frontend")
val distribution =
project.tasks.getByName("frontendBrowserProductionWebpack", KotlinWebpack::class).destinationDirectory!!
from(distribution) {
include("*.*")
}
from(webDir)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
into("/assets")
inputs.files(distribution, webDir)
outputs.file(archiveFile)
manifest {
attributes(
mapOf(
"Implementation-Title" to rootProject.name,
"Implementation-Group" to rootProject.group,
"Implementation-Version" to rootProject.version,
"Timestamp" to System.currentTimeMillis()
)
)
}
}
getByName("backendProcessResources", Copy::class) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
getByName("backendJar").group = "package"
create("shadowJar", Jar::class).apply {
dependsOn("frontendArchive", "backendJar")
group = "package"
manifest {
attributes(
mapOf(
"Implementation-Title" to rootProject.name,
"Implementation-Group" to rootProject.group,
"Implementation-Version" to rootProject.version,
"Timestamp" to System.currentTimeMillis(),
"Main-Class" to mainClassName
)
)
}
val dependencies = configurations["backendRuntimeClasspath"].filter { it.name.endsWith(".jar") } +
project.tasks["backendJar"].outputs.files +
project.tasks["frontendArchive"].outputs.files
dependencies.forEach {
if (it.isDirectory) from(it) else from(zipTree(it))
}
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
inputs.files(dependencies)
outputs.file(archiveFile)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
getByName("jar", Jar::class).apply {
dependsOn("shadowJar")
}
create("backendRun", JavaExec::class) {
dependsOn("compileKotlinBackend")
group = "run"
mainClass.set(mainClassName)
classpath =
configurations["backendRuntimeClasspath"] + project.tasks["compileKotlinBackend"].outputs.files +
project.tasks["backendProcessResources"].outputs.files
workingDir = buildDir
}
}
}
5 changes: 2 additions & 3 deletions addressbook-fullstack-javalin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
javaVersion=17
#Plugins
systemProp.kotlinVersion=1.8.22
systemProp.kotlinVersion=1.9.0
#Dependencies
systemProp.kvisionVersion=6.6.0
systemProp.kvisionVersion=7.0.0
slf4jVersion=2.0.7
hikariVersion=3.2.0
commonsCodecVersion=1.10
Expand All @@ -13,5 +13,4 @@ pgsqlVersion=42.2.2
kweryVersion=0.17

kotlin.mpp.stability.nowarn=true
kotlin.js.compiler=ir
org.gradle.jvmargs=-Xmx2g
2 changes: 1 addition & 1 deletion addressbook-fullstack-javalin/webpack.config.d/webpack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config.resolve.modules.push("../../processedResources/frontend/main");
config.resolve.modules.push("../../processedResources/js/main");
config.resolve.conditionNames = ['import', 'require', 'default'];

if (config.devServer) {
Expand Down
4 changes: 2 additions & 2 deletions addressbook-fullstack-jooby/.gettext.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
}
],
"glob": {
"pattern": "src/**/*.kt"
"pattern": "src/jsMain/**/*.kt"
}
},
"headers": {
"Language": ""
},
"output": "src/frontendMain/resources/i18n/messages.pot"
"output": "src/jsMain/resources/i18n/messages.pot"
}
16 changes: 8 additions & 8 deletions addressbook-fullstack-jooby/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## Gradle Tasks

### Resource Processing
* generatePotFile - Generates a `src/frontendMain/resources/i18n/messages.pot` translation template file.
* generatePotFile - Generates a `src/jsMain/resources/i18n/messages.pot` translation template file.
### Compiling
* compileKotlinFrontend - Compiles frontend sources.
* compileKotlinBackend - Compiles backend sources.
* compileKotlinJs - Compiles frontend sources.
* compileKotlinJvm - Compiles backend sources.
### Running
* frontendRun - Starts a webpack dev server on port 3000
* backendRun - Starts a dev server on port 8080
* jsRun - Starts a webpack dev server on port 3000
* jvmRun - Starts a dev server on port 8080
### Packaging
* frontendBrowserWebpack - Bundles the compiled js files into `build/distributions`
* frontendJar - Packages a standalone "web" frontend jar with all required files into `build/libs/*.jar`
* backendJar - Packages a backend jar with compiled source files into `build/libs/*.jar`
* jsBrowserWebpack - Bundles the compiled js files into `build/dist/js/productionExecutable`
* jsJar - Packages a standalone "web" frontend jar with all required files into `build/libs/*.jar`
* jvmJar - Packages a backend jar with compiled source files into `build/libs/*.jar`
* jar - Packages a "fat" jar with all backend sources and dependencies while also embedding frontend resources into `build/libs/*.jar`
Loading

0 comments on commit b13b080

Please sign in to comment.