how do i translate this : `artifact project(':kdx'...
# kotlin-native
s
how do i translate this :
artifact project(':kdx'), 'kdx'
to the new kotlin dls plugin ?
g
Not enough context, but if
artifact
is configuration, than should work like:
artifact(project(":kdx"))
But only if you use plugins DSL and have type safe accessors. Otherwise you can use dynamic syntax to add dependency to unknown configuration:
"artifact"(project(":kdx"))
s
Yeah that's what i first tried but it didn't work:
Copy code
Script compilation error:

  Line 24:             artifact(project(":kdx"))
                       ^ None of the following functions can be called with the arguments supplied: 
                           public final fun artifact(name: String): Unit defined in org.jetbrains.kotlin.gradle.plugin.KonanLibrariesSpec
                           public final fun artifact(artifact: KonanInteropLibrary): Unit defined in org.jetbrains.kotlin.gradle.plugin.KonanLibrariesSpec
                           public final fun artifact(artifact: KonanLibrary): Unit defined in org.jetbrains.kotlin.gradle.plugin.KonanLibrariesSpec

1 error
kdx is a kotlin native library
i added it in the `settings.gradle.ktx`file
include(":kdx")
g
Did you tried?
"artifact"(project(":kdx"))
ohh, I see, this is K/N dsl
s
Yeah i tried, it didn't work
Copy code
Script compilation error:

  Line 23:             "artifact"(project(":kdx"))
                       ^ Expression '"artifact"' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found

1 error
g
Yeah, because this is not a configuration
s
I'm not super familiar with gradle, i was using cmake before
g
Let me check
s
snippet of the converted one (old dsl)
Copy code
program('kdx-sandbox') {
        libraries {
            artifact project(':kdx'), 'kdx'
            artifact project(':platform-windows'), 'platform-windows'
            artifact 'libglew'
            artifact 'libglfw'
        }
i renamed some stuff but project structure is the same
i can't figure out what i did wrong, i also tried on a fresh project
g
Probably in you case problem with
project
function
ohhh
Just this should work:
Copy code
artifact(project(":kdx"), "kdx")
I didn’t realise that you have second argument
s
haha i feel stupid lol
works fine now thanks!
g
Actually I could figureout about DSL because opened it on Idea
s
i'm not getting code completion for the dsl
g
Looks that CLion Kotlin plugin doesn’t work properly with Kotlin DSL, no code completion, no navigation
Yes, bug I have code completion and navigation in Idea
s
Yeah, probably will come in future update
g
Probably make sense to report an issue
s
i'll check on youtrack maybe it's already reported
g
Please share if you find it or report, I will upvote 👍
s
i
@sksk Could you provide a link to your buildscript?
g
@ilya.matveev I can reproduce this with minimal example:
Copy code
//build.gradle.kts
plugins {
    id("org.jetbrains.kotlin.konan") version ("0.8.2")
}

konanArtifacts {
    program("app")
}
No autocomplete or code navigation in build file in CLion 2018.2.2 and Kotlin/Native plugin v182.4129.59 CLion sync project without problem, I see all the tasks and src/main/kotlin marked as source set
🙏 1