Is there any sample code for setting up gradle for...
# announcements
i
Is there any sample code for setting up gradle for multi-platform + kotlin-dsl ?
l
#C3PQML5NU
1
g
This is my project with kotlin-dsl + MPP https://github.com/gildor/knel Do you have some particular problem with your build script?
i
Thanks! I will study this.
l
This migration guide will probably help you: https://github.com/jnizet/gradle-kotlin-dsl-migration-guide Also, I'm starting an open source JVM & JS MPP project too, but I suspect gildor/Andrey's project (linked 2 messages above) to be more complete. Here's the link anyway: https://github.com/LouisCAD/solution.bike
g
My project doesn’t have publishging config for different platforms yet, but I plan to add it soon
i
btw, have either of you gotten Kotlikn/JS + Google Closure optimizations advanced to work? I can get optimizations simple to work, but on advanced, I get renaming errors.
g
What kind error? Btw do you use Kotlin DCE?
i
I don't have a repo with the error at the moment, after I get MPP-kotlin-dsl working, I will recreate one.
The gist of the error is: google closure optimizations renames things -- kotlin/js does not output closure compatible code, so optimizations=simple doesn't rename too much, but optimizations=advanced renames too much. This is from calling google closure directly (not from using any plugin).
g
No, I don’t know anything about “closure compatible code”, if you can reproduce this, maybe make sense to report an issue. But be sure that you do that after kotlin dce processing
i
I have never written something that compiles to Google Closure, so this is all 2nd hand: afaik see: https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler basically, in order to allow Google Closure to do it's crazy optimizations, the input JS needs to be in a restricted form, and afaik, Kotlin/JS is not outputting this yet
g
No, I don’t think that Kotlin JS supports something like that now, you can create a feature request. But I suppose this require some discussion, I suppose Kotlin JS need special output mode that adds closure annotations
i
I'm trying to integrate your MPP setup into my codebase. What is the signifinance of not using mavenCentral and using the following instead: https://github.com/gildor/knel/blob/master/settings.gradle.kts#L9 https://github.com/gildor/knel/blob/master/build.gradle.kts#L6
g
kotlin-eap repos is only for EAP (Early Access Program) versions of kotlin - betas
Originally my repo used eap version of 1.2.50 Kotlin, so I have this, can be removed now
I use jcenter instead of mavenCentral because jcenter mirror everything on mavenCentral + additional repos, but in general case you can use only mavenCentral, there is nothing specific about jcenter, just always use jcenter by default
but in case of
<https://dl.bintray.com/jetbrains/kotlin-native-dependencies>
it’s really importantn, because this repo contains kotlin-native-gradle-plugin If you don’t have kotlin-native module, you can delete this repo