| |
| |
| <!-- |
| Documentation generated by Skydoc |
| --> |
| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width initial-scale=1" /> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| |
| <title>Kotlin Rules</title> |
| |
| <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700" type="text/css"> |
| <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> |
| <link rel="stylesheet" href="https://code.getmdl.io/1.1.1/material.green-light_blue.min.css"> |
| <script defer src="https://code.getmdl.io/1.1.1/material.min.js"></script> |
| <link rel="stylesheet" href="https://bazelbuild.github.io/rules_kotlin/main.css"> |
| </head> |
| <body> |
| <div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer |
| mdl-layout--fixed-header"> |
| <header class="mdl-layout__header"> |
| <div class="mdl-layout__header-row"> |
| <span class="mdl-layout-title">Kotlin Rules</span> |
| </div> |
| </header> |
| <div class="mdl-layout__drawer"> |
| <span class="mdl-layout-title">Bazel</span> |
| <nav class="drawer-nav"> |
| <ul class="drawer-nav"> |
| |
| <li><a href="https://bazelbuild.github.io/rules_kotlin/index.html">Overview</a></li> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/kotlin.html">Kotlin Rules</a> |
| <ul> |
| <li><a href="https://bazelbuild.github.io/rules_kotlin/kotlin/kotlin.html#overview">Overview</a></li> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/kotlin.html#kt_jvm_binary"> |
| kt_jvm_binary |
| </a> |
| </li> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/kotlin.html#kt_jvm_import"> |
| kt_jvm_import |
| </a> |
| </li> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/kotlin.html#kt_jvm_library"> |
| kt_jvm_library |
| </a> |
| </li> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/kotlin.html#kt_jvm_test"> |
| kt_jvm_test |
| </a> |
| </li> |
| </ul> |
| </li> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/toolchains.html">toolchains Rules</a> |
| <ul> |
| <li> |
| <a href="https://bazelbuild.github.io/rules_kotlin/kotlin/toolchains.html#kt_toolchain"> |
| kt_toolchain |
| </a> |
| </li> |
| </ul> |
| </li> |
| |
| </ul> |
| </nav> |
| </div> |
| |
| <main class="mdl-layout__content"> |
| <div class="page-content"> |
| <h1>Kotlin Rules</h1> |
| |
| <nav class="toc"> |
| <h2><a href="#overview">Overview</a></h2> |
| <h2>Rules</h2> |
| <ul> |
| <li><a href="#kt_jvm_binary">kt_jvm_binary</a></li> |
| <li><a href="#kt_jvm_import">kt_jvm_import</a></li> |
| <li><a href="#kt_jvm_library">kt_jvm_library</a></li> |
| <li><a href="#kt_jvm_test">kt_jvm_test</a></li> |
| </ul> |
| <h2>Macros</h2> |
| <ul> |
| <li><a href="#kotlin_repositories">kotlin_repositories</a></li> |
| <li><a href="#kt_register_toolchains">kt_register_toolchains</a></li> |
| </ul> |
| </nav> |
| <hr> |
| <h2 id="overview">Overview</h2> |
| <h3>Setup</h3> |
| <p>Add the following snippet to your <code>WORKSPACE</code> file:</p> |
| <pre><code class="lang-bzl">git_repository( |
| name = "io_bazel_rules_kotlin", |
| remote = "https://github.com/bazelbuild/rules_kotlin.git", |
| commit = "<COMMIT_HASH>", |
| ) |
| load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains") |
| kotlin_repositories(kotlin_release_version = "1.2.21") |
| kt_register_toolchains() |
| </code></pre> |
| <p>To enable persistent worker support, add the following to the appropriate <code>bazelrc</code> file:</p> |
| <pre><code>build --strategy=KotlinCompile=worker |
| test --strategy=KotlinCompile=worker |
| </code></pre> |
| <h3>Standard Libraries</h3> |
| <p>The Kotlin libraries that are bundled in a kotlin release should be used with the rules, the mandatory standard libraries are added implicetly. After enabling |
| the repository the following Kotlin Libraries are also made available from the workspace <code>com_github_jetbrains_kotlin</code>:</p> |
| <ul> |
| <li><code>kotlin-test</code>,</li> |
| <li><code>kotlin-reflect</code>.</li> |
| </ul> |
| <p>So if you needed to add reflect as a dep use the following label <code>@com_github_jetbrains_kotlin//:kotlin-reflect</code>.</p> |
| <h3>Mixed Mode compilation</h3> |
| <p>The JVM rules can compile both Java and Kotlin sources. The Java compiler wrapper is not optimized or persistent and does not have the features found in the |
| native java rules. This mode is usefull for migrating a package to Kotlin over time.</p> |
| <h3>Annotation Processing</h3> |
| <p>Annotation processing works just as it does in Java, plugins are declared via a <a href="https://docs.bazel.build/versions/master/be/java.html#java_plugin"><code>java_plugin</code></a> |
| and may also be inherited from a <code>java_library</code> via the <code>exported_plugins</code> attribute. Annotation work in mixed-mode compilation and the Kotlin compiler take |
| care of processing both aspects.</p> |
| <p>An example which can be found under <code>//examples/dagger</code>:</p> |
| <pre><code class="lang-bzl">java_plugin( |
| name = "dagger_plugin", |
| deps = [ |
| "@dagger_compiler//jar", |
| "@guava//jar", |
| "@dagger_producers//jar", |
| "@dagger//jar", |
| "@javax_inject//jar" |
| ], |
| processor_class = "dagger.internal.codegen.ComponentProcessor" |
| ) |
| |
| java_library( |
| name = "dagger_lib", |
| exports = [ |
| "@javax_inject//jar", |
| "@dagger//jar", |
| ], |
| exported_plugins = ["dagger_plugin"] |
| ) |
| |
| kt_jvm_binary( |
| name = "dagger", |
| srcs = glob(["src/**"]), |
| main_class = "coffee.CoffeeApp", |
| deps = [":dagger_lib"], |
| ) |
| </code></pre> |
| |
| <hr> |
| |
| <h2 id="kotlin_repositories">kotlin_repositories</h2> |
| |
| <pre>kotlin_repositories(<a href="#kotlin_repositories.kotlin_release_version">kotlin_release_version</a>)</pre> |
| |
| <p>Call this in the WORKSPACE file to setup the Kotlin rules.</p> |
| |
| |
| <h3 id="kotlin_repositories_args">Attributes</h3> |
| |
| <table class="params-table"> |
| <colgroup> |
| <col class="col-param" /> |
| <col class="col-description" /> |
| </colgroup> |
| <tbody> |
| <tr id="kotlin_repositories.kotlin_release_version"> |
| <td><code>kotlin_release_version</code></td> |
| <td> |
| <p><code>Unknown; Optional</code></p> |
| <p>The kotlin compiler release version. If this is not set the latest release version is |
| chosen by default.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <hr> |
| |
| <h2 id="kt_register_toolchains">kt_register_toolchains</h2> |
| |
| <pre>kt_register_toolchains()</pre> |
| |
| <p>register all default toolchains</p> |
| |
| |
| <hr> |
| |
| <h2 id="kt_jvm_binary">kt_jvm_binary</h2> |
| |
| <pre>kt_jvm_binary(<a href="#kt_jvm_binary.name">name</a>, <a href="#kt_jvm_binary.deps">deps</a>, <a href="#kt_jvm_binary.data">data</a>, <a href="#kt_jvm_binary.resources">resources</a>, <a href="#kt_jvm_binary.srcs">srcs</a>, <a href="#kt_jvm_binary.jvm_flags">jvm_flags</a>, <a href="#kt_jvm_binary.main_class">main_class</a>, <a href="#kt_jvm_binary.module_name">module_name</a>, <a href="#kt_jvm_binary.plugins">plugins</a>, <a href="#kt_jvm_binary.resource_jars">resource_jars</a>, <a href="#kt_jvm_binary.resource_strip_prefix">resource_strip_prefix</a>, <a href="#kt_jvm_binary.runtime_deps">runtime_deps</a>)</pre> |
| |
| <p>Builds a Java archive ("jar file"), plus a wrapper shell script with the same name as the rule. The wrapper shell script uses a classpath that includes, |
| among other things, a jar file for each library on which the binary depends.</p> |
| <p><strong>Note:</strong> This rule does not have all of the features found in <a href="https://docs.bazel.build/versions/master/be/java.html#java_binary"><code>java_binary</code></a>. It is |
| appropriate for building workspace utilities. <code>java_binary</code> should be preferred for release artefacts.</p> |
| |
| |
| <h3 id="kt_jvm_binary_args">Attributes</h3> |
| |
| <table class="params-table"> |
| <colgroup> |
| <col class="col-param" /> |
| <col class="col-description" /> |
| </colgroup> |
| <tbody> |
| <tr id="kt_jvm_binary.name"> |
| <td><code>name</code></td> |
| <td> |
| <p><code><a href="https://bazel.build/docs/build-ref.html#name">Name</a>; Required</code></p> |
| <p>A unique name for this rule.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.deps"> |
| <td><code>deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A list of dependencies of this rule.See general comments about <code>deps</code> at <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes">Attributes common to all build rules</a>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.data"> |
| <td><code>data</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>The list of files needed by this rule at runtime. See general comments about <code>data</code> at <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes">Attributes common to all build rules</a>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.resources"> |
| <td><code>resources</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A list of data files to include in a Java jar.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.srcs"> |
| <td><code>srcs</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>The list of source files that are processed to create the target, this can contain both Java and Kotlin files. Java analysis occurs first so Kotlin |
| classes may depend on Java classes in the same compilation unit.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.jvm_flags"> |
| <td><code>jvm_flags</code></td> |
| <td> |
| <p><code>List of strings; Optional; Default is []</code></p> |
| <p>A list of flags to embed in the wrapper script generated for running this binary. Note: does not yet support make variable substitution.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.main_class"> |
| <td><code>main_class</code></td> |
| <td> |
| <p><code>String; Required</code></p> |
| <p>Name of class with main() method to use as entry point.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.module_name"> |
| <td><code>module_name</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The name of the module, if not provided the module name is derived from the label. --e.g., <code>//some/package/path:label_name</code> is translated to |
| <code>some_package_path-label_name</code>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.plugins"> |
| <td><code>plugins</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.resource_jars"> |
| <td><code>resource_jars</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Set of archives containing Java resources. If specified, the contents of these jars are merged into the output jar.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.resource_strip_prefix"> |
| <td><code>resource_strip_prefix</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The path prefix to strip from Java resources, files residing under common prefix such as <code>src/main/resources</code> or <code>src/test/resources</code> |
| will have stripping applied by convention.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_binary.runtime_deps"> |
| <td><code>runtime_deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Libraries to make available to the final binary or test at runtime only. Like ordinary deps, these will appear on the runtime classpath, but |
| unlike them, not on the compile-time classpath.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <hr> |
| |
| <h2 id="kt_jvm_import">kt_jvm_import</h2> |
| |
| <pre>kt_jvm_import(<a href="#kt_jvm_import.name">name</a>, <a href="#kt_jvm_import.jars">jars</a>, <a href="#kt_jvm_import.runtime_deps">runtime_deps</a>, <a href="#kt_jvm_import.srcjar">srcjar</a>)</pre> |
| |
| <p>(experimental) Import Kotlin jars.</p> |
| <p><strong>Status:</strong> This rule is not a counterpart to <code>java_import</code>. The current purpose for this rule is to import a kotlin jar without creating ijars. It will |
| eventually <a href="https://github.com/bazelbuild/rules_kotlin/issues/4">be replaced</a> with <code>java_import</code>. If there is a need for expanding this rule we can instead |
| create a utility macro that delegates to this.</p> |
| <h2>examples</h2> |
| <pre><code class="lang-bzl"># Old style usage -- reference file groups, do not used this. |
| kt_jvm_import( |
| name = "kodein", |
| jars = [ |
| "@com_github_salomonbrys_kodein_kodein//jar:file", |
| "@com_github_salomonbrys_kodein_kodein_core//jar:file" |
| ] |
| ) |
| |
| # This style will pull in the transitive runtime dependencies of the targets as well. |
| kt_jvm_import( |
| name = "kodein", |
| jars = [ |
| "@com_github_salomonbrys_kodein_kodein//jar", |
| "@com_github_salomonbrys_kodein_kodein_core//jar" |
| ] |
| ) |
| |
| # Import a single kotlin jar. |
| kt_jvm_import( |
| name = "kotlin-runtime", |
| jars = ["lib/kotlin-runtime.jar"], |
| srcjar = "lib/kotlin-runtime-sources.jar" |
| ) |
| </code></pre> |
| |
| |
| <h3 id="kt_jvm_import_args">Attributes</h3> |
| |
| <table class="params-table"> |
| <colgroup> |
| <col class="col-param" /> |
| <col class="col-description" /> |
| </colgroup> |
| <tbody> |
| <tr id="kt_jvm_import.name"> |
| <td><code>name</code></td> |
| <td> |
| <p><code><a href="https://bazel.build/docs/build-ref.html#name">Name</a>; Required</code></p> |
| <p>A unique name for this rule.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_import.jars"> |
| <td><code>jars</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Required</code></p> |
| <p>The jars listed here are equavalent to an export attribute. The label should be either to a single class jar, or multiple filegroup labels. When the |
| labels is a file_provider it should follow the conventions used in repositories generated by the maven_jar rule --i.e., the rule expects a file_provider |
| with a single class jar and a single source jar. a source jar is recognized by the suffix <code>-sources.jar</code>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_import.runtime_deps"> |
| <td><code>runtime_deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Additional runtime deps.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_import.srcjar"> |
| <td><code>srcjar</code></td> |
| <td> |
| <p><code><a href="https://bazel.build/docs/build-ref.html#labels">Label</a>; Optional</code></p> |
| <p>The sources for the class jar. This should be set when importing a single class jar.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <hr> |
| |
| <h2 id="kt_jvm_library">kt_jvm_library</h2> |
| |
| <pre>kt_jvm_library(<a href="#kt_jvm_library.name">name</a>, <a href="#kt_jvm_library.deps">deps</a>, <a href="#kt_jvm_library.data">data</a>, <a href="#kt_jvm_library.resources">resources</a>, <a href="#kt_jvm_library.srcs">srcs</a>, <a href="#kt_jvm_library.exports">exports</a>, <a href="#kt_jvm_library.module_name">module_name</a>, <a href="#kt_jvm_library.plugins">plugins</a>, <a href="#kt_jvm_library.resource_jars">resource_jars</a>, <a href="#kt_jvm_library.resource_strip_prefix">resource_strip_prefix</a>, <a href="#kt_jvm_library.runtime_deps">runtime_deps</a>)</pre> |
| |
| <p>This rule compiles and links Kotlin and Java sources into a .jar file.</p> |
| |
| |
| <h3 id="kt_jvm_library_args">Attributes</h3> |
| |
| <table class="params-table"> |
| <colgroup> |
| <col class="col-param" /> |
| <col class="col-description" /> |
| </colgroup> |
| <tbody> |
| <tr id="kt_jvm_library.name"> |
| <td><code>name</code></td> |
| <td> |
| <p><code><a href="https://bazel.build/docs/build-ref.html#name">Name</a>; Required</code></p> |
| <p>A unique name for this rule.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.deps"> |
| <td><code>deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A list of dependencies of this rule.See general comments about <code>deps</code> at <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes">Attributes common to all build rules</a>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.data"> |
| <td><code>data</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>The list of files needed by this rule at runtime. See general comments about <code>data</code> at <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes">Attributes common to all build rules</a>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.resources"> |
| <td><code>resources</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A list of data files to include in a Java jar.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.srcs"> |
| <td><code>srcs</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>The list of source files that are processed to create the target, this can contain both Java and Kotlin files. Java analysis occurs first so Kotlin |
| classes may depend on Java classes in the same compilation unit.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.exports"> |
| <td><code>exports</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Exported libraries.</p> |
| <p>Deps listed here will be made available to other rules, as if the parents explicitly depended on these deps. |
| This is not true for regular (non-exported) deps.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.module_name"> |
| <td><code>module_name</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The name of the module, if not provided the module name is derived from the label. --e.g., <code>//some/package/path:label_name</code> is translated to |
| <code>some_package_path-label_name</code>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.plugins"> |
| <td><code>plugins</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.resource_jars"> |
| <td><code>resource_jars</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Set of archives containing Java resources. If specified, the contents of these jars are merged into the output jar.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.resource_strip_prefix"> |
| <td><code>resource_strip_prefix</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The path prefix to strip from Java resources, files residing under common prefix such as <code>src/main/resources</code> or <code>src/test/resources</code> |
| will have stripping applied by convention.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_library.runtime_deps"> |
| <td><code>runtime_deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Libraries to make available to the final binary or test at runtime only. Like ordinary deps, these will appear on the runtime classpath, but |
| unlike them, not on the compile-time classpath.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <hr> |
| |
| <h2 id="kt_jvm_test">kt_jvm_test</h2> |
| |
| <pre>kt_jvm_test(<a href="#kt_jvm_test.name">name</a>, <a href="#kt_jvm_test.deps">deps</a>, <a href="#kt_jvm_test.data">data</a>, <a href="#kt_jvm_test.resources">resources</a>, <a href="#kt_jvm_test.srcs">srcs</a>, <a href="#kt_jvm_test.friends">friends</a>, <a href="#kt_jvm_test.jvm_flags">jvm_flags</a>, <a href="#kt_jvm_test.main_class">main_class</a>, <a href="#kt_jvm_test.module_name">module_name</a>, <a href="#kt_jvm_test.plugins">plugins</a>, <a href="#kt_jvm_test.resource_jars">resource_jars</a>, <a href="#kt_jvm_test.resource_strip_prefix">resource_strip_prefix</a>, <a href="#kt_jvm_test.runtime_deps">runtime_deps</a>, <a href="#kt_jvm_test.test_class">test_class</a>)</pre> |
| |
| <p>Setup a simple kotlin_test.</p> |
| <p><strong>Notes:</strong></p> |
| <ul> |
| <li>The kotlin test library is not added implicitly, it is available with the label <code>@com_github_jetbrains_kotlin//:kotlin-test</code>.</li> |
| </ul> |
| |
| |
| <h3 id="kt_jvm_test_args">Attributes</h3> |
| |
| <table class="params-table"> |
| <colgroup> |
| <col class="col-param" /> |
| <col class="col-description" /> |
| </colgroup> |
| <tbody> |
| <tr id="kt_jvm_test.name"> |
| <td><code>name</code></td> |
| <td> |
| <p><code><a href="https://bazel.build/docs/build-ref.html#name">Name</a>; Required</code></p> |
| <p>A unique name for this rule.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.deps"> |
| <td><code>deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A list of dependencies of this rule.See general comments about <code>deps</code> at <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes">Attributes common to all build rules</a>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.data"> |
| <td><code>data</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>The list of files needed by this rule at runtime. See general comments about <code>data</code> at <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes">Attributes common to all build rules</a>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.resources"> |
| <td><code>resources</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A list of data files to include in a Java jar.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.srcs"> |
| <td><code>srcs</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>The list of source files that are processed to create the target, this can contain both Java and Kotlin files. Java analysis occurs first so Kotlin |
| classes may depend on Java classes in the same compilation unit.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.friends"> |
| <td><code>friends</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>A single Kotlin dep which allows the test code access to internal members. Currently uses the output jar of |
| the module -- i.e., exported deps won't be included.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.jvm_flags"> |
| <td><code>jvm_flags</code></td> |
| <td> |
| <p><code>List of strings; Optional; Default is []</code></p> |
| <p>A list of flags to embed in the wrapper script generated for running this binary. Note: does not yet support make variable substitution.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.main_class"> |
| <td><code>main_class</code></td> |
| <td> |
| <p><code>String; Optional; Default is 'com.google.testing.junit.runner.BazelTestRunner'</code></p> |
| |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.module_name"> |
| <td><code>module_name</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The name of the module, if not provided the module name is derived from the label. --e.g., <code>//some/package/path:label_name</code> is translated to |
| <code>some_package_path-label_name</code>.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.plugins"> |
| <td><code>plugins</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.resource_jars"> |
| <td><code>resource_jars</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Set of archives containing Java resources. If specified, the contents of these jars are merged into the output jar.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.resource_strip_prefix"> |
| <td><code>resource_strip_prefix</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The path prefix to strip from Java resources, files residing under common prefix such as <code>src/main/resources</code> or <code>src/test/resources</code> |
| will have stripping applied by convention.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.runtime_deps"> |
| <td><code>runtime_deps</code></td> |
| <td> |
| <p><code>List of <a href="https://bazel.build/docs/build-ref.html#labels">labels</a>; Optional; Default is []</code></p> |
| <p>Libraries to make available to the final binary or test at runtime only. Like ordinary deps, these will appear on the runtime classpath, but |
| unlike them, not on the compile-time classpath.</p> |
| </td> |
| </tr> |
| <tr id="kt_jvm_test.test_class"> |
| <td><code>test_class</code></td> |
| <td> |
| <p><code>String; Optional; Default is ''</code></p> |
| <p>The Java class to be loaded by the test runner.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| |
| </div> |
| |
| <footer class="mdl-mini-footer"> |
| <div class="mdl-mini-footer__left-section"> |
| <div class="mdl-logo">Bazel</div> |
| <ul class="mdl-mini-footer__link-list"> |
| <li><a href="https://bazel.build">Home</a></li> |
| <li><a href="https://github.com/bazelbuild">GitHub</a></li> |
| </ul> |
| </div> |
| </footer> |
| </main> |
| </div> |
| </body> |
| </html> |