Giter Club home page Giter Club logo

Comments (8)

rjaros avatar rjaros commented on August 12, 2024

Could you post your build.gradle.kts?

from kvision.

chavu avatar chavu commented on August 12, 2024

Here is my full build.gradle

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 {
    val kotlinVersion: String by System.getProperties()
    kotlin("plugin.serialization") version kotlinVersion
    kotlin("multiplatform") version kotlinVersion
    val kvisionVersion: String by System.getProperties()
    id("io.kvision") version kvisionVersion
}

version = "1.0.0-SNAPSHOT"
group = "com.digitres"

repositories {
    mavenCentral()
    mavenLocal()
}

// Versions
val kotlinVersion: String by System.getProperties()
val kvisionVersion: String by System.getProperties()
val ktorVersion: String by project
val logbackVersion: String by project
val exposedVersion: String by project

val webDir = file("src/jsMain/web")
val mainClassName = "io.ktor.server.netty.EngineMain"

kotlin {
    jvm {
        compilations.all {
            kotlinOptions {
                jvmTarget = "17"
                freeCompilerArgs = listOf("-Xjsr305=strict")
            }
        }

        @OptIn(ExperimentalKotlinGradlePluginApi::class)
        mainRun {
            mainClass.set(mainClassName)
        }

    }
    js(IR) {
        browser {
            runTask(Action {
                mainOutputFileName = "main.bundle.js"
                sourceMaps = false
                devServer = KotlinWebpackConfig.DevServer(
                    open = false,
                    port = 3000,
                    proxy = mutableMapOf(
                        "/kv/*" to "http://localhost:8080",
                        "/login" to "http://localhost:8080",
                        "/logout" to "http://localhost:8080",
                        "/kvws/*" to mapOf("target" to "ws://localhost:8080", "ws" to true)
                    ),
                    static = mutableListOf("$buildDir/processedResources/js/main")
                )
            })
            webpackTask(Action {
                mainOutputFileName = "main.bundle.js"
            })
            testTask(Action {
                useKarma {
                    useChromeHeadless()
                }
            })
        }
        binaries.executable()
    }
    sourceSets {
        val commonMain by getting {
            dependencies {
                api("io.kvision:kvision-server-ktor:$kvisionVersion")
                implementation("app.softwork:kotlinx-uuid-core:0.0.12")
                implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.1")
            }
            kotlin.srcDir("build/generated-src/common")
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        val jvmMain by getting {
            dependencies {
                implementation(kotlin("stdlib-jdk8"))
                implementation(kotlin("reflect"))
                implementation("io.ktor:ktor-server-netty:$ktorVersion")
                implementation("io.ktor:ktor-server-sessions:$ktorVersion")
                implementation("io.ktor:ktor-server-auth:$ktorVersion")
                implementation("io.ktor:ktor-server-auth-jvm:$ktorVersion")
                implementation("io.ktor:ktor-server-auth-jwt:$ktorVersion")
                implementation("io.ktor:ktor-server-compression:$ktorVersion")
                implementation("org.slf4j:slf4j-api:1.2")
                implementation("ch.qos.logback:logback-classic:$logbackVersion")
                implementation("ch.qos.logback:logback-core:$logbackVersion")
                implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
                implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
                implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
                runtimeOnly("org.jetbrains.exposed:exposed-jdbc:${exposedVersion}")
                implementation("mysql:mysql-connector-java:8.0.27")
                implementation("com.zaxxer:HikariCP:5.0.1")
                implementation("org.apache.poi:poi:5.2.0")
                implementation("org.apache.poi:poi-ooxml:5.2.0")
                implementation("com.typesafe:config:1.4.1")
            }
        }
        val jvmTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation(kotlin("test-junit"))
            }
        }
        val jsMain by getting {
            resources.srcDir(webDir)
            dependencies {
                implementation("io.kvision:kvision:$kvisionVersion")
                implementation("io.kvision:kvision-redux-kotlin:$kvisionVersion")
                implementation("io.kvision:kvision-bootstrap:$kvisionVersion")
                implementation("io.kvision:kvision-datetime:$kvisionVersion")
                implementation("io.kvision:kvision-bootstrap-upload:$kvisionVersion")
                implementation("io.kvision:kvision-fontawesome:$kvisionVersion")
                implementation("io.kvision:kvision-bootstrap-icons:$kvisionVersion")
                implementation("io.kvision:kvision-tabulator-remote:$kvisionVersion")
                implementation("io.kvision:kvision-routing-navigo:$kvisionVersion")
                implementation("io.kvision:kvision-tom-select:$kvisionVersion")
                implementation("io.kvision:kvision-state:$kvisionVersion")
                implementation("io.kvision:kvision-chart:$kvisionVersion")
                implementation("io.kvision:kvision-toastify:$kvisionVersion")
                implementation(npm("chartjs-plugin-datalabels", "2.2.0"))

            }
            kotlin.srcDir("build/generated-src/frontend")
        }
        val jsTest by getting {
            dependencies {
                implementation(kotlin("test-js"))
                implementation("io.kvision:kvision-testutils:$kvisionVersion")
            }
        }
    }

    project.tasks.named("jsProcessResources", Copy::class.java) {
        duplicatesStrategy = DuplicatesStrategy.INCLUDE
    }

    project.tasks.withType<Jar> {
        manifest {
            attributes["Main-Class"] = mainClassName
        }
    }
    project.tasks.create("stage") {
        dependsOn(project.tasks.getByName("jar"))
    }
}
//
//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("jar", 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
//        }
//        create("backendRun", JavaExec::class) {
//            dependsOn("compileKotlinBackend")
//            group = "run"
//            main = mainClassName
//            classpath =
//                configurations["backendRuntimeClasspath"] + project.tasks["compileKotlinBackend"].outputs.files +
//                        project.tasks["backendProcessResources"].outputs.files
//            workingDir = buildDir
//        }
//
//        create("stage") {
//            dependsOn("jar")
//        }
//    }
//}

from kvision.

rjaros avatar rjaros commented on August 12, 2024

It seems Ktor fullstack project packaging is broken in KVision 7.1.0. As a spring boot user I haven't noticed that. Sorry about this. I'll try to release a fix asap.

from kvision.

chavu avatar chavu commented on August 12, 2024

Thank you. I have downgraded to 7.0.1 for now and it's working okay.

from kvision.

rjaros avatar rjaros commented on August 12, 2024

Fixed in 7.2.0

from kvision.

chavu avatar chavu commented on August 12, 2024

I upgraded to version 7.2.0 and when I run the app in development on my laptop I 'm getting a blank white screen. See console erros in image below.

image

from kvision.

rjaros avatar rjaros commented on August 12, 2024

Any errors in the Network tab? Is your backend running? What task do you use to run the backend?

from kvision.

chavu avatar chavu commented on August 12, 2024

Suprising after downgrading and then upgrading again and rebuild, It's working fine now. Sorry.

from kvision.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.