This is needed only for faster compilation of the Kotlin project itself and has no effect on the public artifact org.jetbrains.kotlin:kotlin-reflect. The problem this is solving is the rebuild of the project once anything has been changed in modules in 'core' (even inside function bodies, i.e. a non-API change). Previously, changes in 'core' led to the compilation of kotlin-reflect, which led to the rebuild of all modules depending on kotlin-reflect directly or indirectly (which is almost all modules in the project) because kotlin-reflect's artifacts are custom-built and the changes can not be picked up incrementally. But 99.9% of the time the initial changes in 'core' could not have any effect on the usages of kotlin-reflect, because classes from those modules are moved to an internal package in kotlin-reflect and thus are an internal implementation detail. Now, changes in 'core' still lead to the compilation of kotlin-reflect and to the process of building the custom jar. But if a module depends on kotlin-reflect-api, not kotlin-reflect, then the incremental difference checker will detect that the module does not have to be recompiled if there hasn't been any changes to the API of kotlin-reflect-api. Which means that the module will not be rebuilt on every change in 'core'. This commit only introduces the new module. The dependencies (kotlin-reflect -> kotlin-reflect-api) are replaced in the next commit.
Kotlin Libraries
This area of the project is all written in Kotlin and assumes you've got the Kotlin IDEA plugin installed.
This area of the project uses Gradle and Maven for its build. When you open this project directory in IDEA the first time, it suggests you to import both gradle and maven projects. After importing you'll be able to explore and run gradle tasks and maven goals directly from IDEA with the instruments on the right sidebar.
Building
You need to install a recent Maven distribution and setup environment variables as following:
JAVA_HOME="path to JDK 1.8"
JDK_16="path to JDK 1.6"
JDK_17="path to JDK 1.7"
JDK_18="path to JDK 1.8"
The main part of the Kotlin standard library, kotlin-stdlib, is compiled against JDK 1.6 and also there are two extensions
for the standard library, kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8, which are compiled against JDK 1.7 and 1.8 respectively,
so you need to have all these JDKs installed.
Be sure to build Kotlin compiler distribution before launching Gradle and Maven: see root ReadMe.md, section "Building".
Core libraries are built with gradle, you can run that build using the gradle wrapper script even without local gradle installation:
./gradlew build install
Note: on Windows type
gradlewwithout the leading./
This command executes the build task, which assembles the artifacts and run the tests, and the install task, which puts the artifacts to the local maven repository to be used by the subsequent maven build.
The rest of tools and libraries are built with maven:
mvn install
If your maven build is failing with Out-Of-Memory errors, set JVM options for maven in MAVEN_OPTS environment variable like this:
MAVEN_OPTS="-Xmx2G"
Gradle Plugin
Gradle plugin sources can be found at the kotlin-gradle-plugin module.
To build the Gradle plugin and the subplugins, first build the core libraries and other tools (the Gradle and Maven builds above) and then, inside tools/gradle-tools, run:
gradlew clean install
Gradle integration tests
Gradle integration tests can be found at the kotlin-gradle-plugin-integration-tests module.
To run integration tests, run from tools/gradle-tools:
gradlew :kotlin-gradle-plugin-integration-tests:test
The tests that use the Gradle plugins DSL (PluginsDslIT) also require the Gradle plugin marker artifacts to be installed from tools/gradle-tools:
gradlew -Pmarker_version_suffix=-test :kotlin-gradle-plugin:plugin-marker:install :kotlin-noarg:plugin-marker:install :kotlin-allopen:plugin-marker:install