romainguy / kotlin-explorer

Desktop tool to quickly explore disassembled Kotlin code.
Apache License 2.0
780 stars 23 forks source link

Latest update (1.4.4) breaks the app #61

Closed sureshg closed 1 month ago

sureshg commented 3 months ago
 /Applications/Kotlin\ Explorer.app/Contents/MacOS/Kotlin\ Explorer
Exception in thread "main" java.lang.IllegalStateException: DecoratedWindow can only be used on JetBrainsRuntime(JBR) platform, please check the document https://github.com/JetBrains/jewel#int-ui-standalone-theme
        at org.jetbrains.jewel.window.DecoratedWindowKt.DecoratedWindow(DecoratedWindow.kt:65)
        at dev.romainguy.kotlin.explorer.ComposableSingletons$KotlinExplorerKt$lambda-2$1$2.invoke(KotlinExplorer.kt:594)
        at dev.romainguy.kotlin.explorer.ComposableSingletons$KotlinExplorerKt$lambda-2$1$2.invoke(KotlinExplorer.kt:593)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
        at org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt$IntUiTheme$2$1.invoke(IntUiTheme.kt:228)

New release github action uses Zulu JDK 17. Is this because of that as jewel requires JBR ?

Goooler commented 3 months ago

This might be the reason for https://github.com/romainguy/kotlin-explorer/pull/60#discussion_r1641789635.

Cause the Jebrains runtime setup on CI is blocked by https://github.com/actions/setup-java/issues/399, fallback to using toolchiain like

https://github.com/romainguy/kotlin-explorer/blob/84ca3266ff31a8800e18f5edd98dba9f71718efc/build.gradle.kts#L32-L35

From your stacktrace, seems Jebrains runtime is not correctly used.

sureshg commented 3 months ago

The thing is, compose desktop gradle plugin should honor jvmToolchain when using jpackage and seems like that's not happening. May be setting javaHome explicitly from jvmtoolChain might help.

val defToolchain = extensions.findByType(JavaPluginExtension::class)?.toolchain
val javaToolchainSvc = extensions.findByType(JavaToolchainService::class) 
val jbrHome =  javaToolchainSvc?.launcherFor(defToolchain)?.metadata?.installationPath?.asFile?.toPath()

compose {
  desktop {
    application {
       javaHome = jbrHome.toString()
     }
  }
}
romainguy commented 3 months ago

I just changed the workflow because it was not generating release DMGs (they were not going through proguard). I haven't tested the output in CI yet but it might fix this issue.

Goooler commented 3 months ago

I tried, seems it doesn't work enough.

You can download the dists from the second link above.

romainguy commented 3 months ago

Indeed it doesn't work either. But it works when I run the same task locally.

Goooler commented 3 months ago

Actually I can open distribution-macos-12 (built on x64 Mac) but distribution-macos-latest (built on arm64 Mac) on my M3 MBP. So weird!

Goooler commented 3 months ago

Fixing in #62.