Kotlin has a wide variety of tools available. These tools are available from gradle, maven, ant, compiler opts, plug-ins, Kapt, Dokka and Osgi. These tools and their plug-ins help Kotlin support multiple languages.
Gradle has a number of plugins which are determined at the outset and very early before the compilation of the code.
Gradle can optimize the loading and re-use of plugin classes, allow different plugins for different versions of classes and provide editors which detail information about the potential properties and values in the buildscript.
The plugins can also be extracted during compilation rather than require pre-installation. It might look like the traditional apply() method in gradle is no different from the plugins block and that they both serve to list plugins and their versions but the latter is actually more recent, has more rigorous checks, constraints and restrictions. If we want to avoid the restrictions, we could make use of the buildScript block. Gradle has support for multi-project builds so the build.gradle is composable for different projects
The KotlinOptions in gradle allows us to set compiler options. Common options include:
-nowarn to suppress display warnings during compilation. And it’s opposite
-Werror which turns warnings into errors
-script which evaluates a Kotlin script file
-Kotlin-home which specifies a custom path to the Kotlin compiler
-plugin and corresponding version to include plugins
-progressive mode where the compiler evaluates deprecation and bug fixes for unstable code instead of going through a graceful migration cycle. The progressive mode is important for stability and backward compatibility of code because it makes the changes in the code for breaking changes in the compiler. A breaking change for a compiler is one where the compiler throws an error now when it did not earlier.
In addition to the above parameters, JVM parameters can also be passed to the build.
No comments:
Post a Comment