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
Что это такое?Это официальный репозиторий языка программирования Kotlin, лаконичного мультиплатформенного языка, который разрабатывают JetBrains и участники сообщества. Он компилируется в байт-код JVM, JavaScript, нативные бинарные файлы и WebAssembly.
Это компилятор или библиотека, которую я импортирую?Это исходный код компилятора, стандартной библиотеки и инструментов языка (плагины для Gradle и Maven, исходники плагина для IntelliJ), а не библиотека, которую добавляют в существующее приложение. При этом результат сборки (kotlin-stdlib) как раз используется в качестве такой библиотеки.
Нужно ли сначала установить определённый JDK или IDE?Gradle toolchains автоматически загружают нужные JDK из проекта Eclipse Adoptium, либо можно указать JDK через переменные окружения. Для разработки рекомендуется последняя версия IntelliJ IDEA (Community или Ultimate).
Есть ли подводные камни при установке, о которых стоит знать?Загружаемые зависимости (intellij-core, idea-full) очень большие и могут не загрузиться из-за тайм-аута на медленном соединении, поэтому придётся увеличить флаги тайм-аута сокета или соединения. В Windows может также понадобиться включить поддержку длинных путей в git config.
Что позволяет делать Kotlin Multiplatform?Он позволяет использовать общую бизнес-логику и код интерфейса на Android, iOS, десктопе и в вебе, а не переписывать его для каждой платформы. При этом по-прежнему можно добавлять код, специфичный для конкретной платформы, там, где это нужно.
Как редактировать исходный код Kotlin или работать с ним в редакторе?Есть официальные плагины для IntelliJ IDEA и Eclipse, а также пакет для Sublime Text.
Нужны ли отдельные шаги для Kotlin/Native или артефактов Maven?Да: сборка Kotlin/Native описана в собственном README в файле kotlin-native/README.md, а некоторые артефакты плагинов Maven собираются отдельно через Maven, как описано в libraries/ReadMe.md.
Какие важные задачи Gradle есть в этом репозитории?Ключевые задачи: clean, dist (сборка дистрибутива компилятора), install (публикация артефактов в локальный репозиторий Maven), а также задачи тестирования: coreLibsTest, gradlePluginTest и compilerTest.
Creator
JetBrains
Size
4.2 GB
Stars
53.5K
Age
14y
Commits · 90 Days