kotlin README

The project's README from github.com/JetBrains/kotlin. As one markdown file: README.md.

official project TeamCity (simple build status) Maven Central GitHub license Revved up by Develocity

Kotlin Programming Language

Welcome to Kotlin!
Kotlin is a concise multiplatform language developed by JetBrains and contributors.

Some handy links:

Kotlin Multiplatform capabilities

Support for multiplatform programming is one of Kotlin’s key benefits. It reduces time spent writing and maintaining the same code for different platforms while retaining the flexibility and benefits of native programming.

Editing Kotlin

Build environment requirements

This repository is using Gradle toolchains feature to select and auto-provision required JDKs from Eclipse Adoptium project.

Alternatively, it is still possible to only provide required JDKs via environment variables (see gradle.properties for supported variable names). To ensure Gradle uses only JDKs from environmental variables - disable Gradle toolchain auto-detection by passing -Porg.gradle.java.installations.auto-detect=false option (or put it into $GRADLE_USER_HOME/gradle.properties).

On Windows you might need to add long paths setting to the repo:

git config core.longpaths true 

Building

The project is built with Gradle. Run Gradle to build the project and to run the tests using the following command on Unix/macOS:

./gradlew <tasks-and-options>

or the following command on Windows:

gradlew <tasks-and-options>

On the first project configuration gradle will download and setup the dependencies on:

These dependencies are quite large, so depending on the quality of your internet connection you might face timeouts getting them. In this case, you can increase timeout by specifying the following command line parameters on the first run:

./gradlew -Dhttp.socketTimeout=60000 -Dhttp.connectionTimeout=60000

Important gradle tasks

To reproduce TeamCity build use -Pteamcity=true flag. Local builds don't run proguard and have jar compression disabled by default.

OPTIONAL: Some artifacts, mainly Maven plugin ones, are built separately with Maven. Refer to libraries/ReadMe.md for details.

To build Kotlin/Native, see kotlin-native/README.md.

Working with the project in IntelliJ IDEA

It is recommended to use the latest released version of Intellij IDEA (Community or Ultimate Edition). You can download IntelliJ IDEA here.

After cloning the project, import the project in IntelliJ by choosing the project directory in the Open project dialog.

For handy work with compiler tests it's recommended to use Kotlin Compiler Test Helper.

Dependency verification

We have a dependencies verification feature enabled in the repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with Dependency verification failed errors when local artifacts are absent or have different hashes listed in the verification-metadata.xml file.

It's expected that verification-metadata.xml should only be updated with the commits that modify the build. There are some tips how to perform such updates:

#macOS
sed -i '' -e '/<components>/,/<\/components>/d' gradle/verification-metadata.xml
#Linux & Git for Windows
sed -i -e '/<components>/,/<\/components>/d' gradle/verification-metadata.xml
./gradlew --write-verification-metadata sha256 -Pkotlin.native.enabled=true resolveDependencies

resolveDependencies task resolves dependencies for all platforms including dependencies downloaded by plugins.

You can also use ./scripts/update-verification-metadata.sh script which includes both of these steps

Keep in mind:

Using -dev versions

We publish -dev versions frequently.

For -dev versions you can use the list of available versions and include this maven repository:

maven("https://redirector.kotlinlang.org/maven/bootstrap")

License

Kotlin is distributed under the terms of the Apache License (Version 2.0). See license folder for details.

Contributing

Please be sure to review Kotlin's contributing guidelines to learn how to help the project.

Kotlin Foundation

The Kotlin Foundation is a non-profit organization whose mission is to promote and advance the Kotlin ecosystem. You can learn more about the structure and goals of the Kotlin Foundation on its official website.

kotlin (JetBrains/kotlin)

Searching Database…

53.5K ·GitHub
What is this?This is the official repository for the Kotlin programming language, a concise multiplatform language developed by JetBrains and contributors that compiles to JVM bytecode, JavaScript, Native binaries, and WebAssembly.
Is this a compiler or a library I import?It is the language's compiler, standard library, and tooling source code (Gradle/Maven plugins, IntelliJ plugin source) — not a library you add to an existing app, though its output (kotlin-stdlib) is used as one.
Do I need a specific JDK or IDE set up first?Gradle toolchains auto-provision the required JDKs from the Eclipse Adoptium project, or you can supply JDKs via environment variables; for development, the latest IntelliJ IDEA (Community or Ultimate) is recommended.
Any install pitfalls I should know about?The downloaded dependencies (intellij-core, idea-full) are large and may time out on slow connections, requiring you to raise the socket/connection timeout flags; on Windows you may also need to enable long paths in git config.
What does Kotlin Multiplatform let me do?It lets you share business logic and UI code across Android, iOS, desktop, and web rather than rewriting it per platform, while still allowing native-specific code where needed.
How do I edit or work with Kotlin source in an editor?There are official plugins for IntelliJ IDEA, Eclipse, and a package for Sublime Text.
Are there separate steps for Kotlin/Native or Maven artifacts?Yes — building Kotlin/Native has its own README in kotlin-native/README.md, and some Maven-plugin artifacts are built separately with Maven as described in libraries/ReadMe.md.
What are the important Gradle tasks in this repo?Key tasks include clean, dist (assemble compiler distribution), install (publish artifacts to local maven repo), and test tasks like coreLibsTest, gradlePluginTest, and compilerTest.
Creator
JetBrains
Size
4.2 GB
Stars
53.5K
Age
14y
Commits · 90 Days