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
Copy file name to clipboardExpand all lines: README.md
+29
Original file line number
Diff line number
Diff line change
@@ -264,6 +264,7 @@ Additionally, you can add options for both tracing and timing of the bazel build
264
264
*`bazel build --define=kt_timings=1`
265
265
266
266
`kt_trace=1` will allow you to inspect the full kotlinc commandline invocation, while `kt_timings=1` will report the high level time taken for each step.
267
+
267
268
# Kotlin compiler plugins
268
269
269
270
The `kt_compiler_plugin` rule allows running Kotlin compiler plugins, such as no-arg, sam-with-receiver and allopen.
@@ -296,6 +297,34 @@ kt_jvm_library(
296
297
)
297
298
```
298
299
300
+
# KSP Annotation Processing
301
+
302
+
The `kt_ksp_plugin` rule allows running KSP annotation processors, such as Moshi.
303
+
304
+
For example, you can add allopen to your project like this:
|<aid="kt_kotlinc_options-name"></a>name | A unique name for this target. | <ahref="https://bazel.build/docs/build-ref.html#name">Name</a> | required ||
412
413
|<aid="kt_kotlinc_options-include_stdlibs"></a>include_stdlibs | Don't automatically include the Kotlin standard libraries into the classpath (stdlib and reflect). | String | optional | "all" |
413
414
|<aid="kt_kotlinc_options-java_parameters"></a>java_parameters | Generate metadata for Java 1.8+ reflection on method parameters. | Boolean | optional | False |
415
+
|<aid="kt_kotlinc_options-jvm_target"></a>jvm_target | The -jvm_target flag. This is only tested at 1.8. | String | optional | "" |
|<aid="kt_kotlinc_options-x_allow_result_return_type"></a>x_allow_result_return_type | Enable kotlin.Result as a return type | Boolean | optional | False |
416
418
|<aid="kt_kotlinc_options-x_backend_threads"></a>x_backend_threads | When using the IR backend, run lowerings by file in N parallel threads. 0 means use a thread per processor core. Default value is 1. | Integer | optional | 1 |
419
+
|<aid="kt_kotlinc_options-x_debug"></a>x_debug | Enable debugging, this option allows for a better debugging experience, especially when using coroutines, but should not be used in production | Boolean | optional | False |
417
420
|<aid="kt_kotlinc_options-x_emit_jvm_type_annotations"></a>x_emit_jvm_type_annotations | Basic support for type annotations in JVM bytecode. | Boolean | optional | False |
418
421
|<aid="kt_kotlinc_options-x_explicit_api_mode"></a>x_explicit_api_mode | Enable explicit API mode for Kotlin libraries. | String | optional | "off" |
|<aid="kt_kotlinc_options-x_use_k2"></a>x_use_k2 | Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided | Boolean | optional | False |
|<aid="kt_ksp_plugin-name"></a>name | A unique name for this target. | <ahref="https://bazel.build/docs/build-ref.html#name">Name</a> | required ||
474
+
|<aid="kt_ksp_plugin-deps"></a>deps | The list of libraries to be added to the compiler's plugin classpath | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
475
+
|<aid="kt_ksp_plugin-processor_class"></a>processor_class | The fully qualified class name that the Java compiler uses as an entry point to the annotation processor. | String | required ||
476
+
477
+
435
478
<aid="define_kt_toolchain"></a>
436
479
437
480
## define_kt_toolchain
@@ -485,7 +528,8 @@ This macro registers the kotlin toolchain.
| <aid="kotlin_repositories-compiler_release"></a>compiler_release | version provider from versions.bzl. | <code>struct()</code> |
545
+
| <aid="kotlin_repositories-ksp_compiler_release"></a>ksp_compiler_release | (internal) version provider from versions.bzl. | <code>struct()</code> |
500
546
| <aid="kotlin_repositories-configured_repository_name"></a>configured_repository_name | for the default versioned kt_* rules repository. If None, no versioned repository is created. | <code>"io_bazel_rules_kotlin_configured"</code> |
0 commit comments