diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1bb3d63ae..1137c933d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -1,6 +1,6 @@ --- validate_config: 1 -bazel: 6.0.0-pre.20221020.1 +bazel: 6.0.0 buildifier: version: 5.1.0 # no lint warnings for the moment. They are basically a smoke alarm in hell. diff --git a/.bazelversion b/.bazelversion index 351136000..09b254e90 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.0.0-pre.20221020.1 +6.0.0 diff --git a/BUILD b/BUILD index 32ee639a4..80e6873aa 100644 --- a/BUILD +++ b/BUILD @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. load("//src/main/starlark/release:packager.bzl", "release_archive") -load("//src/main/starlark/core/repositories:versions.bzl", "versions") load("//kotlin:lint.bzl", "ktlint_config") exports_files([ @@ -52,20 +51,9 @@ test_suite( ], ) -[ - release_archive( - name = version, - deps = [ - "@%s//:pkg" % version, - ], - ) - for version in versions.CORE -] - # Release target. release_archive( name = "rules_kotlin_release", - srcs = ["%s.tgz" % v for v in versions.CORE], src_map = { "BUILD.release.bazel": "BUILD.bazel", "WORKSPACE.release.bazel": "WORKSPACE", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eca086013..1e3ed9253 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,18 +57,6 @@ The `rules_kotlin` runtime is comprised of multiple repositories. The end user w versioned feature sub-repositories. Currently, the delegation is managed by using well known names (e.g. core lives in `@io_bazel_rules_kotlin_configured`), a necessity while the initial repository can be named arbitrarily. Future development intends to remove this restriction. -### Versioning - -To cope with API churn, the release archive can configure different rule attributes for depending on the chosen kotlin version. - Each major release of kotlin (1.4, 1.5) has a specific sub-repository under [src/main/starlark](src/main/starlark). The naming convention for these - is `rkt__` ([r]elease [k]o[t]lin). - -The version is selected by the [kotlin_repositories](src/main/starlark/repositories/initialize.release.bzl) rule during initialization. -New versions of kotlin that change the API should be added to [versions.bzl](src/main/starlark/repositories/versions.bzl), under `CORE` following the -existing naming convention. - -Multiple versions of kotlin are not currently handled.(_help wanted_) - ## Idioms and Styles TBD diff --git a/docs/kotlin.md b/docs/kotlin.md index 66170af3e..2d6debb36 100755 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -485,7 +485,7 @@ This macro registers the kotlin toolchain. ## kotlin_repositories
-kotlin_repositories(compiler_repository_name, compiler_release, configured_repository_name)
+kotlin_repositories(compiler_repository_name, compiler_release)
 
