-
Notifications
You must be signed in to change notification settings - Fork 0
Home
-
Download the latest Kotlin Distribution
kotlin-compiler-<version>
(I've checked everything on 1.7.20 version) from GitHub Releases page and unpack its content (kotlinc
) tobuildInfra/tools
.Note that there are
kotlinc-metadata
andkotlinc-metadata.bat
shellscripts inbuildInfra/tools/kotlinc/bin
already. This is because we don't distribute them for now. This will be fixed in future updates. -
Currently. Kotlin Distribution doesn't ship with
kotlin-stdlib-common.jar
. This will be fixed in further updates. For now,kotlin-stdlib-common.jar
from Kotlin 1.7.20 is pre-packed to the repo. If you need a different version, just download it manually from Maven and replacekotlin-stdlib-common.jar
inbuildInfra/tools/kotlinc/lib
-
From the same release, download the
kotlin-native-<your-host>-<version>.zip
(I've usedmacos-aarch64
for testing), unpack its contents tobuildInfra/tools
and rename it to justkotlin-native
. -
Sometimes, macOS might be over-paranoid and forbid to use .dylibs in the
buildInfra/tools/kotlin-native/konan/nativeLib
. You will see that as macOS warning<Binary name> can't be opened because Apple cannot check it for malicious software. This software needs to be updated. Contact the developer for more information
. All the generic fixes from internet should work, the one I used: open binary manually from Finder, macOS will properly prompt you if you want to open it. Choose "Open" and it will be remembered as an exception
There's the resulting file structure you should get:
buildInfra
├── logic
├── output
└── tools
├── kotlin-native
└── kotlinc
├── bin
│ ├── ...
│ ├── kotlinc-metadata
│ ├── kotlinc-metadata.bat
│ └── ...
├── build.txt
├── lib
│ ├── ...
│ ├── kotlin-stdlib-common.jar
│ └── ...
└── license
This project provides a simple program, called kmmBuilder
, written in Kotlin, which invokes Kotlin Compiler and other low-level tools, on a simple dummy projects. Basically, you can see it as an extremely stupid build script. Read here how to play with it
⚠️ NB! Provided tasks don't check their dependencies. E.g. if you try toPACK_JVM
beforeASSEMBLE_JVM
, build will fail with some error or exception. If you want to learn about tasks dependencies, checktest
-folder inlogic
project
-
Navigate to
buildInfra/logic
folder -
Build the CLI for
kmmBuilder
:
~/barebones-kotlin-multiplatform/buildInfra/logic
❯ ./gradlew installDist
- Go to assembled CLI distribution:
~/barebones-kotlin-multiplatform/buildInfra/logic
❯ cd build/install/kmmBuilder/bin
- Launch
kmmBuilder
executable
~/barebones-kotlin-multiplatform/buildInfra/logic/build/install/kmmBuilder/bin default ⇡
❯ ./kmmBuilder
Error: No project specified
Usage:
kmmBuilder <PROJECT> <TASK>
Available projects:
<... read about CLI invocation here ...>
-
Navigate to
buildInfra/logic
folder -
Launch application via Gradle
./gradlew run --args="<USUAL CLI ARGS GO HERE>"
, example:
~/barebones-kotlin-multiplatform/buildInfra/logic
❯ ./gradlew run --args="TRANSITIVE ASSEMBLE_JVM"
> Task :run
Invoking KotlincJvm with -Xcommon-sources=/Users/dmitry.savvinov/Repos/barebones-kotlin-multiplatform/sources/TransitiveDependency/src/commonMain -Xmulti-platform -classpath /Users/dmitry.savvinov/Repos/barebones-kotlin-multiplatform/buildInfra/tools/kotlinc/lib/kotlin-stdlib.jar:/Users/dmitry.savvinov/Repos/barebones-kotlin-multiplatform/buildInfra/tools/kotlinc/lib/kotlin-stdlib-jdk7.jar:/Users/dmitry.savvinov/Repos/mbarebones-kotlin-multiplatform/buildInfra/tools/kotlinc/lib/kotlin-stdlib-jdk8.jar -d /Users/dmitry.savvinov/Repos/barebones-kotlin-multiplatform/buildInfra/output/TransitiveDependency/assembly/jvmMain /Users/dmitry.savvinov/Repos/barebones-kotlin-multiplatform/sources/TransitiveDependency/src/jvmMain /Users/dmitry.savvinov/Repos/barebones-kotlin-multiplatform/sources/TransitiveDependency/src/commonMain
BUILD SUCCESSFUL in 2s
2 actionable tasks: 1 executed, 1 up-to-date
- Open the
logic
project in IntelliJ IDEA or any IDE of your choice - There are classes
AssembleTests
andPackTests
with runnable "test"-methods inside, you can launch them as usual tests.
Those "tests" don't assert anything, they are used just as simple entry points