Skip to content

Commit

Permalink
chore: remove experimental status for compilerOptions DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahhaggarty committed Nov 4, 2024
1 parent 62368f7 commit c2a0838
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 157 deletions.
81 changes: 0 additions & 81 deletions docs/topics/multiplatform/multiplatform-configure-compilations.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,6 @@ This example configures a compiler option that is common across all targets:

```kotlin
kotlin {
targets.all {
compilations.all {
compilerOptions.configure {
allWarningsAsErrors.set(true)
}
}
}
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
kotlin {
targets.all {
compilations.all {
compilerOptions.configure {
allWarningsAsErrors = true
}
}
}
}
```

</tab>
</tabs>

Alternatively, you can use the `compilerOptions {}` [top-level block](multiplatform-dsl-reference.md#top-level-blocks):

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
allWarningsAsErrors.set(true)
}
Expand All @@ -87,52 +51,14 @@ kotlin {
</tab>
</tabs>

> The support for `compilerOptions {}` as a top-level block is [Experimental](components-stability.md#stability-levels-explained)
> and requires opt-in. It may be dropped or changed at any time. Use it only for evaluation purposes. We would appreciate
> your feedback on it in [YouTrack](https://kotl.in/issue).
>
{style="warning"}

## Configure compilations for one target

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
kotlin {
jvm().compilations.all {
compilerOptions.configure {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
kotlin {
jvm().compilations.all {
compilerOptions.configure {
jvmTarget = JvmTarget.JVM_1_8
}
}
}
```

</tab>
</tabs>

Alternatively, you can use the `compilerOptions {}` block at target level:

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
kotlin {
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
Expand All @@ -156,13 +82,6 @@ kotlin {
</tab>
</tabs>

> The support for the `compilerOptions {}` block at target level is [Experimental](components-stability.md#stability-levels-explained)
> and requires opt-in. It may be dropped or changed at any time. Use it only for evaluation purposes. We would appreciate
> your feedback on it in [YouTrack](https://kotl.in/issue).
>
{style="warning"}


## Configure one compilation

<tabs group="build-script">
Expand Down
93 changes: 17 additions & 76 deletions docs/topics/multiplatform/multiplatform-dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,13 @@ plugins {
`kotlin {}` is the top-level block for multiplatform project configuration in the Gradle build script.
Inside `kotlin {}`, you can write the following blocks:

| **Block** | **Description** |
|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| _&lt;targetName&gt;_ | Declares a particular target of a project. The names of available targets are listed in the [Targets](#targets) section. |
| `targets` | All targets of the project. |
| `presets` | All predefined targets. Use this for [configuring multiple predefined targets](#targets) at once. |
| `sourceSets` | Configures predefined and declares custom [source sets](#source-sets) of the project. |
| `compilerOptions` | Extension-level common [compiler options](gradle-compiler-options.md) that are used as defaults for all targets and shared source sets. To use it, add the following opt-in: `@OptIn(ExperimentalKotlinGradlePluginApi::class)` |

> The support for `compilerOptions {}` as a top-level block is [Experimental](components-stability.md#stability-levels-explained)
> and requires opt-in. It may be dropped or changed at any time. Use it only for evaluation purposes. We would appreciate
> your feedback on it in [YouTrack](https://kotl.in/issue).
>
{style="warning"}
| **Block** | **Description** |
|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| _&lt;targetName&gt;_ | Declares a particular target of a project. The names of available targets are listed in the [Targets](#targets) section. |
| `targets` | All targets of the project. |
| `presets` | All predefined targets. Use this for [configuring multiple predefined targets](#targets) at once. |
| `sourceSets` | Configures predefined and declares custom [source sets](#source-sets) of the project. |
| `compilerOptions` | Extension-level common [compiler options](gradle-compiler-options.md) that are used as defaults for all targets and shared source sets. |

## Targets

Expand Down Expand Up @@ -134,20 +128,14 @@ Each target can have one or more [compilations](#compilations).

In any target block, you can use the following declarations:

| **Name** | **Description** |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `attributes` | Attributes used for [disambiguating targets](multiplatform-set-up-targets.md#distinguish-several-targets-for-one-platform) for a single platform. |
| `preset` | The preset that the target has been created from, if any. |
| `platformType` | Designates the Kotlin platform of this target. Available values: `jvm`, `androidJvm`, `js`, `wasm`, `native`, `common`. |
| `artifactsTaskName` | The name of the task that builds the resulting artifacts of this target. |
| `components` | The components used to setup Gradle publications. |
| `compilerOptions` | The [compiler options](gradle-compiler-options.md) used for the target. This declaration overrides any `compilerOptions {}` configured at [top level](multiplatform-dsl-reference.md#top-level-blocks). To use it, add the following opt-in: `@OptIn(ExperimentalKotlinGradlePluginApi::class)` |

> The support for `compilerOptions {}` as a common target configuration is [Experimental](components-stability.md#stability-levels-explained)
> and requires opt-in. It may be dropped or changed at any time. Use it only for evaluation purposes. We would appreciate
> your feedback on it in [YouTrack](https://kotl.in/issue).
>
{style="warning"}
| **Name** | **Description** |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `attributes` | Attributes used for [disambiguating targets](multiplatform-set-up-targets.md#distinguish-several-targets-for-one-platform) for a single platform. |
| `preset` | The preset that the target has been created from, if any. |
| `platformType` | Designates the Kotlin platform of this target. Available values: `jvm`, `androidJvm`, `js`, `wasm`, `native`, `common`. |
| `artifactsTaskName` | The name of the task that builds the resulting artifacts of this target. |
| `components` | The components used to setup Gradle publications. |
| `compilerOptions` | The [compiler options](gradle-compiler-options.md) used for the target. This declaration overrides any `compilerOptions {}` configured at [top level](multiplatform-dsl-reference.md#top-level-blocks). |

### JVM targets

Expand Down Expand Up @@ -756,12 +744,8 @@ kotlin {
}

// Configure all compilations of all targets:
targets.all {
compilations.all {
compilerOptions.configure {
allWarningsAsErrors.set(true)
}
}
compilerOptions {
allWarningsAsErrors.set(true)
}
}
```
Expand All @@ -782,42 +766,6 @@ kotlin {
compilations.test.runtimeDependencyFiles // get the test runtime classpath
}
// Configure all compilations of all targets:
targets.all {
compilations.all {
compilerOptions.configure {
allWarningsAsErrors = true
}
}
}
}
```

</tab>
</tabs>

Alternatively, to configure compiler options that are common for all targets, you can use the `compilerOptions {}` [top-level block](multiplatform-dsl-reference.md#top-level-blocks):

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
kotlin {

// Configure all compilations of all targets:
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
allWarningsAsErrors.set(true)
}
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
kotlin {
// Configure all compilations of all targets:
compilerOptions {
allWarningsAsErrors = true
Expand All @@ -828,13 +776,6 @@ kotlin {
</tab>
</tabs>

> The support for `compilerOptions {}` as a top-level block is [Experimental](components-stability.md#stability-levels-explained)
> and requires opt-in. It may be dropped or changed at any time. Use it only for evaluation purposes. We would appreciate
> your feedback on it in [YouTrack](https://kotl.in/issue).
>
{style="warning"}


## Dependencies

The `dependencies {}` block of the source set declaration contains the dependencies of this source set.
Expand Down

0 comments on commit c2a0838

Please sign in to comment.