Call this in the WORKSPACE file to setup the Kotlin rules. @@ -497,6 +497,5 @@ Call this in the WORKSPACE file to setup the Kotlin rules. | :------------- | :------------- | :------------- | | compiler_repository_name | for the kotlinc compiler repository. | "com_github_jetbrains_kotlin" | | compiler_release | version provider from versions.bzl. | struct() | -| configured_repository_name | for the default versioned kt_* rules repository. If None, no versioned repository is created. | "io_bazel_rules_kotlin_configured" | diff --git a/examples/anvil/WORKSPACE b/examples/anvil/WORKSPACE index de448cb57..c424be25f 100644 --- a/examples/anvil/WORKSPACE +++ b/examples/anvil/WORKSPACE @@ -42,8 +42,8 @@ http_archive( http_archive( name = "rules_pkg", - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", - url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", + sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", + url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", ) http_archive( diff --git a/examples/associates/WORKSPACE b/examples/associates/WORKSPACE index 4fa21580d..a08b43dbf 100644 --- a/examples/associates/WORKSPACE +++ b/examples/associates/WORKSPACE @@ -55,6 +55,6 @@ maven_install( http_archive( name = "rules_pkg", - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", - url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", + sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", + url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", ) diff --git a/examples/trivial/WORKSPACE b/examples/trivial/WORKSPACE index 6ce103752..90eb8a48f 100644 --- a/examples/trivial/WORKSPACE +++ b/examples/trivial/WORKSPACE @@ -49,6 +49,6 @@ maven_install( http_archive( name = "rules_pkg", - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", - url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", + sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", + url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", ) diff --git a/kotlin/internal/BUILD b/kotlin/internal/BUILD index 8e8cf852d..16e30056d 100644 --- a/kotlin/internal/BUILD +++ b/kotlin/internal/BUILD @@ -13,7 +13,6 @@ # limitations under the License. load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains") load("//src/main/starlark/release:packager.bzl", "release_archive") -load("//src/main/starlark/core/repositories:versions.bzl", "versions") load("@bazel_skylib//:bzl_library.bzl", "bzl_library") # Configures the toolchains @@ -23,11 +22,9 @@ release_archive( name = "pkg", srcs = glob( ["*.bzl"], - exclude = ["opts.bzl"], ), src_map = { "BUILD.release.bazel": "BUILD.bazel", - "opts.release.bzl": "opts.bzl", }, deps = [ "//kotlin/internal/js:pkg", @@ -47,8 +44,6 @@ bzl_library( "//kotlin/internal/lint", "//kotlin/internal/utils", "//src/main/starlark", - ] + [ - "@%s//starlark" % v - for v in versions.CORE + "@com_github_jetbrains_kotlin//:capabilities_bzl", ], ) diff --git a/kotlin/internal/opts.bzl b/kotlin/internal/opts.bzl index c476be3fa..e16089551 100644 --- a/kotlin/internal/opts.bzl +++ b/kotlin/internal/opts.bzl @@ -13,13 +13,13 @@ # limitations under the License. load( - "@rkt_1_7//starlark/kotlin:opts.bzl", + ":opts.kotlinc.bzl", _KotlincOptions = "KotlincOptions", _kotlinc_options_to_flags = "kotlinc_options_to_flags", _kt_kotlinc_options = "kt_kotlinc_options", ) load( - "@rkt_1_7//starlark/jvm:opts.bzl", + ":opts.javac.bzl", _JavacOptions = "JavacOptions", _javac_options_to_flags = "javac_options_to_flags", _kt_javac_options = "kt_javac_options", diff --git a/src/rkt_1_5/starlark/jvm/opts.bzl b/kotlin/internal/opts.javac.bzl similarity index 76% rename from src/rkt_1_5/starlark/jvm/opts.bzl rename to kotlin/internal/opts.javac.bzl index a019afd6f..b388110d8 100644 --- a/src/rkt_1_5/starlark/jvm/opts.bzl +++ b/kotlin/internal/opts.javac.bzl @@ -1,5 +1,19 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:derive.bzl", "derive") -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//src/main/starlark/core/options:derive.bzl", "derive") +load("//src/main/starlark/core/options:convert.bzl", "convert") _JOPTS = { "warn": struct( diff --git a/src/rkt_1_7/starlark/kotlin/opts.bzl b/kotlin/internal/opts.kotlinc.bzl similarity index 80% rename from src/rkt_1_7/starlark/kotlin/opts.bzl rename to kotlin/internal/opts.kotlinc.bzl index bf31c19ea..6002d372e 100644 --- a/src/rkt_1_7/starlark/kotlin/opts.bzl +++ b/kotlin/internal/opts.kotlinc.bzl @@ -1,4 +1,19 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//src/main/starlark/core/options:convert.bzl", "convert") +load("@com_github_jetbrains_kotlin//:capabilities.bzl", _KOTLIN_OPTS = "KOTLIN_OPTS") def _map_optin_class_to_flag(values): return ["-opt-in=%s" % v for v in values] @@ -13,7 +28,7 @@ def _map_jvm_target_to_flag(version): return None return ["-jvm-target=%s" % version] -_KOPTS = { +_KOPTS_ALL = { "warn": struct( args = dict( default = "report", @@ -41,6 +56,7 @@ _KOPTS = { }, ), "x_skip_prerelease_check": struct( + flag = "-Xskip-prerelease-check", args = dict( default = False, doc = "Suppress errors thrown when using pre-release classes.", @@ -51,6 +67,7 @@ _KOPTS = { }, ), "x_inline_classes": struct( + flag = "-Xinline-classes", args = dict( default = False, doc = "Enable experimental inline classes", @@ -61,6 +78,7 @@ _KOPTS = { }, ), "x_allow_result_return_type": struct( + flag = "-Xallow-result-return-type", args = dict( default = False, doc = "Enable kotlin.Result as a return type", @@ -71,6 +89,7 @@ _KOPTS = { }, ), "x_jvm_default": struct( + flag = "-Xjvm-default", args = dict( default = "off", doc = "Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.", @@ -87,6 +106,7 @@ _KOPTS = { }, ), "x_no_call_assertions": struct( + flag = "-Xno-call-assertions", args = dict( default = False, doc = "Don't generate not-null assertions for arguments of platform types", @@ -97,6 +117,7 @@ _KOPTS = { }, ), "x_no_param_assertions": struct( + flag = "-Xno-param-assertions", args = dict( default = False, doc = "Don't generate not-null assertions on parameters of methods accessible from Java", @@ -107,6 +128,7 @@ _KOPTS = { }, ), "x_no_receiver_assertions": struct( + flag = "-Xno-receiver-assertions", args = dict( default = False, doc = "Don't generate not-null assertion for extension receiver arguments of platform types", @@ -117,16 +139,18 @@ _KOPTS = { }, ), "x_no_optimized_callable_references": struct( + flag = "-Xno-optimized-callable-references", args = dict( default = False, doc = "Do not use optimized callable reference superclasses. Available from 1.4.", ), type = attr.bool, value_to_flag = { - True: ["-Xno-optimized-callable-reference"], + True: ["-Xno-optimized-callable-references"], }, ), "x_explicit_api_mode": struct( + flag = "-Xexplicit-api", args = dict( default = "off", doc = "Enable explicit API mode for Kotlin libraries.", @@ -150,6 +174,7 @@ _KOPTS = { }, ), "x_multi_platform": struct( + flag = "-Xmulti-platform", args = dict( default = False, doc = "Enable experimental language support for multi-platform projects", @@ -160,6 +185,7 @@ _KOPTS = { }, ), "x_sam_conversions": struct( + flag = "-Xsam-conversions", args = dict( default = "class", doc = "Change codegen behavior of SAM/functional interfaces", @@ -172,6 +198,7 @@ _KOPTS = { }, ), "x_lambdas": struct( + flag = "-Xlambdas", args = dict( default = "class", doc = "Change codegen behavior of lambdas", @@ -184,6 +211,7 @@ _KOPTS = { }, ), "x_emit_jvm_type_annotations": struct( + flag = "-Xemit-jvm-type-annotations", args = dict( default = False, doc = "Basic support for type annotations in JVM bytecode.", @@ -202,7 +230,21 @@ _KOPTS = { value_to_flag = None, map_value_to_flag = _map_optin_class_to_flag, ), + "x_use_fir": struct( + # 1.6 + flag = "-Xuse-fir", + args = dict( + default = False, + doc = "Compile using the experimental Kotlin Front-end IR. Available from 1.6.", + ), + type = attr.bool, + value_to_flag = { + True: ["-Xuse-fir"], + }, + ), "x_use_k2": struct( + # 1.7 + flag = "-Xuse-k2", args = dict( default = False, doc = "Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided", @@ -213,6 +255,7 @@ _KOPTS = { }, ), "x_no_optimize": struct( + flag = "-Xno-optimize", args = dict( default = False, doc = "Disable optimizations", @@ -223,6 +266,8 @@ _KOPTS = { }, ), "x_backend_threads": struct( + # 1.6.20, 1.7 + flag = "-Xbackend-threads", args = dict( default = 1, doc = "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.", @@ -232,6 +277,7 @@ _KOPTS = { map_value_to_flag = _map_backend_threads_to_flag, ), "x_report_perf": struct( + flag = "-Xreport-perf", args = dict( default = False, doc = "Report detailed performance statistics", @@ -253,6 +299,9 @@ _KOPTS = { ), } +# Filters out options that are not available in current compiler release +_KOPTS = {attr: defn for (attr, defn) in _KOPTS_ALL.items() if not hasattr(defn, "flag") or defn.flag in _KOTLIN_OPTS} + KotlincOptions = provider( fields = { name: o.args["doc"] diff --git a/kotlin/internal/opts.release.bzl b/kotlin/internal/opts.release.bzl deleted file mode 100644 index 57075a304..000000000 --- a/kotlin/internal/opts.release.bzl +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2020 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -load( - "@io_bazel_rules_kotlin_configured//kotlin:opts.bzl", - _KotlincOptions = "KotlincOptions", - _kotlinc_options_to_flags = "kotlinc_options_to_flags", - _kt_kotlinc_options = "kt_kotlinc_options", -) -load( - "@io_bazel_rules_kotlin_configured//jvm:opts.bzl", - _JavacOptions = "JavacOptions", - _javac_options_to_flags = "javac_options_to_flags", - _kt_javac_options = "kt_javac_options", -) - -JavacOptions = _JavacOptions -javac_options_to_flags = _javac_options_to_flags -kt_javac_options = _kt_javac_options - -KotlincOptions = _KotlincOptions -kotlinc_options_to_flags = _kotlinc_options_to_flags -kt_kotlinc_options = _kt_kotlinc_options diff --git a/kotlin/internal/toolchains.bzl b/kotlin/internal/toolchains.bzl index 23aa0681c..df6cf41ff 100644 --- a/kotlin/internal/toolchains.bzl +++ b/kotlin/internal/toolchains.bzl @@ -24,10 +24,6 @@ load( _KtJsInfo = "KtJsInfo", _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE", ) -load( - "//src/main/starlark/core/repositories:tools.bzl", - "absolute_target", -) """Kotlin Toolchains @@ -264,9 +260,24 @@ _kt_toolchain = rule( provides = [platform_common.ToolchainInfo], ) +_KT_DEFAULT_TOOLCHAIN = Label("//kotlin/internal:default_toolchain") + def kt_register_toolchains(): """This macro registers the kotlin toolchain.""" - native.register_toolchains(absolute_target("//kotlin/internal:default_toolchain")) + native.register_toolchains(str(_KT_DEFAULT_TOOLCHAIN)) + +# Evaluating the select in the context of bzl file to get its repository +_DEBUG_SELECT = select({ + str(Label("//kotlin/internal:builder_debug_trace")): ["trace"], + "//conditions:default": [], +}) + select({ + str(Label("//kotlin/internal:builder_debug_timings")): ["timings"], + "//conditions:default": [], +}) + +# Evaluating the labels in the context of bzl file to get its repository +_EXPERIMENTAL_USE_ABI_JARS = str(Label("//kotlin/internal:experimental_use_abi_jars")) +_NOEXPERIMENTAL_USE_ABI_JARS = str(Label("//kotlin/internal:noexperimental_use_abi_jars")) def define_kt_toolchain( name, @@ -289,18 +300,10 @@ def define_kt_toolchain( language_version = language_version, api_version = api_version, jvm_target = jvm_target, - debug = - select({ - absolute_target("//kotlin/internal:builder_debug_trace"): ["trace"], - "//conditions:default": [], - }) + - select({ - absolute_target("//kotlin/internal:builder_debug_timings"): ["timings"], - "//conditions:default": [], - }), + debug = _DEBUG_SELECT, experimental_use_abi_jars = select({ - absolute_target("//kotlin/internal:experimental_use_abi_jars"): True, - absolute_target("//kotlin/internal:noexperimental_use_abi_jars"): False, + _EXPERIMENTAL_USE_ABI_JARS: True, + _NOEXPERIMENTAL_USE_ABI_JARS: False, "//conditions:default": experimental_use_abi_jars, }), experimental_multiplex_workers = experimental_multiplex_workers, diff --git a/src/main/starlark/core/repositories/BUILD b/src/main/starlark/core/repositories/BUILD index 5b824c20e..240510bdb 100644 --- a/src/main/starlark/core/repositories/BUILD +++ b/src/main/starlark/core/repositories/BUILD @@ -19,10 +19,8 @@ release_archive( srcs = [ "BUILD.com_github_jetbrains_kotlin.bazel", "compiler.bzl", - "configured_rules.bzl", - "tools.bzl", "versions.bzl", - ], + ] + glob(["capabilities_*.bazel"]), src_map = { "initialize.release.bzl": "initialize.bzl", "BUILD.release.bazel": "BUILD.bazel", diff --git a/src/main/starlark/core/repositories/BUILD.com_github_jetbrains_kotlin.bazel b/src/main/starlark/core/repositories/BUILD.com_github_jetbrains_kotlin.bazel index 85dbde4cc..98363dfcd 100644 --- a/src/main/starlark/core/repositories/BUILD.com_github_jetbrains_kotlin.bazel +++ b/src/main/starlark/core/repositories/BUILD.com_github_jetbrains_kotlin.bazel @@ -15,6 +15,7 @@ load("@{{.KotlinRulesRepository}}//kotlin:jvm.bzl", "kt_jvm_import") load("@{{.KotlinRulesRepository}}//kotlin:js.bzl", "kt_js_import") load("@rules_java//java:defs.bzl", "java_import") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") package(default_visibility = ["//visibility:public"]) @@ -121,3 +122,8 @@ kt_jvm_import( "stdlib-js", ] ] + +bzl_library( + name = "capabilities_bzl", + srcs = ["capabilities.bzl"], +) diff --git a/src/main/starlark/core/repositories/capabilities_1.4.bzl.com_github_jetbrains_kotlin.bazel b/src/main/starlark/core/repositories/capabilities_1.4.bzl.com_github_jetbrains_kotlin.bazel new file mode 100644 index 000000000..a75ed690b --- /dev/null +++ b/src/main/starlark/core/repositories/capabilities_1.4.bzl.com_github_jetbrains_kotlin.bazel @@ -0,0 +1,125 @@ +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +KOTLIN_OPTS = [ + "-Xadd-modules", + "-Xallow-jvm-ir-dependencies", + "-Xallow-kotlin-package", + "-Xallow-no-source-files", + "-Xallow-result-return-type", + "-Xassertions", + "-Xbuild-file", + "-Xcheck-phase-conditions", + "-Xcheck-sticky-phase-conditions", + "-Xcommon-sources", + "-Xcompile-java", + "-Xcoroutines", + "-Xdeserialize-fake-overrides", + "-Xdev-mode-overwriting-strategy", + "-Xdisable-default-scripting-plugin", + "-Xdisable-fake-override-validator", + "-Xdisable-phases", + "-Xdisable-standard-script", + "-Xdump-declarations-to", + "-Xdump-directory", + "-Xdump-fqname", + "-Xdump-perf", + "-Xeffect-system", + "-Xemit-jvm-type-annotations", + "-Xenable-js-scripting", + "-Xexclude-from-dumping", + "-Xexpect-actual-linker", + "-Xexperimental", + "-Xexplicit-api", + "-Xfriend-modules", + "-Xfriend-modules-disabled", + "-Xfriend-paths", + "-Xfriend-paths", + "-Xgenerate-dts", + "-Xgenerate-strict-metadata-version", + "-Xinclude", + "-Xinline-classes", + "-Xintellij-plugin-root", + "-Xir-binary-with-stable-abi", + "-Xir-check-local-names", + "-Xir-dce", + "-Xir-dce-driven", + "-Xir-dce-print-reachability-info", + "-Xir-module-name", + "-Xir-only", + "-Xir-produce-js", + "-Xir-produce-klib-dir", + "-Xir-produce-klib-file", + "-Xjava-package-prefix", + "-Xjava-source-roots", + "-Xjavac-arguments", + "-Xjps", + "-Xjsr305", + "-Xjvm-default", + "-Xklib", + "-Xlegacy-smart-cast-after-try", + "-Xlist-phases", + "-Xmetadata-only", + "-Xmetadata-version", + "-Xmodule-path", + "-Xmulti-platform", + "-Xmultifile-parts-inherit", + "-Xnew-inference", + "-Xno-call-assertions", + "-Xno-check-actual", + "-Xno-exception-on-explicit-equals-for-boxed-null", + "-Xno-inline", + "-Xno-kotlin-nothing-value-exception", + "-Xno-optimize", + "-Xno-optimized-callable-references", + "-Xno-param-assertions", + "-Xno-receiver-assertions", + "-Xno-unified-null-checks", + "-Xno-use-ir", + "-Xnormalize-constructor-calls", + "-Xopt-in", + "-Xphases-to-dump", + "-Xphases-to-dump-after", + "-Xphases-to-dump-before", + "-Xphases-to-validate", + "-Xphases-to-validate-after", + "-Xphases-to-validate-before", + "-Xplugin", + "-Xpolymorphic-signature", + "-Xprint-reachability-info", + "-Xprofile-phases", + "-Xproper-ieee754-comparisons", + "-Xread-deserialized-contracts", + "-Xrefines-paths", + "-Xreport-output-files", + "-Xreport-perf", + "-Xsanitize-parentheses", + "-Xscript-resolver-environment", + "-Xsingle-module", + "-Xskip-metadata-version-check", + "-Xskip-prerelease-check", + "-Xskip-runtime-version-check", + "-Xstrict-java-nullability-assertions", + "-Xsupport-compatqual-checker-framework-annotations", + "-Xsuppress-missing-builtins-error", + "-Xtyped-arrays", + "-Xuse-experimental", + "-Xuse-fir", + "-Xuse-ir", + "-Xuse-javac", + "-Xuse-mixed-named-arguments", + "-Xuse-old-class-files-reading", + "-Xuse-type-table", + "-Xverbose-phases", +] diff --git a/src/main/starlark/core/repositories/capabilities_1.5.bzl.com_github_jetbrains_kotlin.bazel b/src/main/starlark/core/repositories/capabilities_1.5.bzl.com_github_jetbrains_kotlin.bazel new file mode 100644 index 000000000..d64d841c2 --- /dev/null +++ b/src/main/starlark/core/repositories/capabilities_1.5.bzl.com_github_jetbrains_kotlin.bazel @@ -0,0 +1,120 @@ +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +KOTLIN_OPTS = [ + "-Xabi-stability", + "-Xadd-modules", + "-Xallow-no-source-files", + "-Xallow-unstable-dependencies", + "-Xassertions", + "-Xbuild-file", + "-Xcompile-java", + "-Xnormalize-constructor-calls", + "-Xdump-declarations-to", + "-Xdefault-script-extension", + "-Xdisable-standard-script", + "-Xir-do-not-clear-binding-context", + "-Xemit-jvm-type-annotations", + "-Xjvm-enable-preview", + "-Xfriend-paths", + "-Xmultifile-parts-inherit", + "-Xmodule-path", + "-Xjava-package-prefix", + "-Xjava-source-roots", + "-Xjavac-arguments", + "-Xjspecify-annotations", + "-Xjsr305", + "-Xjvm-default", + "-Xklib", + "-Xlambdas", + "-Xno-call-assertions", + "-Xno-exception-on-explicit-equals-for-boxed-null", + "-Xno-kotlin-nothing-value-exception", + "-Xno-optimize", + "-Xno-optimized-callable-references", + "-Xno-param-assertions", + "-Xno-receiver-assertions", + "-Xno-reset-jar-timestamps", + "-Xno-unified-null-checks", + "-Xprofile", + "-Xrepeat", + "-Xsam-conversions", + "-Xsanitize-parentheses", + "-Xscript-resolver-environment", + "-Xsingle-module", + "-Xskip-runtime-version-check", + "-Xstrict-java-nullability-assertions", + "-Xgenerate-strict-metadata-version", + "-Xstring-concat", + "-Xsupport-compatqual-checker-framework-annotations", + "-Xsuppress-deprecated-jvm-target-warning", + "-Xsuppress-missing-builtins-error", + "-Xtype-enhancement-improvements-strict-mode", + "-Xuse-ir", + "-Xuse-javac", + "-Xuse-old-backend", + "-Xuse-old-class-files-reading", + "-Xuse-14-inline-classes-mangling-scheme", + "-Xuse-old-spilled-var-type-analysis", + "-Xuse-type-table", + "-Xallow-kotlin-package", + "-Xallow-result-return-type", + "-Xcheck-phase-conditions", + "-Xcheck-sticky-phase-conditions", + "-Xcommon-sources", + "-Xdisable-default-scripting-plugin", + "-Xdisable-phases", + "-Xdisable-ultra-light-classes", + "-Xdump-directory", + "-Xdump-fqname", + "-Xdump-perf", + "-Xeffect-system", + "-Xexpect-actual-linker", + "-Xexperimental", + "-Xexplicit-api", + "-Xextended-compiler-checks", + "-Xinference-compatibility", + "-Xinline-classes", + "-Xintellij-plugin-root", + "-Xlegacy-smart-cast-after-try", + "-Xlist-phases", + "-Xmetadata-version", + "-Xmulti-platform", + "-Xexclude-from-dumping", + "-Xnew-inference", + "-Xno-check-actual", + "-Xno-inline", + "-Xopt-in", + "-Xphases-to-dump", + "-Xphases-to-dump-after", + "-Xphases-to-dump-before", + "-Xphases-to-validate", + "-Xphases-to-validate-after", + "-Xphases-to-validate-before", + "-Xplugin", + "-Xpolymorphic-signature", + "-Xprofile-phases", + "-Xproper-ieee754-comparisons", + "-Xread-deserialized-contracts", + "-Xreport-output-files", + "-Xreport-perf", + "-Xskip-metadata-version-check", + "-Xskip-prerelease-check", + "-Xsuppress-version-warnings", + "-Xuse-experimental", + "-Xuse-fir", + "-Xuse-fir-extended-checkers", + "-Xuse-mixed-named-arguments", + "-Xverbose-phases", +] diff --git a/src/main/starlark/core/repositories/capabilities_1.6.bzl.com_github_jetbrains_kotlin.bazel b/src/main/starlark/core/repositories/capabilities_1.6.bzl.com_github_jetbrains_kotlin.bazel new file mode 100644 index 000000000..c636c6e1a --- /dev/null +++ b/src/main/starlark/core/repositories/capabilities_1.6.bzl.com_github_jetbrains_kotlin.bazel @@ -0,0 +1,214 @@ +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +KOTLIN_OPTS = [ + "-Xabi-stability", + "-Xadd-light-debug", + "-Xadd-modules", + "-Xallow-kotlin-package", + "-Xallow-no-source-files", + "-Xallow-result-return-type", + "-Xallow-unstable-dependencies", + "-Xassertions", + "-Xbackend-threads", + "-Xbinary", + "-Xbuild-file", + "-Xbuiltins-from-sources", + "-Xbundle-id", + "-Xcache-directories", + "-Xcache-directory", + "-Xcheck-phase-conditions", + "-Xcheck-state-at-external-calls", + "-Xcheck-sticky-phase-conditions", + "-Xcommon-sources", + "-Xcompile-java", + "-Xcontext-receivers", + "-Xcoverage", + "-Xcoverage-file", + "-Xdebug-info-version", + "-Xdebug-prefix-map", + "-Xdefault-script-extension", + "-Xdev-mode-overwriting-strategy", + "-Xdisable-default-scripting-plugin", + "-Xdisable-phases", + "-Xdisable-standard-script", + "-Xdisable-ultra-light-classes", + "-Xdump-declarations-to", + "-Xdump-directory", + "-Xdump-fqname", + "-Xdump-perf", + "-Xeffect-system", + "-Xemit-jvm-type-annotations", + "-Xemit-lazy-objc-header", + "-Xenable", + "-Xenable-builder-inference", + "-Xenable-extension-functions-in-externals", + "-Xenable-js-scripting", + "-Xenhance-type-parameter-types-to-def-not-null", + "-Xerror-tolerance-policy", + "-Xexclude-from-dumping", + "-Xexpect-actual-linker", + "-Xexplicit-api", + "-Xexport-kdoc", + "-Xexport-library", + "-Xextended-compiler-checks", + "-Xexternal-dependencies", + "-Xfake-override-validator", + "-Xframework-import-header", + "-Xfriend-modules", + "-Xfriend-modules-disabled", + "-Xfriend-paths", + "-Xfriend-paths", + "-Xg-generate-debug-trampoline", + "-Xg0", + "-Xgenerate-dts", + "-Xgenerate-strict-metadata-version", + "-Xinclude", + "-Xinference-compatibility", + "-Xinline-classes", + "-Xintellij-plugin-root", + "-Xir-base-class-in-metadata", + "-Xir-build-cache", + "-Xir-dce", + "-Xir-dce-driven", + "-Xir-dce-print-reachability-info", + "-Xir-dce-runtime-diagnostic", + "-Xir-do-not-clear-binding-context", + "-Xir-module-name", + "-Xir-new-ir2js", + "-Xir-only", + "-Xir-per-file", + "-Xir-per-module", + "-Xir-per-module-output-name", + "-Xir-produce-js", + "-Xir-produce-klib-dir", + "-Xir-produce-klib-file", + "-Xir-property-lazy-initialization", + "-Xir-property-lazy-initialization", + "-Xir-safe-external-boolean", + "-Xir-safe-external-boolean-diagnostic", + "-Xjava-package-prefix", + "-Xjava-source-roots", + "-Xjavac-arguments", + "-Xjps", + "-Xjspecify-annotations", + "-Xjsr305", + "-Xjvm-default", + "-Xjvm-enable-preview", + "-Xklib", + "-Xklib-normalize-absolute-path", + "-Xklib-relative-path-base", + "-Xlambdas", + "-Xlazy-ir-for-caches", + "-Xlegacy-smart-cast-after-try", + "-Xlibrary-to-cover", + "-Xlist-phases", + "-Xllvm-variant", + "-Xmeaningful-bridge-names", + "-Xmetadata-klib", + "-Xmetadata-only", + "-Xmetadata-version", + "-Xmodule-path", + "-Xmulti-platform", + "-Xmultifile-parts-inherit", + "-Xnew-inference", + "-Xno-call-assertions", + "-Xno-check-actual", + "-Xno-inline", + "-Xno-kotlin-nothing-value-exception", + "-Xno-objc-generics", + "-Xno-optimize", + "-Xno-optimized-callable-references", + "-Xno-param-assertions", + "-Xno-receiver-assertions", + "-Xno-reset-jar-timestamps", + "-Xno-unified-null-checks", + "-Xnullability-annotations", + "-Xopt-in", + "-Xoverride-konan-properties", + "-Xpartial-linkage", + "-Xphases-to-dump", + "-Xphases-to-dump-after", + "-Xphases-to-dump-before", + "-Xphases-to-validate", + "-Xphases-to-validate-after", + "-Xphases-to-validate-before", + "-Xplugin", + "-Xpre-link-caches", + "-Xprint-bitcode", + "-Xprint-descriptors", + "-Xprint-files", + "-Xprint-ir", + "-Xprint-ir-with-descriptors", + "-Xprint-locations", + "-Xprint-reachability-info", + "-Xprofile", + "-Xprofile-phases", + "-Xproper-ieee754-comparisons", + "-Xread-deserialized-contracts", + "-Xrefines-paths", + "-Xrepeat", + "-Xreport-output-files", + "-Xreport-perf", + "-Xrepositories", + "-Xruntime", + "-Xruntime-logs", + "-Xsam-conversions", + "-Xsanitize-parentheses", + "-Xsave-llvm-ir", + "-Xscript-resolver-environment", + "-Xself-upper-bound-inference", + "-Xserialize-ir", + "-Xsingle-module", + "-Xskip-metadata-version-check", + "-Xskip-prerelease-check", + "-Xstring-concat", + "-Xsupport-compatqual-checker-framework-annotations", + "-Xsuppress-deprecated-jvm-target-warning", + "-Xsuppress-missing-builtins-error", + "-Xsuppress-version-warnings", + "-Xtemporary-files-dir", + "-Xtype-enhancement-improvements-strict-mode", + "-Xtyped-arrays", + "-Xunrestricted-builder-inference", + "-Xuse-14-inline-classes-mangling-scheme", + "-Xuse-experimental", + "-Xuse-fast-jar-file-system", + "-Xuse-fir", + "-Xuse-fir-extended-checkers", + "-Xuse-ir", + "-Xuse-javac", + "-Xuse-mixed-named-arguments", + "-Xuse-old-backend", + "-Xuse-old-class-files-reading", + "-Xuse-type-table", + "-Xvalidate-bytecode", + "-Xvalidate-ir", + "-Xverbose-phases", + "-Xverify-bitcode", + "-Xverify-compiler", + "-Xverify-ir", + "-Xwasm", + "-Xwasm-debug-info", + "-Xwasm-kclass-fqn", + "-Xwasm-launcher", + "-Xworker-exception-handling", + "-Xallocator", + "-Xcheck-dependencies", + "-Xdestroy-runtime-mode", + "-Xfake-override-validator", + "-Xgc", + "-Xoverride-clang-options", + "-Xpurge-user-libs", +], diff --git a/src/main/starlark/core/repositories/capabilities_1.7.bzl.com_github_jetbrains_kotlin.bazel b/src/main/starlark/core/repositories/capabilities_1.7.bzl.com_github_jetbrains_kotlin.bazel new file mode 100644 index 000000000..8766bd4ab --- /dev/null +++ b/src/main/starlark/core/repositories/capabilities_1.7.bzl.com_github_jetbrains_kotlin.bazel @@ -0,0 +1,225 @@ +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +KOTLIN_OPTS = [ + "-Xabi-stability", + "-Xadd-light-debug", + "-Xadd-modules", + "-Xallow-any-scripts-in-source-roots", + "-Xallow-kotlin-package", + "-Xallow-no-source-files", + "-Xallow-result-return-type", + "-Xallow-unstable-dependencies", + "-Xassertions", + "-Xbackend-threads", + "-Xbinary", + "-Xbuild-file", + "-Xbuiltins-from-sources", + "-Xbundle-id", + "-Xcache-directories", + "-Xcache-directory", + "-Xcheck-phase-conditions", + "-Xcheck-state-at-external-calls", + "-Xcheck-sticky-phase-conditions", + "-Xcommon-sources", + "-Xcompile-java", + "-Xcontext-receivers", + "-Xcoverage", + "-Xcoverage-file", + "-Xdebug-info-version", + "-Xdebug-prefix-map", + "-Xdefault-script-extension", + "-Xdev-mode-overwriting-strategy", + "-Xdisable-default-scripting-plugin", + "-Xdisable-phases", + "-Xdisable-standard-script", + "-Xdisable-ultra-light-classes", + "-Xdump-declarations-to", + "-Xdump-directory", + "-Xdump-fqname", + "-Xdump-perf", + "-Xdump-tests-to", + "-Xeffect-system", + "-Xemit-jvm-type-annotations", + "-Xemit-lazy-objc-header", + "-Xenable", + "-Xenable-builder-inference", + "-Xenable-extension-functions-in-externals", + "-Xenable-incremental-compilation", + "-Xenable-js-scripting", + "-Xenhance-type-parameter-types-to-def-not-null", + "-Xerror-tolerance-policy", + "-Xexclude-from-dumping", + "-Xexpect-actual-linker", + "-Xexplicit-api", + "-Xexport-kdoc", + "-Xexport-library", + "-Xextended-compiler-checks", + "-Xexternal-dependencies", + "-Xfake-override-validator", + "-Xframework-import-header", + "-Xfriend-modules", + "-Xfriend-modules-disabled", + "-Xfriend-paths", + "-Xfriend-paths", + "-Xg-generate-debug-trampoline", + "-Xg0", + "-Xgenerate-dts", + "-Xgenerate-strict-metadata-version", + "-Xignore-const-optimization-errors", + "-Xinclude", + "-Xinference-compatibility", + "-Xinline-classes", + "-Xintellij-plugin-root", + "-Xir-base-class-in-metadata", + "-Xir-build-cache", + "-Xir-dce", + "-Xir-dce-print-reachability-info", + "-Xir-dce-runtime-diagnostic", + "-Xir-do-not-clear-binding-context", + "-Xir-generate-inline-anonymous-functions", + "-Xir-minimized-member-names", + "-Xir-module-name", + "-Xir-new-ir2js", + "-Xir-only", + "-Xir-per-file", + "-Xir-per-module", + "-Xir-per-module-output-name", + "-Xir-produce-js", + "-Xir-produce-klib-dir", + "-Xir-produce-klib-file", + "-Xir-property-lazy-initialization", + "-Xir-property-lazy-initialization", + "-Xir-safe-external-boolean", + "-Xir-safe-external-boolean-diagnostic", + "-Xjava-package-prefix", + "-Xjava-source-roots", + "-Xjavac-arguments", + "-Xjdk-release", + "-Xjps", + "-Xjspecify-annotations", + "-Xjsr305", + "-Xjvm-default", + "-Xjvm-enable-preview", + "-Xklib", + "-Xklib-enable-signature-clash-checks", + "-Xklib-normalize-absolute-path", + "-Xklib-relative-path-base", + "-Xlambdas", + "-Xlazy-ir-for-caches", + "-Xlegacy-smart-cast-after-try", + "-Xlibrary-to-cover", + "-Xlink-via-signatures", + "-Xlist-phases", + "-Xllvm-variant", + "-Xmeaningful-bridge-names", + "-Xmetadata-klib", + "-Xmetadata-only", + "-Xmetadata-version", + "-Xmodule-path", + "-Xmulti-platform", + "-Xmultifile-parts-inherit", + "-Xnew-inference", + "-Xno-call-assertions", + "-Xno-check-actual", + "-Xno-inline", + "-Xno-kotlin-nothing-value-exception", + "-Xno-objc-generics", + "-Xno-optimize", + "-Xno-optimized-callable-references", + "-Xno-param-assertions", + "-Xno-receiver-assertions", + "-Xno-reset-jar-timestamps", + "-Xno-unified-null-checks", + "-Xnullability-annotations", + "-Xoverride-konan-properties", + "-Xpartial-linkage", + "-Xpartial-linkage", + "-Xphases-to-dump", + "-Xphases-to-dump-after", + "-Xphases-to-dump-before", + "-Xphases-to-validate", + "-Xphases-to-validate-after", + "-Xphases-to-validate-before", + "-Xplugin", + "-Xpre-link-caches", + "-Xprint-bitcode", + "-Xprint-descriptors", + "-Xprint-files", + "-Xprint-ir", + "-Xprint-ir-with-descriptors", + "-Xprint-locations", + "-Xprint-reachability-info", + "-Xprofile", + "-Xprofile-phases", + "-Xproper-ieee754-comparisons", + "-Xread-deserialized-contracts", + "-Xrefines-paths", + "-Xrender-internal-diagnostic-names", + "-Xrepeat", + "-Xreport-output-files", + "-Xreport-perf", + "-Xrepositories", + "-Xruntime", + "-Xruntime-logs", + "-Xsam-conversions", + "-Xsanitize-parentheses", + "-Xsave-llvm-ir-after", + "-Xscript-resolver-environment", + "-Xself-upper-bound-inference", + "-Xserialize-ir", + "-Xsingle-module", + "-Xskip-metadata-version-check", + "-Xskip-prerelease-check", + "-Xstring-concat", + "-Xsupport-compatqual-checker-framework-annotations", + "-Xsuppress-deprecated-jvm-target-warning", + "-Xsuppress-missing-builtins-error", + "-Xsuppress-version-warnings", + "-Xtemporary-files-dir", + "-Xtype-enhancement-improvements-strict-mode", + "-Xtyped-arrays", + "-Xunrestricted-builder-inference", + "-Xuse-14-inline-classes-mangling-scheme", + "-Xuse-fast-jar-file-system", + "-Xuse-fir-extended-checkers", + "-Xuse-fir-ic", + "-Xuse-fir-lt", + "-Xuse-ir", + "-Xuse-javac", + "-Xuse-k2", + "-Xuse-mixed-named-arguments", + "-Xuse-old-backend", + "-Xuse-old-class-files-reading", + "-Xuse-type-table", + "-Xvalidate-bytecode", + "-Xvalidate-ir", + "-Xverbose-phases", + "-Xverify-bitcode", + "-Xverify-compiler", + "-Xverify-ir", + "-Xwasm", + "-Xwasm-debug-info", + "-Xwasm-enable-array-range-checks", + "-Xwasm-enable-asserts", + "-Xwasm-kclass-fqn", + "-Xworker-exception-handling", + "-Xallocator", + "-Xcheck-dependencies", + "-Xdestroy-runtime-mode", + "-Xfake-override-validator", + "-Xgc", + "-Xoverride-clang-options", + "-Xpurge-user-libs", +] diff --git a/src/main/starlark/core/repositories/capabilities_legacy.bzl.com_github_jetbrains_kotlin.bazel b/src/main/starlark/core/repositories/capabilities_legacy.bzl.com_github_jetbrains_kotlin.bazel new file mode 100644 index 000000000..1d0ad3903 --- /dev/null +++ b/src/main/starlark/core/repositories/capabilities_legacy.bzl.com_github_jetbrains_kotlin.bazel @@ -0,0 +1,68 @@ +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +KOTLIN_OPTS = [ + "-Xadd-compiler-builtins", + "-Xadd-modules", + "-Xallow-kotlin-package", + "-Xallow-result-return-type", + "-Xassertions", + "-Xbuild-file", + "-Xcommon-sources", + "-Xcompile-java", + "-Xcoroutines", + "-Xdisable-default-scripting-plugin", + "-Xdisable-standard-script", + "-Xdump-declarations-to", + "-Xdump-perf", + "-Xeffect-system", + "-Xexperimental", + "-Xfriend-modules", + "-Xfriend-modules-disabled", + "-Xfriend-paths", + "-Xgenerate-strict-metadata-version", + "-Xintellij-plugin-root", + "-Xjavac-arguments", + "-Xjps", + "-Xjsr305", + "-Xjvm-default", + "-Xlegacy-smart-cast-after-try", + "-Xload-builtins-from-dependencies", + "-Xmetadata-version", + "-Xmodule-path", + "-Xmulti-platform", + "-Xmultifile-parts-inherit", + "-Xnew-inference", + "-Xno-check-actual", + "-Xno-exception-on-explicit-equals-for-boxed-null", + "-Xno-inline", + "-Xnormalize-constructor-calls", + "-Xplugin", + "-Xprint-reachability-info", + "-Xproper-ieee754-comparisons", + "-Xread-deserialized-contracts", + "-Xreport-output-files", + "-Xscript-resolver-environment", + "-Xsingle-module", + "-Xskip-metadata-version-check", + "-Xskip-runtime-version-check", + "-Xstrict-java-nullability-assertions", + "-Xsupport-compatqual-checker-framework-annotations", + "-Xtyped-arrays", + "-Xuse-experimental", + "-Xuse-ir", + "-Xuse-javac", + "-Xuse-old-class-files-reading", + "-Xuse-type-table", +] diff --git a/src/main/starlark/core/repositories/compiler.bzl b/src/main/starlark/core/repositories/compiler.bzl index d11718118..9b7efc844 100644 --- a/src/main/starlark/core/repositories/compiler.bzl +++ b/src/main/starlark/core/repositories/compiler.bzl @@ -19,6 +19,32 @@ def _kotlin_compiler_impl(repository_ctx): executable = False, ) + repository_ctx.template( + "capabilities.bzl", + _get_capability_template(attr.compiler_version, attr._capabilities_templates), + executable = False, + ) + +def _get_capability_template(compiler_version, templates): + for ver, template in zip(_CAPABILITIES_TEMPLATES.keys(), templates): + if compiler_version.startswith(ver): + return template + + # After latest version + if compiler_version > _CAPABILITIES_TEMPLATES.keys()[-1]: + templates[-1] + + # Legacy + return templates[0] + +_CAPABILITIES_TEMPLATES = { + "legacy": ":capabilities_legacy.bzl.com_github_jetbrains_kotlin.bazel", # keep first + "1.4": ":capabilities_1.4.bzl.com_github_jetbrains_kotlin.bazel", + "1.5": ":capabilities_1.5.bzl.com_github_jetbrains_kotlin.bazel", + "1.6": ":capabilities_1.6.bzl.com_github_jetbrains_kotlin.bazel", + "1.7": ":capabilities_1.7.bzl.com_github_jetbrains_kotlin.bazel", +} + kotlin_compiler_repository = repository_rule( implementation = _kotlin_compiler_impl, attrs = { @@ -33,9 +59,16 @@ kotlin_compiler_repository = repository_rule( "sha256": attr.string( doc = "sha256 of the compiler archive", ), + "compiler_version": attr.string( + doc = "compiler version", + ), "_template": attr.label( doc = "repository build file template", default = ":BUILD.com_github_jetbrains_kotlin.bazel", ), + "_capabilities_templates": attr.label_list( + doc = "compiler capabilities file templates", + default = _CAPABILITIES_TEMPLATES.values(), + ), }, ) diff --git a/src/main/starlark/core/repositories/configured_rules.bzl b/src/main/starlark/core/repositories/configured_rules.bzl deleted file mode 100644 index 3a44540cf..000000000 --- a/src/main/starlark/core/repositories/configured_rules.bzl +++ /dev/null @@ -1,16 +0,0 @@ -def _rules_repository_impl(repository_ctx): - attr = repository_ctx.attr - repository_ctx.extract(attr.archive) - -rules_repository = repository_rule( - implementation = _rules_repository_impl, - attrs = { - "archive": attr.label( - doc = "label to repository archive", - allow_single_file = True, - ), - "parent": attr.label( - doc = "label to parent repository", - ), - }, -) diff --git a/src/main/starlark/core/repositories/download.bzl b/src/main/starlark/core/repositories/download.bzl index 2660ceadb..cc42f0054 100644 --- a/src/main/starlark/core/repositories/download.bzl +++ b/src/main/starlark/core/repositories/download.bzl @@ -86,8 +86,8 @@ def kt_download_local_dev_dependencies(): maybe( http_archive, name = "rules_pkg", - url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", + url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", + sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", ) maybe( diff --git a/src/main/starlark/core/repositories/initialize.bzl b/src/main/starlark/core/repositories/initialize.bzl index 5e42f91e6..c7091b668 100644 --- a/src/main/starlark/core/repositories/initialize.bzl +++ b/src/main/starlark/core/repositories/initialize.bzl @@ -35,5 +35,4 @@ def kotlin_repositories(compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELE kt_configure() _release_kotlin_repositories( compiler_release = compiler_release, - configured_repository_name = None, ) diff --git a/src/main/starlark/core/repositories/initialize.release.bzl b/src/main/starlark/core/repositories/initialize.release.bzl index 71b429245..7ee705f77 100644 --- a/src/main/starlark/core/repositories/initialize.release.bzl +++ b/src/main/starlark/core/repositories/initialize.release.bzl @@ -25,7 +25,6 @@ load( ) load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load(":compiler.bzl", "kotlin_compiler_repository") -load(":configured_rules.bzl", "rules_repository") load(":versions.bzl", "version", _versions = "versions") versions = _versions @@ -34,8 +33,7 @@ RULES_KOTLIN = Label("//:all") def kotlin_repositories( compiler_repository_name = _KT_COMPILER_REPO, - compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE, - configured_repository_name = "io_bazel_rules_kotlin_configured"): + compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE): """Call this in the WORKSPACE file to setup the Kotlin rules. Args: @@ -50,6 +48,7 @@ def kotlin_repositories( urls = [url.format(version = compiler_release.version) for url in compiler_release.url_templates], sha256 = compiler_release.sha256, kotlin_rules = RULES_KOTLIN.workspace_name, + compiler_version = compiler_release.version, ) http_file( @@ -99,21 +98,6 @@ def kotlin_repositories( sha256 = versions.SKYLIB_SHA, ) - selected_version = None - for (version, criteria) in versions.CORE.items(): - if (criteria and compiler_release.version.startswith(criteria.prefix)) or (not selected_version and not criteria): - selected_version = version - - if configured_repository_name: # without a repository name, no default kt_* rules repository is created. - rules_repository( - name = configured_repository_name, - archive = Label("//:%s.tgz" % selected_version), - parent = RULES_KOTLIN, - repo_mapping = { - "@dev_io_bazel_rules_kotlin": "@%s" % RULES_KOTLIN.workspace_name, - }, - ) - def kotlinc_version(release, sha256): return version( version = release, diff --git a/src/main/starlark/core/repositories/setup.bzl b/src/main/starlark/core/repositories/setup.bzl index 20bb7ca0c..baa35f14c 100644 --- a/src/main/starlark/core/repositories/setup.bzl +++ b/src/main/starlark/core/repositories/setup.bzl @@ -17,7 +17,7 @@ load("@rules_jvm_external//:defs.bzl", "maven_install") load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository") -load("//src/main/starlark/core/repositories:versions.bzl", "versions") +load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") def kt_configure(): """Setup dependencies. Must be called AFTER kt_download_local_dev_dependencies() """ @@ -54,16 +54,10 @@ def kt_configure(): rules_proto_dependencies() rules_proto_toolchains() + rules_pkg_dependencies() + stardoc_repositories() bazel_skylib_workspace() android_sdk_repository(name = "androidsdk") - - [ - native.local_repository( - name = version, - path = "src/%s" % version, - ) - for version in versions.CORE - ] diff --git a/src/main/starlark/core/repositories/tools.bzl b/src/main/starlark/core/repositories/tools.bzl deleted file mode 100644 index 7500a6db2..000000000 --- a/src/main/starlark/core/repositories/tools.bzl +++ /dev/null @@ -1,17 +0,0 @@ -"""tools for managing repositories.""" - -def absolute_target(repo_relative_target): - """Converts a relative path inside a repository to a fully qualified name. - - This uses builtin Label to translate relative paths to repository qualified targets of the defining bzl file. - - For instance, absolute_target is defined in repository "zumgali". Calling absolute_target("//gali/gali:zum") returns - "@zumgali//gali/gali:zum" - - Args: - repo_relative_target: relative target expression - Returns: - Fully qualified repository string. - """ - label = Label(repo_relative_target) - return "@%s//%s:%s" % (label.workspace_name, label.package, label.name) diff --git a/src/main/starlark/core/repositories/versions.bzl b/src/main/starlark/core/repositories/versions.bzl index 45f44dada..16a0528db 100644 --- a/src/main/starlark/core/repositories/versions.bzl +++ b/src/main/starlark/core/repositories/versions.bzl @@ -27,8 +27,8 @@ versions = struct( BAZEL_DEPS_SHA = "05498224710808be9687f5b9a906d11dd29ad592020246d4cd1a26eeaed0735e", RULES_JVM_EXTERNAL_TAG = "4.4.2", RULES_JVM_EXTERNAL_SHA = "735602f50813eb2ea93ca3f5e43b1959bd80b213b836a07a62a29d757670b77b", - RULES_PROTO_GIT_COMMIT = "f6b8d89b90a7956f6782a4a3609b2f0eee3ce965", - RULES_PROTO_SHA = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0", + RULES_PROTO_GIT_COMMIT = "fcad4680fee127dbd8344e6a961a28eef5820ef4", + RULES_PROTO_SHA = "36476f17a78a4c495b9a9e70bd92d182e6e78db476d90c74bac1f5f19f0d6d04", IO_BAZEL_STARDOC_VERSION = "0.5.1", IO_BAZEL_STARDOC_SHA = "5bcd62378fc5ea87936169b49245d0595c690bde41ef695ce319752cc9929c34", BAZEL_JAVA_LAUNCHER_VERSION = "5.0.0", @@ -54,21 +54,6 @@ versions = struct( PYTHON = struct( VERSION = "0.2.0", ), - CORE = { - "rkt_1_7": struct( - prefix = "1.7", - ), - "rkt_1_6": struct( - prefix = "1.6", - ), - "rkt_1_5": struct( - prefix = "1.5", - ), - "rkt_1_4": struct( - prefix = "1.4", - ), - "legacy": None, - }, # To update: https://github.com/bazelbuild/bazel-toolchains#latest-bazel-and-latest-ubuntu-1604-container RBE = struct( # This tarball intentionally does not have a SHA256 because the upstream URL can change without notice diff --git a/src/rkt_1_4/BUILD.bazel b/src/rkt_1_4/BUILD.bazel deleted file mode 100644 index 16a80bc46..000000000 --- a/src/rkt_1_4/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") - -release_archive( - name = "pkg", - srcs = ["WORKSPACE"], - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, - deps = [ - "//starlark/jvm:pkg", - "//starlark/kotlin:pkg", - ], -) diff --git a/src/rkt_1_4/BUILD.release.bazel b/src/rkt_1_4/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_4/WORKSPACE b/src/rkt_1_4/WORKSPACE deleted file mode 100644 index 269a87f2f..000000000 --- a/src/rkt_1_4/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -workspace(name = "rkt_1_4") diff --git a/src/rkt_1_4/starlark/BUILD.bazel b/src/rkt_1_4/starlark/BUILD.bazel deleted file mode 100644 index fa415960a..000000000 --- a/src/rkt_1_4/starlark/BUILD.bazel +++ /dev/null @@ -1,10 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -bzl_library( - name = "starlark", - visibility = ["//visibility:public"], - deps = [ - "//starlark/jvm", - "//starlark/kotlin", - ], -) diff --git a/src/rkt_1_4/starlark/jvm/BUILD.bazel b/src/rkt_1_4/starlark/jvm/BUILD.bazel deleted file mode 100644 index ca9e0bfa0..000000000 --- a/src/rkt_1_4/starlark/jvm/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "jvm", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], - deps = [ - "@dev_io_bazel_rules_kotlin//src/main/starlark", - ], -) diff --git a/src/rkt_1_4/starlark/jvm/BUILD.release.bazel b/src/rkt_1_4/starlark/jvm/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_4/starlark/jvm/opts.bzl b/src/rkt_1_4/starlark/jvm/opts.bzl deleted file mode 100644 index 7d8ee502d..000000000 --- a/src/rkt_1_4/starlark/jvm/opts.bzl +++ /dev/null @@ -1,78 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") - -_JOPTS = { - "warn": struct( - args = dict( - default = "report", - doc = "Control warning behaviour.", - values = ["off", "report", "error"], - ), - type = attr.string, - value_to_flag = { - "off": ["-nowarn"], - "error": ["-Werror"], - "report": None, - }, - ), - "x_ep_disable_all_checks": struct( - args = dict( - default = False, - doc = "See javac -XepDisableAllChecks documentation", - ), - type = attr.bool, - value_to_flag = { - True: ["-XepDisableAllChecks"], - }, - ), - "x_lint": struct( - args = dict( - default = [], - doc = "See javac -Xlint: documentation", - ), - type = attr.string_list, - value_to_flag = { - derive.info: derive.repeated_values_for("-Xlint:"), - }, - ), - "xd_suppress_notes": struct( - args = dict( - default = False, - doc = "See javac -XDsuppressNotes documentation", - ), - type = attr.bool, - value_to_flag = { - True: ["-XDsuppressNotes"], - }, - ), -} - -def _javac_options_impl(ctx): - return struct( - providers = [ - JavacOptions(**{n: getattr(ctx.attr, n, None) for n in _JOPTS}), - ], - ) - -JavacOptions = provider( - fields = { - name: o.args["doc"] - for name, o in _JOPTS.items() - }, -) - -kt_javac_options = rule( - implementation = _javac_options_impl, - doc = "Define java compiler options for `kt_jvm_*` rules with java sources.", - provides = [JavacOptions], - attrs = {n: o.type(**o.args) for n, o in _JOPTS.items()}, -) - -def javac_options_to_flags(javac_options): - """Translate JavacOptions to worker flags - - Args: - javac_options of type JavacOptions or None - Returns: - list of flags to add to the command line. - """ - return convert.javac_options_to_flags(_JOPTS, javac_options) diff --git a/src/rkt_1_4/starlark/kotlin/BUILD.bazel b/src/rkt_1_4/starlark/kotlin/BUILD.bazel deleted file mode 100644 index d3174c345..000000000 --- a/src/rkt_1_4/starlark/kotlin/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "kotlin", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], -) diff --git a/src/rkt_1_4/starlark/kotlin/BUILD.release.bazel b/src/rkt_1_4/starlark/kotlin/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_4/starlark/kotlin/opts.bzl b/src/rkt_1_4/starlark/kotlin/opts.bzl deleted file mode 100644 index 5c84668bc..000000000 --- a/src/rkt_1_4/starlark/kotlin/opts.bzl +++ /dev/null @@ -1,225 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") - -def _map_jvm_target_to_flag(version): - if not version: - return None - return ["-jvm-target=%s" % version] - -_KOPTS = { - "warn": struct( - args = dict( - default = "report", - doc = "Control warning behaviour.", - values = ["off", "report", "error"], - ), - type = attr.string, - value_to_flag = { - "off": ["-nowarn"], - "report": None, - "error": ["-Werror"], - }, - ), - "include_stdlibs": struct( - args = dict( - default = "all", - doc = "Don't automatically include the Kotlin standard libraries into the classpath (stdlib and reflect).", - values = ["all", "stdlib", "none"], - ), - type = attr.string, - value_to_flag = { - "all": None, - "stdlib": ["-no-reflect"], - "none": ["-no-stdlib"], - }, - ), - "x_use_experimental": struct( - args = dict( - default = True, - doc = "Allow the experimental language features.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xuse-experimental=kotlin.Experimental"], - }, - ), - "x_skip_prerelease_check": struct( - args = dict( - default = False, - doc = "Suppress errors thrown when using pre-release classes.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xskip-prerelease-check"], - }, - ), - "x_inline_classes": struct( - args = dict( - default = False, - doc = "Enable experimental inline classes", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xinline-classes"], - }, - ), - "x_allow_result_return_type": struct( - args = dict( - default = False, - doc = "Enable kotlin.Result as a return type", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xallow-result-return-type"], - }, - ), - "x_jvm_default": struct( - args = dict( - default = "off", - doc = "Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.", - values = ["off", "enable", "disable", "compatibility", "all-compatibility", "all"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "enable": ["-Xjvm-default=enable"], - "disable": ["-Xjvm-default=disable"], - "compatibility": ["-Xjvm-default=compatibility"], - "all-compatibility": ["-Xjvm-default=all-compatibility"], - "all": ["-Xjvm-default=all"], - }, - ), - "x_no_call_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertions for arguments of platform types", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-call-assertions"], - }, - ), - "x_no_param_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertions on parameters of methods accessible from Java", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-param-assertions"], - }, - ), - "x_no_receiver_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertion for extension receiver arguments of platform types", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-receiver-assertions"], - }, - ), - "x_no_optimized_callable_references": struct( - args = dict( - default = False, - doc = "Do not use optimized callable reference superclasses. Available from 1.4.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-optimized-callable-reference"], - }, - ), - "java_parameters": struct( - args = dict( - default = False, - doc = "Generate metadata for Java 1.8+ reflection on method parameters.", - ), - type = attr.bool, - value_to_flag = { - True: ["-java-parameters"], - }, - ), - "x_multi_platform": struct( - args = dict( - default = False, - doc = "Enable experimental language support for multi-platform projects", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xmulti-platform"], - }, - ), - "x_use_ir": struct( - args = dict( - default = False, - doc = "Enable or disable the experimental IR backend.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xuse-ir"], - }, - ), - "x_allow_jvm_ir_dependencies": struct( - args = dict( - default = False, - doc = "Suppress errors thrown when using dependencies not compiled by the IR backend.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xallow-jvm-ir-dependencies"], - }, - ), - "x_explicit_api_mode": struct( - args = dict( - default = "off", - doc = "Enable explicit API mode for Kotlin libraries.", - values = ["off", "warning", "strict"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "warning": ["-Xexplicit-api=warning"], - "strict": ["-Xexplicit-api=strict"], - }, - ), - "jvm_target": struct( - args = dict( - default = "", - doc = "The -jvm_target flag. This is only tested at 1.8.", - values = ["1.6", "1.8", "9", "10", "11", "12", "13", "15", "16", "17"], - ), - type = attr.string, - value_to_flag = None, - map_value_to_flag = _map_jvm_target_to_flag, - ), -} - -KotlincOptions = provider( - fields = { - name: o.args["doc"] - for name, o in _KOPTS.items() - }, -) - -def _kotlinc_options_impl(ctx): - return struct( - providers = [ - KotlincOptions(**{n: getattr(ctx.attr, n, None) for n in _KOPTS}), - ], - ) - -kt_kotlinc_options = rule( - implementation = _kotlinc_options_impl, - doc = "Define kotlin compiler options.", - provides = [KotlincOptions], - attrs = {n: o.type(**o.args) for n, o in _KOPTS.items()}, -) - -def kotlinc_options_to_flags(kotlinc_options): - """Translate KotlincOptions to worker flags - - Args: - kotlinc_options maybe containing KotlincOptions - Returns: - list of flags to add to the command line. - """ - return convert.kotlinc_options_to_flags(_KOPTS, kotlinc_options) diff --git a/src/rkt_1_5/BUILD.bazel b/src/rkt_1_5/BUILD.bazel deleted file mode 100644 index 16a80bc46..000000000 --- a/src/rkt_1_5/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") - -release_archive( - name = "pkg", - srcs = ["WORKSPACE"], - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, - deps = [ - "//starlark/jvm:pkg", - "//starlark/kotlin:pkg", - ], -) diff --git a/src/rkt_1_5/BUILD.release.bazel b/src/rkt_1_5/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_5/WORKSPACE b/src/rkt_1_5/WORKSPACE deleted file mode 100644 index e900be1a0..000000000 --- a/src/rkt_1_5/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -workspace(name = "rkt_1_5") diff --git a/src/rkt_1_5/starlark/BUILD.bazel b/src/rkt_1_5/starlark/BUILD.bazel deleted file mode 100644 index fa415960a..000000000 --- a/src/rkt_1_5/starlark/BUILD.bazel +++ /dev/null @@ -1,10 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -bzl_library( - name = "starlark", - visibility = ["//visibility:public"], - deps = [ - "//starlark/jvm", - "//starlark/kotlin", - ], -) diff --git a/src/rkt_1_5/starlark/jvm/BUILD.bazel b/src/rkt_1_5/starlark/jvm/BUILD.bazel deleted file mode 100644 index ca9e0bfa0..000000000 --- a/src/rkt_1_5/starlark/jvm/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "jvm", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], - deps = [ - "@dev_io_bazel_rules_kotlin//src/main/starlark", - ], -) diff --git a/src/rkt_1_5/starlark/jvm/BUILD.release.bazel b/src/rkt_1_5/starlark/jvm/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_5/starlark/kotlin/BUILD.bazel b/src/rkt_1_5/starlark/kotlin/BUILD.bazel deleted file mode 100644 index d3174c345..000000000 --- a/src/rkt_1_5/starlark/kotlin/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "kotlin", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], -) diff --git a/src/rkt_1_5/starlark/kotlin/BUILD.release.bazel b/src/rkt_1_5/starlark/kotlin/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_5/starlark/kotlin/opts.bzl b/src/rkt_1_5/starlark/kotlin/opts.bzl deleted file mode 100644 index e1aa9dab6..000000000 --- a/src/rkt_1_5/starlark/kotlin/opts.bzl +++ /dev/null @@ -1,261 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") - -def _map_optin_class_to_flag(values): - return ["-Xopt-in=%s" % v for v in values] - -def _map_jvm_target_to_flag(version): - if not version: - return None - return ["-jvm-target=%s" % version] - -_KOPTS = { - "warn": struct( - args = dict( - default = "report", - doc = "Control warning behaviour.", - values = ["off", "report", "error"], - ), - type = attr.string, - value_to_flag = { - "off": ["-nowarn"], - "report": None, - "error": ["-Werror"], - }, - ), - "include_stdlibs": struct( - args = dict( - default = "all", - doc = "Don't automatically include the Kotlin standard libraries into the classpath (stdlib and reflect).", - values = ["all", "stdlib", "none"], - ), - type = attr.string, - value_to_flag = { - "all": None, - "stdlib": ["-no-reflect"], - "none": ["-no-stdlib"], - }, - ), - "x_skip_prerelease_check": struct( - args = dict( - default = False, - doc = "Suppress errors thrown when using pre-release classes.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xskip-prerelease-check"], - }, - ), - "x_inline_classes": struct( - args = dict( - default = False, - doc = "Enable experimental inline classes", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xinline-classes"], - }, - ), - "x_allow_result_return_type": struct( - args = dict( - default = False, - doc = "Enable kotlin.Result as a return type", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xallow-result-return-type"], - }, - ), - "x_jvm_default": struct( - args = dict( - default = "off", - doc = "Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.", - values = ["off", "enable", "disable", "compatibility", "all-compatibility", "all"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "enable": ["-Xjvm-default=enable"], - "disable": ["-Xjvm-default=disable"], - "compatibility": ["-Xjvm-default=compatibility"], - "all-compatibility": ["-Xjvm-default=all-compatibility"], - "all": ["-Xjvm-default=all"], - }, - ), - "x_no_call_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertions for arguments of platform types", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-call-assertions"], - }, - ), - "x_no_param_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertions on parameters of methods accessible from Java", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-param-assertions"], - }, - ), - "x_no_receiver_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertion for extension receiver arguments of platform types", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-receiver-assertions"], - }, - ), - "x_no_optimized_callable_references": struct( - args = dict( - default = False, - doc = "Do not use optimized callable reference superclasses. Available from 1.4.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-optimized-callable-reference"], - }, - ), - "x_explicit_api_mode": struct( - args = dict( - default = "off", - doc = "Enable explicit API mode for Kotlin libraries.", - values = ["off", "warning", "strict"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "warning": ["-Xexplicit-api=warning"], - "strict": ["-Xexplicit-api=strict"], - }, - ), - "java_parameters": struct( - args = dict( - default = False, - doc = "Generate metadata for Java 1.8+ reflection on method parameters.", - ), - type = attr.bool, - value_to_flag = { - True: ["-java-parameters"], - }, - ), - "x_emit_jvm_type_annotations": struct( - args = dict( - default = False, - doc = "Basic support for type annotations in JVM bytecode.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xemit-jvm-type-annotations"], - }, - ), - "x_multi_platform": struct( - args = dict( - default = False, - doc = "Enable experimental language support for multi-platform projects", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xmulti-platform"], - }, - ), - "x_sam_conversions": struct( - args = dict( - default = "class", - doc = "Change codegen behavior of SAM/functional interfaces", - values = ["class", "indy"], - ), - type = attr.string, - value_to_flag = { - "class": ["-Xsam-conversions=class"], - "indy": ["-Xsam-conversions=indy"], - }, - ), - "x_lambdas": struct( - args = dict( - default = "class", - doc = "Change codegen behavior of lambdas", - values = ["class", "indy"], - ), - type = attr.string, - value_to_flag = { - "class": ["-Xlambdas=class"], - "indy": ["-Xlambdas=indy"], - }, - ), - "x_optin": struct( - args = dict( - default = [], - doc = "Define APIs to opt-in to.", - ), - type = attr.string_list, - value_to_flag = None, - map_value_to_flag = _map_optin_class_to_flag, - ), - "x_no_optimize": struct( - args = dict( - default = False, - doc = "Disable optimizations", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-optimize"], - }, - ), - "x_report_perf": struct( - args = dict( - default = False, - doc = "Report detailed performance statistics", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xreport-perf"], - }, - ), - "jvm_target": struct( - args = dict( - default = "", - doc = "The -jvm_target flag. This is only tested at 1.8.", - values = ["1.6", "1.8", "9", "10", "11", "12", "13", "15", "16", "17"], - ), - type = attr.string, - value_to_flag = None, - map_value_to_flag = _map_jvm_target_to_flag, - ), -} - -KotlincOptions = provider( - fields = { - name: o.args["doc"] - for name, o in _KOPTS.items() - }, -) - -def _kotlinc_options_impl(ctx): - return struct( - providers = [ - KotlincOptions(**{n: getattr(ctx.attr, n, None) for n in _KOPTS}), - ], - ) - -kt_kotlinc_options = rule( - implementation = _kotlinc_options_impl, - doc = "Define kotlin compiler options.", - provides = [KotlincOptions], - attrs = {n: o.type(**o.args) for n, o in _KOPTS.items()}, -) - -def kotlinc_options_to_flags(kotlinc_options): - """Translate KotlincOptions to worker flags - - Args: - kotlinc_options maybe containing KotlincOptions - Returns: - list of flags to add to the command line. - """ - return convert.kotlinc_options_to_flags(_KOPTS, kotlinc_options) diff --git a/src/rkt_1_6/BUILD.bazel b/src/rkt_1_6/BUILD.bazel deleted file mode 100644 index 16a80bc46..000000000 --- a/src/rkt_1_6/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") - -release_archive( - name = "pkg", - srcs = ["WORKSPACE"], - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, - deps = [ - "//starlark/jvm:pkg", - "//starlark/kotlin:pkg", - ], -) diff --git a/src/rkt_1_6/BUILD.release.bazel b/src/rkt_1_6/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_6/WORKSPACE b/src/rkt_1_6/WORKSPACE deleted file mode 100644 index 3676c8ee0..000000000 --- a/src/rkt_1_6/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -workspace(name = "rkt_1_6") diff --git a/src/rkt_1_6/starlark/BUILD.bazel b/src/rkt_1_6/starlark/BUILD.bazel deleted file mode 100644 index fa415960a..000000000 --- a/src/rkt_1_6/starlark/BUILD.bazel +++ /dev/null @@ -1,10 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -bzl_library( - name = "starlark", - visibility = ["//visibility:public"], - deps = [ - "//starlark/jvm", - "//starlark/kotlin", - ], -) diff --git a/src/rkt_1_6/starlark/jvm/BUILD.bazel b/src/rkt_1_6/starlark/jvm/BUILD.bazel deleted file mode 100644 index ca9e0bfa0..000000000 --- a/src/rkt_1_6/starlark/jvm/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "jvm", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], - deps = [ - "@dev_io_bazel_rules_kotlin//src/main/starlark", - ], -) diff --git a/src/rkt_1_6/starlark/jvm/BUILD.release.bazel b/src/rkt_1_6/starlark/jvm/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_6/starlark/jvm/opts.bzl b/src/rkt_1_6/starlark/jvm/opts.bzl deleted file mode 100644 index a019afd6f..000000000 --- a/src/rkt_1_6/starlark/jvm/opts.bzl +++ /dev/null @@ -1,92 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:derive.bzl", "derive") -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") - -_JOPTS = { - "warn": struct( - args = dict( - default = "report", - doc = "Control warning behaviour.", - values = ["off", "report", "error"], - ), - type = attr.string, - value_to_flag = { - "off": ["-nowarn"], - "error": ["-Werror"], - "report": None, - }, - ), - "x_ep_disable_all_checks": struct( - args = dict( - default = False, - doc = "See javac -XepDisableAllChecks documentation", - ), - type = attr.bool, - value_to_flag = { - True: ["-XepDisableAllChecks"], - }, - ), - "x_lint": struct( - args = dict( - default = [], - doc = "See javac -Xlint: documentation", - ), - type = attr.string_list, - value_to_flag = { - derive.info: derive.repeated_values_for("-Xlint:"), - }, - ), - "xd_suppress_notes": struct( - args = dict( - default = False, - doc = "See javac -XDsuppressNotes documentation", - ), - type = attr.bool, - value_to_flag = { - True: ["-XDsuppressNotes"], - }, - ), - "x_explicit_api_mode": struct( - args = dict( - default = "off", - doc = "Enable explicit API mode for Kotlin libraries.", - values = ["off", "warning", "strict"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "warning": ["-Xexplicit-api=warning"], - "strict": ["-Xexplicit-api=strict"], - }, - ), -} - -def _javac_options_impl(ctx): - return struct( - providers = [ - JavacOptions(**{n: getattr(ctx.attr, n, None) for n in _JOPTS}), - ], - ) - -JavacOptions = provider( - fields = { - name: o.args["doc"] - for name, o in _JOPTS.items() - }, -) - -kt_javac_options = rule( - implementation = _javac_options_impl, - doc = "Define java compiler options for `kt_jvm_*` rules with java sources.", - provides = [JavacOptions], - attrs = {n: o.type(**o.args) for n, o in _JOPTS.items()}, -) - -def javac_options_to_flags(javac_options): - """Translate JavacOptions to worker flags - - Args: - javac_options of type JavacOptions or None - Returns: - list of flags to add to the command line. - """ - return convert.javac_options_to_flags(_JOPTS, javac_options) diff --git a/src/rkt_1_6/starlark/kotlin/BUILD.bazel b/src/rkt_1_6/starlark/kotlin/BUILD.bazel deleted file mode 100644 index d3174c345..000000000 --- a/src/rkt_1_6/starlark/kotlin/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "kotlin", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], -) diff --git a/src/rkt_1_6/starlark/kotlin/BUILD.release.bazel b/src/rkt_1_6/starlark/kotlin/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_6/starlark/kotlin/opts.bzl b/src/rkt_1_6/starlark/kotlin/opts.bzl deleted file mode 100644 index 5051c49a1..000000000 --- a/src/rkt_1_6/starlark/kotlin/opts.bzl +++ /dev/null @@ -1,285 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") - -def _map_optin_class_to_flag(values): - return ["-opt-in=%s" % v for v in values] - -def _map_backend_threads_to_flag(n): - if n == 1: - return None - return ["-Xbackend-threads=%d" % n] - -def _map_jvm_target_to_flag(version): - if not version: - return None - return ["-jvm-target=%s" % version] - -_KOPTS = { - "warn": struct( - args = dict( - default = "report", - doc = "Control warning behaviour.", - values = ["off", "report", "error"], - ), - type = attr.string, - value_to_flag = { - "off": ["-nowarn"], - "report": None, - "error": ["-Werror"], - }, - ), - "include_stdlibs": struct( - args = dict( - default = "all", - doc = "Don't automatically include the Kotlin standard libraries into the classpath (stdlib and reflect).", - values = ["all", "stdlib", "none"], - ), - type = attr.string, - value_to_flag = { - "all": None, - "stdlib": ["-no-reflect"], - "none": ["-no-stdlib"], - }, - ), - "x_skip_prerelease_check": struct( - args = dict( - default = False, - doc = "Suppress errors thrown when using pre-release classes.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xskip-prerelease-check"], - }, - ), - "x_inline_classes": struct( - args = dict( - default = False, - doc = "Enable experimental inline classes", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xinline-classes"], - }, - ), - "x_allow_result_return_type": struct( - args = dict( - default = False, - doc = "Enable kotlin.Result as a return type", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xallow-result-return-type"], - }, - ), - "x_jvm_default": struct( - args = dict( - default = "off", - doc = "Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.", - values = ["off", "enable", "disable", "compatibility", "all-compatibility", "all"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "enable": ["-Xjvm-default=enable"], - "disable": ["-Xjvm-default=disable"], - "compatibility": ["-Xjvm-default=compatibility"], - "all-compatibility": ["-Xjvm-default=all-compatibility"], - "all": ["-Xjvm-default=all"], - }, - ), - "x_no_call_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertions for arguments of platform types", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-call-assertions"], - }, - ), - "x_no_param_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertions on parameters of methods accessible from Java", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-param-assertions"], - }, - ), - "x_no_receiver_assertions": struct( - args = dict( - default = False, - doc = "Don't generate not-null assertion for extension receiver arguments of platform types", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-receiver-assertions"], - }, - ), - "x_no_optimized_callable_references": struct( - args = dict( - default = False, - doc = "Do not use optimized callable reference superclasses. Available from 1.4.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-optimized-callable-reference"], - }, - ), - "x_explicit_api_mode": struct( - args = dict( - default = "off", - doc = "Enable explicit API mode for Kotlin libraries.", - values = ["off", "warning", "strict"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "warning": ["-Xexplicit-api=warning"], - "strict": ["-Xexplicit-api=strict"], - }, - ), - "java_parameters": struct( - args = dict( - default = False, - doc = "Generate metadata for Java 1.8+ reflection on method parameters.", - ), - type = attr.bool, - value_to_flag = { - True: ["-java-parameters"], - }, - ), - "x_multi_platform": struct( - args = dict( - default = False, - doc = "Enable experimental language support for multi-platform projects", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xmulti-platform"], - }, - ), - "x_emit_jvm_type_annotations": struct( - args = dict( - default = False, - doc = "Basic support for type annotations in JVM bytecode.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xemit-jvm-type-annotations"], - }, - ), - "x_sam_conversions": struct( - args = dict( - default = "class", - doc = "Change codegen behavior of SAM/functional interfaces", - values = ["class", "indy"], - ), - type = attr.string, - value_to_flag = { - "class": ["-Xsam-conversions=class"], - "indy": ["-Xsam-conversions=indy"], - }, - ), - "x_lambdas": struct( - args = dict( - default = "class", - doc = "Change codegen behavior of lambdas", - values = ["class", "indy"], - ), - type = attr.string, - value_to_flag = { - "class": ["-Xlambdas=class"], - "indy": ["-Xlambdas=indy"], - }, - ), - "x_optin": struct( - args = dict( - default = [], - doc = "Define APIs to opt-in to.", - ), - type = attr.string_list, - value_to_flag = None, - map_value_to_flag = _map_optin_class_to_flag, - ), - "x_use_fir": struct( - args = dict( - default = False, - doc = "Compile using the experimental Kotlin Front-end IR. Available from 1.6.", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xuse-fir"], - }, - ), - "x_no_optimize": struct( - args = dict( - default = False, - doc = "Disable optimizations", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xno-optimize"], - }, - ), - "x_backend_threads": struct( - args = dict( - default = 1, - doc = "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.", - ), - type = attr.int, - value_to_flag = None, - map_value_to_flag = _map_backend_threads_to_flag, - ), - "x_report_perf": struct( - args = dict( - default = False, - doc = "Report detailed performance statistics", - ), - type = attr.bool, - value_to_flag = { - True: ["-Xreport-perf"], - }, - ), - "jvm_target": struct( - args = dict( - default = "", - doc = "The -jvm_target flag. This is only tested at 1.8.", - values = ["1.6", "1.8", "9", "10", "11", "12", "13", "15", "16", "17"], - ), - type = attr.string, - value_to_flag = None, - map_value_to_flag = _map_jvm_target_to_flag, - ), -} - -KotlincOptions = provider( - fields = { - name: o.args["doc"] - for name, o in _KOPTS.items() - }, -) - -def _kotlinc_options_impl(ctx): - return struct( - providers = [ - KotlincOptions(**{n: getattr(ctx.attr, n, None) for n in _KOPTS}), - ], - ) - -kt_kotlinc_options = rule( - implementation = _kotlinc_options_impl, - doc = "Define kotlin compiler options.", - provides = [KotlincOptions], - attrs = {n: o.type(**o.args) for n, o in _KOPTS.items()}, -) - -def kotlinc_options_to_flags(kotlinc_options): - """Translate KotlincOptions to worker flags - - Args: - kotlinc_options maybe containing KotlincOptions - Returns: - list of flags to add to the command line. - """ - return convert.kotlinc_options_to_flags(_KOPTS, kotlinc_options) diff --git a/src/rkt_1_7/BUILD.bazel b/src/rkt_1_7/BUILD.bazel deleted file mode 100644 index 16a80bc46..000000000 --- a/src/rkt_1_7/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") - -release_archive( - name = "pkg", - srcs = ["WORKSPACE"], - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, - deps = [ - "//starlark/jvm:pkg", - "//starlark/kotlin:pkg", - ], -) diff --git a/src/rkt_1_7/BUILD.release.bazel b/src/rkt_1_7/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_7/WORKSPACE b/src/rkt_1_7/WORKSPACE deleted file mode 100644 index 6ad89700e..000000000 --- a/src/rkt_1_7/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -workspace(name = "rkt_1_7") diff --git a/src/rkt_1_7/starlark/BUILD.bazel b/src/rkt_1_7/starlark/BUILD.bazel deleted file mode 100644 index fa415960a..000000000 --- a/src/rkt_1_7/starlark/BUILD.bazel +++ /dev/null @@ -1,10 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -bzl_library( - name = "starlark", - visibility = ["//visibility:public"], - deps = [ - "//starlark/jvm", - "//starlark/kotlin", - ], -) diff --git a/src/rkt_1_7/starlark/jvm/BUILD.bazel b/src/rkt_1_7/starlark/jvm/BUILD.bazel deleted file mode 100644 index ca9e0bfa0..000000000 --- a/src/rkt_1_7/starlark/jvm/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "jvm", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], - deps = [ - "@dev_io_bazel_rules_kotlin//src/main/starlark", - ], -) diff --git a/src/rkt_1_7/starlark/jvm/BUILD.release.bazel b/src/rkt_1_7/starlark/jvm/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/rkt_1_7/starlark/jvm/opts.bzl b/src/rkt_1_7/starlark/jvm/opts.bzl deleted file mode 100644 index a019afd6f..000000000 --- a/src/rkt_1_7/starlark/jvm/opts.bzl +++ /dev/null @@ -1,92 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:derive.bzl", "derive") -load("@dev_io_bazel_rules_kotlin//src/main/starlark/core/options:convert.bzl", "convert") - -_JOPTS = { - "warn": struct( - args = dict( - default = "report", - doc = "Control warning behaviour.", - values = ["off", "report", "error"], - ), - type = attr.string, - value_to_flag = { - "off": ["-nowarn"], - "error": ["-Werror"], - "report": None, - }, - ), - "x_ep_disable_all_checks": struct( - args = dict( - default = False, - doc = "See javac -XepDisableAllChecks documentation", - ), - type = attr.bool, - value_to_flag = { - True: ["-XepDisableAllChecks"], - }, - ), - "x_lint": struct( - args = dict( - default = [], - doc = "See javac -Xlint: documentation", - ), - type = attr.string_list, - value_to_flag = { - derive.info: derive.repeated_values_for("-Xlint:"), - }, - ), - "xd_suppress_notes": struct( - args = dict( - default = False, - doc = "See javac -XDsuppressNotes documentation", - ), - type = attr.bool, - value_to_flag = { - True: ["-XDsuppressNotes"], - }, - ), - "x_explicit_api_mode": struct( - args = dict( - default = "off", - doc = "Enable explicit API mode for Kotlin libraries.", - values = ["off", "warning", "strict"], - ), - type = attr.string, - value_to_flag = { - "off": None, - "warning": ["-Xexplicit-api=warning"], - "strict": ["-Xexplicit-api=strict"], - }, - ), -} - -def _javac_options_impl(ctx): - return struct( - providers = [ - JavacOptions(**{n: getattr(ctx.attr, n, None) for n in _JOPTS}), - ], - ) - -JavacOptions = provider( - fields = { - name: o.args["doc"] - for name, o in _JOPTS.items() - }, -) - -kt_javac_options = rule( - implementation = _javac_options_impl, - doc = "Define java compiler options for `kt_jvm_*` rules with java sources.", - provides = [JavacOptions], - attrs = {n: o.type(**o.args) for n, o in _JOPTS.items()}, -) - -def javac_options_to_flags(javac_options): - """Translate JavacOptions to worker flags - - Args: - javac_options of type JavacOptions or None - Returns: - list of flags to add to the command line. - """ - return convert.javac_options_to_flags(_JOPTS, javac_options) diff --git a/src/rkt_1_7/starlark/kotlin/BUILD.bazel b/src/rkt_1_7/starlark/kotlin/BUILD.bazel deleted file mode 100644 index d3174c345..000000000 --- a/src/rkt_1_7/starlark/kotlin/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("@dev_io_bazel_rules_kotlin//src/main/starlark/release:packager.bzl", "release_archive") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -exports_files( - ["opts.bzl"], - visibility = ["//visibility:public"], -) - -release_archive( - name = "pkg", - srcs = glob(["*.bzl"]), - src_map = { - "BUILD.release.bazel": "BUILD.bazel", - }, -) - -bzl_library( - name = "kotlin", - srcs = glob(["*.bzl"]), - visibility = ["//visibility:public"], -) diff --git a/src/rkt_1_7/starlark/kotlin/BUILD.release.bazel b/src/rkt_1_7/starlark/kotlin/BUILD.release.bazel deleted file mode 100644 index e69de29bb..000000000