diff --git a/docs/topics/opt-in-requirements.md b/docs/topics/opt-in-requirements.md index d11e6320381..17944fdb043 100644 --- a/docs/topics/opt-in-requirements.md +++ b/docs/topics/opt-in-requirements.md @@ -216,6 +216,37 @@ tasks.named('compileKotlin', KotlinCompilationTask) { +or like this: + + + + +```kotlin +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask +// ... + +tasks.named>("compileKotlin").configure { + compilerOptions.optIn.add("org.mylibrary.OptInAnnotation") +} +``` + + + + +```groovy +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask +// ... + +tasks.named('compileKotlin', KotlinCompilationTask) { + compilerOptions { + optIn.add('org.mylibrary.OptInAnnotation') + } +} +``` + + + + If your Gradle module is a multiplatform module, use the `optIn` method: