Kotlin 1.3.70 Early Access Preview

Probably I am just being a bit thick here, but:
What is a “script dependency”? What does it mean to “import during sync”? And most importantly: What exactly is improved significantly (other than “experience”)?

Script Dependencies is a list of external libraries available for the script. For *.gradle.kts scripts they are coming from the applied plugins. Those dependencies are provided by Gradle and are used in IDE for highlighting, completion and other IDE functionalities. Before 1.3.70 Kotlin Plugin requested them on the first script opening. Now it imports all script dependencies during the Gradle Project Sync (Gradle Tool Window -> Refresh button). This means that when the build script is opened Kotlin Plugin doesn’t need anymore to do a request to Gradle. We will describe this mechanism more detailed in the 1.3.70 Blog Post.

1 Like

Thanks a lot for the explanation!

Does this mean that the reimport of gradle build files is slower now (because it also does script dependency import)?

Performance of gradle sync affects everybody in the team all the time.
Performance of opening build files affects only some people only occasionally.

Don’t think it does. It needed to import the script dependencies at that time anyways, because they are needed to build the gradle.build.kts script. My guess is that they are just saving those dependencies instead of reloading them every time a script is opend.

1 Like

Yes, @Wasabi375 is right. No overhead expected in Gradle Project Sync.

1 Like

I have kotlin 1.3.61-release-ij2019.2-1.
When I try to sync in Intellij on either EA 1.3 or EA 1.4 it tells that I have the latest version.

Are there somewhere caches in Intellij that I can clear to get the update?

Works great for the browser() config, what’s the plan on the nodeJs() side?
Is there a plan to add minification and packing for frontend projects?
So we don’t have to move the node_modules folder in production.

Why do you need to minify nodeJs application? AFAIK, generally, they are deployed as is, since the code size is not a problem on the server side.

1 Like

You are right, they are generally deployed as is since there is not a huge performance impact.
I’m used to using grunt or browserify to reduce the size on disk, and the upload time, having a lot of dependencies and limited disk space.

FYI
If you are using build.gradle.kts like I do, you need to add the kotlin-eap repo to the settings.gradle.kts.
For example:

rootProject.name = "YOUR PROJECT NAME"

pluginManagement {
    repositories {
        jcenter()
        gradlePluginPortal()
        maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
    }
}
3 Likes

I’ve been trying it out, I have some questions and feedback.

  1. Is there a way to add a build variant other than development/production? And how do you get the list of current build variants?

  2. It seems that the build/distribution task doesn’t have the correct dependencies, it will copy the resources if they have already been processed, but on a clean build they won’t copy.

  3. There isn’t a separation for distributions dev/prod.

  4. The kotlin plugin 1.3.70 now runs the default gradle task on refresh/import. Is this intentional? I had some default tasks set up instead of :help and now I have to change that.

  5. It would be very helpful to have a new project template for js/browser that has a simple index.html and have it work with the run tasks.

  1. Currently, we have only 2 built-in build variants: development and production. Customizing and adding new variants not supported yet. Can you describe your use case?
  2. Can you please fill an issue in http://kotl.in/issue? cc @Alexey.Belkov
  3. Yes, only production build is treated as build for distribution. Why you need dev distribution?
  4. This seems IntelliJ issue, sorry https://youtrack.jetbrains.com/issue/IDEA-231214 fix in progress
  5. We already have it: https://kotlinlang.org/docs/reference/js-project-setup.html. But the current project wizard is somewhat messy and it is hard to find JS, yes. We are working on a new project wizard, hopefully, it will be released in 1.3.70 also.

This seems like a bug. Can you please fill an issue in http://kotl.in/issue? cc @Alexey.Belkov

I updated my intellij to 2019.3.1 and its fixed now.
Based upon the number of likes (0), the fact that if you upgrade intellij you will receive it and the amount of information I probably can give (I think it’s almost nothing), I think I will skip this issue.

  1. It’s not so much that I need something other than dev and prod, I guess the main thing is that if I make custom tasks that use these build variants, I’d like an enumeration instead of assuming they exist. That list is available internally to kotlin, but I don’t know how to get that configuration information. This isn’t that important though, listOf(“development”, “production”) works well enough for now.
  1. Yeah, I’ll see if I even still have that problem, I found a big bug in my build code where I was doing configurations.all {} instead of configurations.forEach {} That seemed to cause some instabilities that may be related.

  2. I only need to distribute production code, but I need to launch and iterate on development code. How do you do this without a task to put the js and resources together?

  3. Thanks!

  4. The last time I tried that template it didn’t have an index.html at all (this was in 1.3.61), I wanted a template with an index.html that pointed to the correct js file from webpack and could be launched with the js browser development run task. Has this been updated in the 1.3.70 idea plugin?

1 Like

Thank you for feedback.

  1. You can run development server via ./gradlew run -t. It runs webpack-dev-server, which bundle your code in dev mode. And -t flag is responsible for live reload of your application with changes in your code.

seems that the build/distribution task doesn’t have the correct dependencies, it will copy the resources if they have already been processed, but on a clean build they won’t copy.

You’re right, it is bug

1 Like

1.3.70 EAP 2 is out!

Artifact version: 1.3.70-eap-184.
You can find the list of changes in the changelog.

1 Like

Do we have an estimate on when this would be publicly released? Thank you!

1 Like

1.3.70 EAP 3 is out!

Artifact version: 1.3.70-eap-274.
You can find the list of changes in the changelog.