Shiraji's Blog

How to Kontribute (V3) - Setup

This blog post describes how to start Kontribute or how to start contributing Kotlin.

Who am I?

intro

I’ve been kontributors since July 2016. I made more than 60 commits by now. I love Kotlin, my beautiful wife and lovely son.

I talked about this topic a few times in different places. After speaking at DroidKaigi 2018 and Kotlin Night Kolkata, some people gave me feed back that it is also helpful for new Kontributors if I make a blog post in English. I am too lazy to write this from scratch, so I re-used some of contents from those presentation.

Prerequisite

Prerequisite

This blog entry does not explain how to use git/github and how to write Kotlin.

Since I mainly contribute to Kotlin plguin features, this blog post focus on how to contribute kotlin plugin. However, once you undersntand how to do it, it is really easy to contribute to Kotlin Languages, Kotlin JS or Kotlin Native because it is in the same repository.

Outline

Setup

It “was” the hardest part but not anymore. This is the reason I updated this topic as v3. There are “only” 4 parts of setups

JDK

The first one is JDK.

JDK

You need to install 3 differenct versions of JDKs.

In order to use those JDK, you must setup environment variables like this

JDK-env-var

It’s quite annoying to set each environment variables. Here is what I did.

1
2
3
4
export JAVA_HOME=`/usr/libexec/java_home -v "1.8"`
export JDK_16=`/usr/libexec/java_home -v "1.6"`
export JDK_17=`/usr/libexec/java_home -v "1.7"`
export JDK_18=`/usr/libexec/java_home -v "1.8"`

Intellij IDEA & Plugins

JDK-env-var

As for Intellij IDEA, you can use both community and ultimate version.

To make sure you are using latest kotlin plugin, check the following gif.

plugin_up-to-date

Open project

After setup Intellij IDEA, you can open kotlin plugin. First time you open the project, Intellij downloads all dependencies using gradle. It took me about 50 mins. Just wait.

Module

After downloading dependencies, you will notice that there is no source code in Project view. To fix this problem, you will need to do the followings:

  • Go to File | New | Module from Existing Sources | and then select build.gradle.kts file
  • After selecting the file, Import Module from Gradle dialog popup. Select use default gradle wrapper

The following gif visually describes the steps

module

Run

Setup is done. Let’s run it. To run it, select IDEA run configuration and hit run button.

run

After waiting a few minites, the child IDEA shows up. What does this do is if you change your Kotlin project, the change is bundle to this child IDEA. You can test your new feature in this child IDEA.

If you cannot build or run the project, ask other kontributors! In next blog post, I will talk about how to intract with other Kontributors or JetBrains team.