You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* General compiler settings, which can be disabled or enabled as needed in any given project.
10
10
* Feature flags that enable or disable new and experimental features, which should eventually become part of the baseline.
11
11
12
+
You can find the [list of available general settings](https://kotlinlang.org/api/kotlin-gradle-plugin/compose-compiler-gradle-plugin/org.jetbrains.kotlin.compose.compiler.gradle/-compose-compiler-gradle-plugin-extension/)
13
+
and the [list of supported feature flags](https://kotlinlang.org/api/kotlin-gradle-plugin/compose-compiler-gradle-plugin/org.jetbrains.kotlin.compose.compiler.gradle/-compose-feature-flag/-companion/)
14
+
in the Compose compiler Gradle plugin API reference.
15
+
12
16
Here's an example configuration:
13
17
14
18
```kotlin
@@ -22,134 +26,14 @@ composeCompiler {
22
26
}
23
27
```
24
28
25
-
> The Gradle plugin provides defaults for several Compose compiler options that were only specified manually before.
26
-
> If you have any of them set up with `freeCompilerArgs`, for example, Gradle will report a duplicate options error.
29
+
> The Gradle plugin provides defaults for several Compose compiler options that were only specified manually before Kotlin 2.0.
30
+
> If you have any of them set up with `freeCompilerArgs`, for example, Gradle reports a duplicate options error.
27
31
>
28
32
{style="warning"}
29
33
30
-
## General settings
31
-
32
-
### generateFunctionKeyMetaClasses
33
-
34
-
**Type**: `Property<Boolean>`
35
-
36
-
**Default**: `false`
37
-
38
-
If `true`, generate function key meta classes with annotations indicating the functions and their group keys.
39
-
40
-
### includeSourceInformation
41
-
42
-
**Type**: `Property<Boolean>`
43
-
44
-
**Default**: `false` (`true` for Android)
45
-
46
-
If `true`, include source information in generated code.
47
-
48
-
Records source information that can be used for tooling to determine the source location of the corresponding composable function.
49
-
This option does not affect the presence of symbols or line information normally added by the Kotlin compiler;
50
-
it only controls source information added by the Compose compiler.
51
-
52
-
### metricsDestination
53
-
54
-
**Type**: `DirectoryProperty`
55
-
56
-
When a directory is specified, the Compose compiler will use the directory to dump [compiler metrics](https://github.com/JetBrains/kotlin/blob/master/plugins/compose/design/compiler-metrics.md#reports-breakdown).
57
-
They can be useful for debugging and optimizing your application's runtime performance:
58
-
the metrics show which composable functions are skippable, restartable, read-only, and so on.
59
-
60
-
The [reportsDestination](#reportsdestination) option allows dumping descriptive reports as well.
61
-
62
-
For a deep dive into the compiler metrics, see this [Composable metrics blog post](https://chrisbanes.me/posts/composable-metrics/).
63
-
64
-
### reportsDestination
65
-
66
-
**Type**: `DirectoryProperty`
67
-
68
-
When a directory is specified, the Compose compiler will use the directory to dump [compiler metrics reports](https://github.com/JetBrains/kotlin/blob/master/plugins/compose/design/compiler-metrics.md#reports-breakdown).
69
-
They can be useful for optimizing your application's runtime performance:
70
-
the reports show which composable functions are skippable, restartable, read-only, and so on.
71
-
72
-
The [metricsDestination](#metricsdestination) option allows dumping raw metrics.
73
-
74
-
For a deep dive into the compiler metrics, see this [Composable metrics blog post](https://chrisbanes.me/posts/composable-metrics/).
75
-
76
-
### stabilityConfigurationFile
77
-
78
-
> _Deprecated_ in Kotlin 2.1.0-Beta1 in favor of [stabilityConfigurationFiles](#stabilityconfigurationfiles),
79
-
> which allows using more than one stability configuration file.
80
-
>
81
-
{style="warning"}
82
-
83
-
**Type**: `RegularFileProperty`
84
-
85
-
A stability configuration file contains a list of classes, which should be considered stable.
86
-
For details, see [Stability configuration file](https://developer.android.com/develop/ui/compose/performance/stability/fix#configuration-file)
87
-
in the Jetpack Compose documentation.
88
-
89
-
### stabilityConfigurationFiles
90
-
91
-
**Type**: `ListProperty<RegularFile>`
92
-
93
-
Stability configuration files to be used for the current module.
94
-
95
-
Stability configuration files contain a list of classes that should be considered stable by the compiler.
96
-
For details, see [Stability configuration file](https://developer.android.com/develop/ui/compose/performance/stability/fix#configuration-file)
97
-
in the Jetpack Compose documentation.
98
-
99
-
Here's an example of specifying paths to several files:
If enabled, turns on intrinsic remember performance optimization.
178
-
179
-
Intrinsic remember is an optimization mode that inlines `remember` invocations and, where possible, replaces `.equals()` comparisons for keys with comparisons of the `$changed` meta parameter.
180
-
This results in fewer slots being used and fewer comparisons being made at runtime.
181
-
182
-
### OptimizeNonSkippingGroups
183
-
184
-
<primary-labelref="experimental-general"/>
185
-
186
-
**Default**: disabled
187
-
188
-
If enabled, remove groups around non-skipping composable functions.
189
-
190
-
This optimization improves the runtime performance of your application by skipping
191
-
unnecessary groups around composables which do not skip (and thus do not require a group).
192
-
This optimization will remove the groups, for example, around functions explicitly marked as `@NonSkippableComposable`
193
-
and functions that are implicitly not skippable (inline functions and functions that return a non-`Unit` value such as `remember`).
194
-
195
-
### PausableComposition
196
-
197
-
<primary-labelref="experimental-general"/>
198
-
199
-
**Default**: disabled
200
-
201
-
If enabled, changes the code generation of composable functions to allow pausing when part of a pausable composition.
202
-
This lets Compose runtime suspend composition at skipping points,
203
-
splitting long-running compositions across multiple frames.
204
-
205
-
Lazy lists and other performance intensive components use pausable composition to prefetch content
206
-
that might cause visual jank when executed in a blocking manner.
207
-
208
-
> The feature flag affects behavior only with a version of Compose runtime that supports pausable composition,
209
-
> starting with `androidx.compose.runtime` 1.8.0-alpha02.
210
-
> Older versions ignore the feature flag.
211
-
>
212
-
{style="note"}
213
-
214
-
### StrongSkipping
215
-
216
-
**Default**: enabled
217
-
218
-
If enabled, turns on strong skipping mode.
219
-
220
-
Strong skipping mode improves the runtime performance of your application by applying optimizations previously reserved only for stable values of composable functions whose parameters haven't changed.
221
-
For example, composables with unstable parameters become skippable, and lambdas with unstable captures are memoized.
222
-
223
-
For details, see the [description of strong skipping mode](https://github.com/JetBrains/kotlin/blob/master/plugins/compose/design/strong-skipping.md)
224
-
in the Kotlin GitHub repository.
57
+
See the [list of supported feature flags](https://kotlinlang.org/api/kotlin-gradle-plugin/compose-compiler-gradle-plugin/org.jetbrains.kotlin.compose.compiler.gradle/-compose-feature-flag/-companion/)
58
+
in the Compose compiler Gradle plugin API reference.
0 commit comments