https://kotlinlang.org logo
Title
d

Denis Shurygin

12/14/2017, 9:29 AM
There is any way to use modules as dependencies in 'konan' gradle plugin?
o

olonho

12/15/2017, 7:12 AM
Could you please clarify, what modules you're talking about?
d

Denis Shurygin

12/15/2017, 10:16 AM
I want to move some code into separate gradle modules and define they as dependencies in application module.
apply plugin: 'konan'

konan.targets = ['macbook']

konanArtifacts {
    program('Window')
}

dependencies {
    compile project(':domain')
}
But I found that konan plugih has no any configuraton that can be usen for dependencies.
i

ilya.matveev

12/16/2017, 4:23 AM
Yes, the konan plugin doesn't create any configurations but you can use the
libraries
block instead. Just declare a klib in the module you want to use as dependency and add this klib in you application:
// project :domain
konanArtifacts {
    library('domain') { ... }
}

// project :application
konanArtifacts {
    program('Window') {
        libraries {
            allLibrariesFrom project(':domain')
        }
    }
}
Such approach was used in Kotlin Spinner demo so you can use it as an example: https://github.com/JetBrains/kotlinconf-spinner
👍 1