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 编程语言的官方仓库。Kotlin 是一门简洁的多平台语言,由 JetBrains 及其贡献者开发,可编译为 JVM 字节码、JavaScript、Native 原生二进制文件和 WebAssembly。
这是编译器,还是我需要导入的库?这是该语言的编译器、标准库和工具链的源代码(包括 Gradle/Maven 插件、IntelliJ 插件源码)。它不是你添加到现有应用中的库,不过它的产物 kotlin-stdlib 可以作为库使用。
我需要先安装特定的 JDK 或 IDE 吗?Gradle 工具链会从 Eclipse Adoptium 项目自动准备所需的 JDK,你也可以通过环境变量自行提供 JDK;如果要进行开发,推荐使用最新版的 IntelliJ IDEA(Community 或 Ultimate 版)。
安装时有什么需要注意的坑吗?下载的依赖(intellij-core、idea-full)体积很大,网络较慢时可能会超时,这时需要调大 socket/连接超时相关的参数;在 Windows 上,你可能还需要在 git 配置中启用长路径支持。
Kotlin Multiplatform 能让我做什么?它让你可以在 Android、iOS、桌面端和网页端之间共享业务逻辑和界面代码,无需为每个平台重写;必要时仍可以编写平台特定的原生代码。
我怎样在编辑器里编辑或使用 Kotlin 源代码?官方为 IntelliJ IDEA 和 Eclipse 提供了插件,并为 Sublime Text 提供了相应的软件包。
Kotlin/Native 或 Maven 构件有单独的构建步骤吗?有。构建 Kotlin/Native 有自己的说明文件,位于 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