Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify experimental java builder + abi jar flags #411

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ kt_jvm_test(<a href="#kt_jvm_test-name">name</a>, <a href="#kt_jvm_test-data">da
## define_kt_toolchain

<pre>
define_kt_toolchain(<a href="#define_kt_toolchain-name">name</a>, <a href="#define_kt_toolchain-language_version">language_version</a>, <a href="#define_kt_toolchain-api_version">api_version</a>, <a href="#define_kt_toolchain-jvm_target">jvm_target</a>, <a href="#define_kt_toolchain-experimental_use_abi_jars">experimental_use_abi_jars</a>, <a href="#define_kt_toolchain-experimental_use_java_builder">experimental_use_java_builder</a>
define_kt_toolchain(<a href="#define_kt_toolchain-name">name</a>, <a href="#define_kt_toolchain-language_version">language_version</a>, <a href="#define_kt_toolchain-api_version">api_version</a>, <a href="#define_kt_toolchain-jvm_target">jvm_target</a>, <a href="#define_kt_toolchain-experimental_use_abi_jars">experimental_use_abi_jars</a>
<a href="#define_kt_toolchain-javac_options">javac_options</a>, <a href="#define_kt_toolchain-kotlinc_options">kotlinc_options</a>)
</pre>

Expand All @@ -292,7 +292,6 @@ Define the Kotlin toolchain.
| api_version | <p align="center"> - </p> | <code>None</code> |
| jvm_target | <p align="center"> - </p> | <code>None</code> |
| experimental_use_abi_jars | <p align="center"> - </p> | <code>False</code> |
| experimental_use_java_builder | <p align="center"> - </p> | <code>False</code> |
| javac_options | <p align="center"> - </p> | <code>None</code> |
| kotlinc_options | <p align="center"> - </p> | <code>None</code> |

Expand Down
1 change: 0 additions & 1 deletion examples/android/bzl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ define_kt_toolchain(
name = "experimental_toolchain",
api_version = "1.4",
experimental_use_abi_jars = True,
experimental_use_java_builder = True,
language_version = "1.4",
javac_options = ":default_javac_options",
kotlinc_options = ":default_kotlinc_options"
Expand Down
6 changes: 2 additions & 4 deletions kotlin/internal/jvm/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def kt_jvm_produce_jar_actions(ctx, rule_kind):
plugins = ctx.attr.plugins + _exported_plugins(deps = ctx.attr.deps)

generated_src_jars = []
if toolchains.kt.experimental_use_java_builder:
if toolchains.kt.experimental_use_abi_jars:
compile_jar = ctx.actions.declare_file(ctx.label.name + ".abi.jar")
output_jars = _run_kt_java_builder_actions(
ctx = ctx,
Expand Down Expand Up @@ -632,7 +632,7 @@ def _run_kt_java_builder_actions(ctx, rule_kind, toolchains, srcs, generated_src
# Build Kotlin
if srcs.kt or srcs.src_jars:
kt_runtime_jar = ctx.actions.declare_file(ctx.label.name + "-kt.jar")
if toolchains.kt.experimental_use_abi_jars and not "kt_abi_plugin_incompatible" in ctx.attr.tags:
if not "kt_abi_plugin_incompatible" in ctx.attr.tags:
kt_compile_jar = ctx.actions.declare_file(ctx.label.name + "-kt.abi.jar")
outputs = {
"output": kt_runtime_jar,
Expand Down Expand Up @@ -708,8 +708,6 @@ def _run_kt_java_builder_actions(ctx, rule_kind, toolchains, srcs, generated_src
]
java_infos.append(java_info)

compile_jar = ctx.actions.declare_file(ctx.label.name + ".abi.jar")

# Merge ABI jars into final compile jar.
_fold_jars_action(
ctx,
Expand Down
24 changes: 2 additions & 22 deletions kotlin/internal/toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def _kotlin_toolchain_impl(ctx):
jvm_stdlibs = java_common.merge(compile_time_providers + runtime_providers),
js_stdlibs = ctx.attr.js_stdlibs,
experimental_use_abi_jars = ctx.attr.experimental_use_abi_jars,
experimental_use_java_builder = ctx.attr.experimental_use_java_builder,
javac_options = ctx.attr.javac_options[JavacOptions] if ctx.attr.javac_options else None,
kotlinc_options = ctx.attr.kotlinc_options[KotlincOptions] if ctx.attr.kotlinc_options else None,
empty_jar = ctx.file._empty_jar,
Expand Down Expand Up @@ -171,12 +170,8 @@ _kt_toolchain = rule(
providers = [_KtJsInfo],
),
"experimental_use_abi_jars": attr.bool(
doc = """Compile using abi jars, requires experimental_use_java_builder. Can be disabled
for an individual target using the tag `kt_abi_plugin_incompatible`""",
default = False,
),
"experimental_use_java_builder" : attr.bool(
doc="Use Bazel JavaBuilder for Java source",
doc = """Compile using abi jars. Can be disabled for an individual target using the tag
`kt_abi_plugin_incompatible`""",
default = False,
),
"javac_options": attr.label(
Expand Down Expand Up @@ -216,7 +211,6 @@ def define_kt_toolchain(
api_version = None,
jvm_target = None,
experimental_use_abi_jars = False,
experimental_use_java_builder = False,
javac_options = None,
kotlinc_options = None):
"""Define the Kotlin toolchain."""
Expand All @@ -240,11 +234,6 @@ def define_kt_toolchain(
"@io_bazel_rules_kotlin//kotlin/internal:noexperimental_use_abi_jars": False,
"//conditions:default": experimental_use_abi_jars,
}),
experimental_use_java_builder = select({
"@io_bazel_rules_kotlin//kotlin/internal:experimental_use_java_builder": True,
"@io_bazel_rules_kotlin//kotlin/internal:noexperimental_use_java_builder": False,
"//conditions:default": experimental_use_java_builder,
}),
javac_options = javac_options,
kotlinc_options = kotlinc_options,
visibility = ["//visibility:public"],
Expand All @@ -270,15 +259,6 @@ def kt_configure_toolchains():
values = {"define": "experimental_use_abi_jars=0"},
)

native.config_setting(
name = "experimental_use_java_builder",
values = {"define": "experimental_use_java_builder=1"},
)
native.config_setting(
name = "noexperimental_use_java_builder",
values = {"define": "experimental_use_java_builder=0"},
)

native.config_setting(
name = "builder_debug_timings",
values = {"define": "kt_timings=1"},
Expand Down