Runs separately from the Gradle daemon when you compile the project with an IntelliJ IDEA built-in build system. Runs with the Gradle daemon to compile the project. The Kotlin daemon and how to use it with Gradle After you enable this feature, the Kotlin Gradle plugin automatically starts using it. See the Gradle documentation to learn how to enable the configuration cache. The Kotlin plugin uses the Gradle configuration cache, which speeds up the build process by reusing the results of the configuration phase. The feature is supported only by the following Gradle plugins: You can check the Gradle releases page to see whether it has been promoted to stable. The configuration cache is available in Gradle 6.5 and later as an experimental feature. ![]() Gradle configuration cache support has some constraints: To disable caching for all Kotlin tasks, set the system property to false (run the build with the argument =false). The Kotlin plugin uses the Gradle build cache, which stores the build outputs for reuse in future builds. Task ':kotlin-gradle-plugin:compileCommonKotlin' finished in 0.46 s Time metrics: Total Gradle task time: 0.46 s Task action before worker execution: 0.07 s Backup output: 0.05 s // The time has reduced Run compilation in Gradle worker: 0.32 s Clear jar cache: 0.00 s Precise backup output: 0.00 s // Related to precise backup Cleaning up the backup stash: 0.00 s // Related to precise backup Gradle build cache support Task ':kotlin-gradle-plugin:compileCommonKotlin' finished in 0.59 s Time metrics: Total Gradle task time: 0.59 s Task action before worker execution: 0.24 s Backup output: 0.22 s // Pay attention to this number Īnd here is an example of a relevant part of the report after enabling precise backup: Here is an example of a relevant part of the report before enabling precise backup: Enable reports in text file format by adding the following property to your gradle.properties file: To estimate the impact of the optimization on your computer for your project and your scenarios, you can use Kotlin build reports. Which modules are affected by the changes and how big these modules are. How warm the Kotlin daemon and the Gradle daemon are. The factors affecting performance include but are not limited to: These measurements were performed on a computer with an Apple M1 Max CPU different computers will yield slightly different results. The third chart shows how precise backup in the Space project affects building a web frontend after a small non-ABI change: adding a private function to a Kotlin/JS module that lots of modules depend on. The first and second charts show how using precise backup in a Kotlin project affects building the Kotlin Gradle plugin:Īfter making a small ABI change: adding a new public method to a module that lots of modules depend on.Īfter making a small non-ABI change: adding a private function to a module that no other modules depend on. In the following charts, you can see examples of using precise backup compared to full backup: To opt out from this new approach, set the following option in your gradle.properties: You will receive the most benefit if you use the build cache, or, frequently make changes in non-Kotlin Gradle modules. This approach supports changes made inside dependent non-Kotlin modules, includes an improved compilation avoidance, and is compatible with the Gradle build cache.Īll of these enhancements decrease the number of non-incremental builds, making the overall compilation time faster. Starting from Kotlin 1.8.20, this is enabled by default. The new approach to incremental compilation is available since Kotlin 1.7.0 for the JVM backend in the Gradle build system only. A new approach to incremental compilation This can help you to provide reproducible bug reports. Use build reports to track the history of changes and compilations. ![]() Sometimes problems with incremental compilation become visible several rounds after the failure occurs. Note: Any build with incremental compilation disabled invalidates incremental caches. The parameter should be added to each subsequent build. Use -Pkotlin.incremental=false or =false as a command line parameter. ![]() ![]() Set kotlin.incremental=false for Kotlin/JVM. There are several ways to disable incremental compilation: Incremental compilation is supported for Kotlin/JVM and Kotlin/JS projects, and is enabled by default. Incremental compilation tracks changes to source files between builds so that only the files affected by these changes are compiled. The Kotlin Gradle plugin supports incremental compilation. The Kotlin daemon and how to use it with Gradleĭefining Kotlin compiler execution strategy On this page, you can learn about the following topics: Compilation and caches in the Kotlin Gradle plugin
0 Comments
Leave a Reply. |