tree: 00e56c0b5fd89b6e773b7be04c416d9f0b65fb3b [path history] [tgz]
  1. disable-stage.init.gradle.kts
  2. README.md
  3. with-link-args
kotlin-native/tools/with-link-args/README.md

with-link-args

This tool allows one to run a KMP Gradle build in such a way that the link tasks (aka “the Kotlin/Native second compilation stage”) get additional Gradle flags.

Usage

with-link-args <link args> -- <gradlew> <common args>

Example

To use a different compiler in the link tasks:

with-link-args \
  -Pkotlin.native.home=/Users/jetbrains/kotlin/kotlin-native/dist -- \
  ./gradlew clean check

So the -Pkotlin.native.home flag affects only the link tasks but not the compile tasks.

Similar functionality is not available in the KGP directly: KT-61104.

Implementation

To achieve that effect, the script runs the build twice: first without the link tasks, then only link tasks and everything depending on them, with extra arguments.

To disable a stage, it uses a Gradle init script that disables the tasks that do/don't depend on any link tasks.

The result is roughly equivalent to running a single build with passing the extra arguments only to the link tasks.