diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl index 380437c35..9740f0eda 100644 --- a/kotlin/internal/jvm/impl.bzl +++ b/kotlin/internal/jvm/impl.bzl @@ -41,25 +41,22 @@ def _make_providers(ctx, providers, transitive_files = depset(order = "default") files = [ctx.outputs.jar] if providers.java.outputs.jdeps: files.append(providers.java.outputs.jdeps) - return struct( - kt = providers.kt, - providers = [ - providers.java, - providers.kt, - providers.instrumented_files, - DefaultInfo( - files = depset(files), - runfiles = ctx.runfiles( - # explicitly include data files, otherwise they appear to be missing - files = ctx.files.data, - transitive_files = transitive_files, - # continue to use collect_default until proper transitive data collecting is - # implmented. - collect_default = True, - ), + return [ + providers.java, + providers.kt, + providers.instrumented_files, + DefaultInfo( + files = depset(files), + runfiles = ctx.runfiles( + # explicitly include data files, otherwise they appear to be missing + files = ctx.files.data, + transitive_files = transitive_files, + # continue to use collect_default until proper transitive data collecting is + # implmented. + collect_default = True, ), - ] + list(additional_providers), - ) + ), + ] + list(additional_providers) def _write_launcher_action(ctx, rjars, main_class, jvm_flags): """Macro that writes out a launcher script shell script. @@ -193,28 +190,25 @@ def kt_jvm_import_impl(ctx): ), ) - return struct( - kt = kt_info, - providers = [ - DefaultInfo( - files = depset(direct = [artifact.class_jar]), - runfiles = ctx.runfiles( - # Append class jar with the optional sources jar - files = [artifact.class_jar] + [artifact.source_jar] if artifact.source_jar else [], - ).merge_all([d[DefaultInfo].default_runfiles for d in ctx.attr.deps]), - ), - JavaInfo( - output_jar = artifact.class_jar, - compile_jar = artifact.class_jar, - source_jar = artifact.source_jar, - runtime_deps = [dep[JavaInfo] for dep in ctx.attr.runtime_deps if JavaInfo in dep], - deps = [dep[JavaInfo] for dep in ctx.attr.deps if JavaInfo in dep], - exports = [d[JavaInfo] for d in getattr(ctx.attr, "exports", [])], - neverlink = getattr(ctx.attr, "neverlink", False), - ), - kt_info, - ], - ) + return [ + DefaultInfo( + files = depset(direct = [artifact.class_jar]), + runfiles = ctx.runfiles( + # Append class jar with the optional sources jar + files = [artifact.class_jar] + [artifact.source_jar] if artifact.source_jar else [], + ).merge_all([d[DefaultInfo].default_runfiles for d in ctx.attr.deps]), + ), + JavaInfo( + output_jar = artifact.class_jar, + compile_jar = artifact.class_jar, + source_jar = artifact.source_jar, + runtime_deps = [dep[JavaInfo] for dep in ctx.attr.runtime_deps if JavaInfo in dep], + deps = [dep[JavaInfo] for dep in ctx.attr.deps if JavaInfo in dep], + exports = [d[JavaInfo] for d in getattr(ctx.attr, "exports", [])], + neverlink = getattr(ctx.attr, "neverlink", False), + ), + kt_info, + ] def kt_jvm_library_impl(ctx): if ctx.attr.neverlink and ctx.attr.runtime_deps: diff --git a/kotlin/internal/jvm/jvm.bzl b/kotlin/internal/jvm/jvm.bzl index 2f20de6d7..76cf17448 100644 --- a/kotlin/internal/jvm/jvm.bzl +++ b/kotlin/internal/jvm/jvm.bzl @@ -145,6 +145,12 @@ _implicit_deps = { default = Label("//kotlin/compiler:kotlin-stdlib"), cfg = "target", ), + "_kt_toolchain": attr.label( + doc = """The Kotlin toolchain. it's only purpose is to enable the Intellij + to discover Kotlin language version""", + default = Label("//kotlin/internal:default_toolchain_impl"), + cfg = "target", + ), "_java_toolchain": attr.label( default = Label("@bazel_tools//tools/jdk:current_java_toolchain"), ), diff --git a/kotlin/internal/utils/generate_jvm_service.bzl b/kotlin/internal/utils/generate_jvm_service.bzl index 8af8c12a0..8bad49fae 100644 --- a/kotlin/internal/utils/generate_jvm_service.bzl +++ b/kotlin/internal/utils/generate_jvm_service.bzl @@ -46,22 +46,20 @@ def _generate_jvm_service_impl(ctx): arguments = [zipper_args], progress_message = "JVM service info jar for %%{label}", ) - return struct( - providers = [ - JavaInfo( - output_jar = jar, - compile_jar = jar, - source_jar = jar, - runtime_deps = [], - exports = [], - neverlink = False, - ), - DefaultInfo( - files = depset([jar]), - runfiles = ctx.runfiles(files = [jar]), - ), - ], - ) + return [ + JavaInfo( + output_jar = jar, + compile_jar = jar, + source_jar = jar, + runtime_deps = [], + exports = [], + neverlink = False, + ), + DefaultInfo( + files = depset([jar]), + runfiles = ctx.runfiles(files = [jar]), + ), + ] def _write_service_file(ctx, srv, impls): f = ctx.actions.declare_file(ctx.label.name + "/" + srv) diff --git a/src/main/starlark/core/options/opts.javac.bzl b/src/main/starlark/core/options/opts.javac.bzl index a6c852b91..78974868a 100644 --- a/src/main/starlark/core/options/opts.javac.bzl +++ b/src/main/starlark/core/options/opts.javac.bzl @@ -100,11 +100,7 @@ _JOPTS = { } def _javac_options_impl(ctx): - return struct( - providers = [ - JavacOptions(**{n: getattr(ctx.attr, n, None) for n in _JOPTS}), - ], - ) + return [JavacOptions(**{n: getattr(ctx.attr, n, None) for n in _JOPTS})] JavacOptions = provider( fields = { diff --git a/src/main/starlark/core/options/opts.kotlinc.bzl b/src/main/starlark/core/options/opts.kotlinc.bzl index 9b15fb8ea..013f78ef6 100644 --- a/src/main/starlark/core/options/opts.kotlinc.bzl +++ b/src/main/starlark/core/options/opts.kotlinc.bzl @@ -362,11 +362,7 @@ KotlincOptions = provider( ) def _kotlinc_options_impl(ctx): - return struct( - providers = [ - KotlincOptions(**{n: getattr(ctx.attr, n, None) for n in _KOPTS}), - ], - ) + return [KotlincOptions(**{n: getattr(ctx.attr, n, None) for n in _KOPTS})] kt_kotlinc_options = rule( implementation = _kotlinc_options_impl,