I'm have a hello world (kmp of macos) running via ...
# multiplatform
u
I'm have a hello world (kmp of macos) running via gradle
./gradlew runDebugExecutableMacosArm64
. Works fine However in intellij there's no run button next to main function I'm on the intellij idea CE, is that why? If so, then how do I create the run config manually?
m
Intellij won't add a run button next to your main function unless you have
jvm()
as one of your targets.
u
I see, so what do I do? Only run via gradle?
m
Yes. or if you feel the IDE gives you very quick feedback, then add that target in your gradle script files just for prototyping & rapid feedback
u
what target, jvm?
m
yes
u
so this pane is useless for non jvm targets?
m
I've not used it for non jvm targets so, I'm not quite sure if you can tweak it somehow to be able to run your native macOS app from the toolbar button like this:
u
can you show me the GUI for that run config please?
m
you maybe able to do it but I haven't tried it, but for the gutter run icon it won't appear even if you modified the configuration somehow
u
wait, why not? its just a gradle task ran by the run config gui, isnt it?
m
yes, here is the documentation: https://www.jetbrains.com/help/idea/run-debug-configuration.html that is why I said it might be possible just I've not tried it
u
so wheres that screenshot from?
m
from documentation
take a look at it
u
its probably just this
btw ň
does version.toml not offer code completion for you as well?
m
no it works fine
u
are you on CE or ultimate?
m
CE
u
hm, odd, thanks
👌 1
are you using kotlin or groovy for gradle?
m
kotlin
u
could I maybe see that syntax as how to add dependencies in your project please? (screenshot)
m
just like this:
Copy code
kotlin {
    jvmToolchain(17)
    jvm()
    
    sourceSets {
        
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material)
            implementation(compose.material3)
            implementation(compose.ui)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)
            implementation(libs.androidx.lifecycle.viewmodel)
            implementation(libs.androidx.lifecycle.runtime.compose)
        }

        jvmMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(libs.kotlinx.coroutines.swing)
        }
    }
}
s
@ursus make sure the file extension is
.gradle.kts
to use KotlinScript in build files. Otherwise with
.gradle
it uses Groovy.
libs.versions.toml
is just for version numbers (which you can then reference from the Gradle build file with
libs.whatever
)
u
not sure what you mean, groovy is fine & it works fine; im complaining about IDE not recognizing it, whereas it does recognize it in "normaln"
dependencies { .. }
block
s
IDK honestly, haven't used Groovy in a long time maybe it just doesn't support that syntax?
Try opening a YouTrack issue for IntelliJ, hopefully they figure out what's going on
m
For sure you can create a run configuration, in your screenshot with the Unnamed configuration for Kotlin, you only only have to locate the Main class; Already at the bottom of the screenshot you can see the Before lunch section is already pre-configured to build your project so it’s just a matter of matching the entry point aka the Main class (the file exposing the main jvm program function).