Skip to content

Commit

Permalink
Add support for env_inherit
Browse files Browse the repository at this point in the history
  • Loading branch information
gibfahn committed Dec 23, 2023
1 parent 6c8723f commit 6302065
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ kt_jvm_library(<a href="#kt_jvm_library-name">name</a>, <a href="#kt_jvm_library

## kt_jvm_test

kt_jvm_test(<a href="#kt_jvm_test-name">name</a>, <a href="#kt_jvm_test-associates">associates</a>, <a href="#kt_jvm_test-data">data</a>, <a href="#kt_jvm_test-deps">deps</a>, <a href="#kt_jvm_test-env">env</a>, <a href="#kt_jvm_test-javac_opts">javac_opts</a>, <a href="#kt_jvm_test-jvm_flags">jvm_flags</a>, <a href="#kt_jvm_test-kotlinc_opts">kotlinc_opts</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-resources">resources</a>, <a href="#kt_jvm_test-runtime_deps">runtime_deps</a>, <a href="#kt_jvm_test-srcs">srcs</a>,
<a href="#kt_jvm_test-test_class">test_class</a>)
kt_jvm_test(<a href="#kt_jvm_test-name">name</a>, <a href="#kt_jvm_test-associates">associates</a>, <a href="#kt_jvm_test-data">data</a>, <a href="#kt_jvm_test-deps">deps</a>, <a href="#kt_jvm_test-env">env</a>, <a href="#kt_jvm_test-env_inherit">env_inherit</a>, <a href="#kt_jvm_test-javac_opts">javac_opts</a>, <a href="#kt_jvm_test-jvm_flags">jvm_flags</a>, <a href="#kt_jvm_test-kotlinc_opts">kotlinc_opts</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-resources">resources</a>,
<a href="#kt_jvm_test-runtime_deps">runtime_deps</a>, <a href="#kt_jvm_test-srcs">srcs</a>, <a href="#kt_jvm_test-test_class">test_class</a>)

Setup a simple kotlin_test.
Expand All @@ -226,6 +226,7 @@ kt_jvm_test(<a href="#kt_jvm_test-name">name</a>, <a href="#kt_jvm_test-associat
|<a id="kt_jvm_test-data"></a>data | The list of files needed by this rule at runtime. See general comments about <code>data</code> at [Attributes common to all build rules](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes). | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
|<a id="kt_jvm_test-deps"></a>deps | A list of dependencies of this rule.See general comments about <code>deps</code> at [Attributes common to all build rules](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes). | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
|<a id="kt_jvm_test-env"></a>env | Specifies additional environment variables to set when the target is executed by bazel test. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
|<a id="kt_jvm_test-env_inherit"></a>env_inherit | Environment variables to inherit from the external environment. | List of strings | optional | [] |
|<a id="kt_jvm_test-javac_opts"></a>javac_opts | Javac options to be used when compiling this target. These opts if provided will be used instead of the ones provided to the toolchain. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | None |
|<a id="kt_jvm_test-jvm_flags"></a>jvm_flags | A list of flags to embed in the wrapper script generated for running this binary. Note: does not yet support make variable substitution. | List of strings | optional | [] |
|<a id="kt_jvm_test-kotlinc_opts"></a>kotlinc_opts | Kotlinc options to be used when compiling this target. These opts if provided will be used instead of the ones provided to the toolchain. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | None |
Expand Down
2 changes: 1 addition & 1 deletion kotlin/internal/jvm/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def kt_jvm_junit_test_impl(ctx):
direct = ctx.files._java_runtime,
),
# adds common test variables, including TEST_WORKSPACE.
testing.TestEnvironment(environment = ctx.attr.env),
testing.TestEnvironment(environment = ctx.attr.env, inherited_environment = ctx.attr.env_inherit),
)

_KtCompilerPluginClasspathInfo = provider(
Expand Down
3 changes: 3 additions & 0 deletions kotlin/internal/jvm/jvm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ Setup a simple kotlin_test.
doc = "Specifies additional environment variables to set when the target is executed by bazel test.",
default = {},
),
"env_inherit": attr.string_list(
doc = "Environment variables to inherit from the external environment.",
),
"_lcov_merger": attr.label(
default = Label("@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main"),
),
Expand Down

0 comments on commit 6302065

Please sign in to comment.