JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.15k stars 1.17k forks source link

runDistributable skips backward slashes from args on Windows #2368

Closed igordmn closed 1 month ago

igordmn commented 2 years ago

Compose 1.2.0-beta03, Windows 11

fun main(vararg args: String) {
    println(args.toList())
}
plugins {
    kotlin("jvm")
    id("org.jetbrains.compose")
}

repositories {
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
    google()
}

dependencies {
    implementation(compose.desktop.currentOs)
}

compose.desktop {
    application {
        mainClass = "MainKt"
        args += "C:\\Program Files"
    }
}

gradlew run output:

[C:\Program Files]

gradlew runDistributable output:

[C:Program Files]

Because of this we have failed tests in Gradle Plugin:

DesktopApplicationTest[Gradle '7.1.1'] > testAndroidxCompiler() FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at DesktopApplicationTest.kt:63

java.io.FileNotFoundException: C:\Users\Igor\AppData\Local\Temp\junit2362651168530675128\main-image.actual.png (The system cannot find the file specified)

DesktopApplicationTest[Gradle '7.1.1'] > proguard() FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at DesktopApplicationTest.kt:80
AlexeyTsvetkov commented 2 years ago

I don't know, how to fix this in general, because there is no way to know 100%, if a string represents a file path. So I will fix a particular test

igordmn commented 2 years ago

represents a file path

Probably it affects not only paths, but any data that contain backslashes. So, if the jpackage removes them, we should escape it (replacing \ by \\).

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.