diff --git a/README.md b/README.md
index 44d49fe29..09694418f 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ For more information about release and changelogs please see [Changelog](CHANGEL
**rules_kotlin** supports the basic paradigm of `*_binary`, `*_library`, `*_test` of other Bazel
language rules. It also supports `jvm`, `android`, and `js` flavors, with the prefix `kt_jvm`
-and `kt_js`, and `kt_android` typically applied to the rules.
+and `kt_android` typically applied to the rules.
Support for kotlin's -Xfriend-paths via the `associates=` attribute in the jvm allow access to
`internal` members.
diff --git a/docs/kotlin.md b/docs/kotlin.md
index db061d90e..866ff5d94 100755
--- a/docs/kotlin.md
+++ b/docs/kotlin.md
@@ -2,48 +2,6 @@
-
-
-## kt_js_import
-
-
-kt_js_import(name, kwargs)
-
-
-
-
-**PARAMETERS**
-
-
-| Name | Description | Default Value |
-| :------------- | :------------- | :------------- |
-| name | -
| none |
-| kwargs | -
| none |
-
-
-
-
-## kt_js_library
-
-
-kt_js_library(name, kwargs)
-
-
-
-
-**PARAMETERS**
-
-
-| Name | Description | Default Value |
-| :------------- | :------------- | :------------- |
-| name | -
| none |
-| kwargs | -
| none |
-
-
-
-
-
-
## kt_javac_options
diff --git a/kotlin/BUILD b/kotlin/BUILD
index fe50b275d..9b7f751f1 100644
--- a/kotlin/BUILD
+++ b/kotlin/BUILD
@@ -46,7 +46,6 @@ release_archive(
],
)
for doc in [
- "js",
"jvm",
"lint",
"core",
@@ -57,7 +56,6 @@ release_archive(
genrule(
name = "stardoc",
srcs = [doc for doc in [
- "js",
"jvm",
"lint",
"core",
diff --git a/kotlin/compiler/compiler.bzl b/kotlin/compiler/compiler.bzl
index 2c74617cd..b07322383 100644
--- a/kotlin/compiler/compiler.bzl
+++ b/kotlin/compiler/compiler.bzl
@@ -13,7 +13,6 @@
# limitations under the License.
load("@com_github_jetbrains_kotlin//:artifacts.bzl", "KOTLINC_ARTIFACTS")
-load("//kotlin:js.bzl", "kt_js_import")
load("//kotlin:jvm.bzl", "kt_jvm_import")
load("//kotlin/internal:defs.bzl", _KT_COMPILER_REPO = "KT_COMPILER_REPO")
@@ -53,6 +52,5 @@ def kt_configure_compiler():
if native.package_name() != "kotlin/compiler":
fail("kt_configure_compiler must be called in kotlin/compiler not %s" % native.package_name())
- _import_artifacts(KOTLINC_ARTIFACTS.js, kt_js_import)
_import_artifacts(KOTLINC_ARTIFACTS.jvm, kt_jvm_import)
_import_artifacts(KOTLINC_ARTIFACTS.core, kt_jvm_import)
diff --git a/kotlin/internal/BUILD b/kotlin/internal/BUILD
index 9cfa710f2..d8d8d635e 100644
--- a/kotlin/internal/BUILD
+++ b/kotlin/internal/BUILD
@@ -28,7 +28,6 @@ release_archive(
"BUILD.release.bazel": "BUILD.bazel",
},
deps = [
- "//kotlin/internal/js:pkg",
"//kotlin/internal/jvm:pkg",
"//kotlin/internal/lint:pkg",
"//kotlin/internal/utils:pkg",
@@ -40,7 +39,6 @@ bzl_library(
srcs = glob(["*.bzl"]),
visibility = ["//kotlin:__subpackages__"],
deps = [
- "//kotlin/internal/js",
"//kotlin/internal/jvm",
"//kotlin/internal/lint",
"//kotlin/internal/utils",
diff --git a/kotlin/internal/BUILD.release.bazel b/kotlin/internal/BUILD.release.bazel
index e427d942f..423b53698 100644
--- a/kotlin/internal/BUILD.release.bazel
+++ b/kotlin/internal/BUILD.release.bazel
@@ -22,7 +22,6 @@ bzl_library(
srcs = glob(["*.bzl"]),
visibility = ["//visibility:public"],
deps = [
- "//kotlin/internal/js",
"//kotlin/internal/jvm",
"//kotlin/internal/lint",
"//kotlin/internal/utils",
diff --git a/kotlin/internal/defs.bzl b/kotlin/internal/defs.bzl
index 7981fe438..26d8e2123 100644
--- a/kotlin/internal/defs.bzl
+++ b/kotlin/internal/defs.bzl
@@ -48,15 +48,6 @@ KtJvmInfo = provider(
},
)
-KtJsInfo = provider(
- fields = {
- "js": "The primary output of the library",
- "js_map": "The map file for the library",
- "jar": "A jar of the library.",
- "srcjar": "The jar containing the sources of the library",
- },
-)
-
KtCompilerPluginInfo = _KtCompilerPluginInfo
KspPluginInfo = _KspPluginInfo
diff --git a/kotlin/internal/js/BUILD b/kotlin/internal/js/BUILD
deleted file mode 100644
index 291613a5c..000000000
--- a/kotlin/internal/js/BUILD
+++ /dev/null
@@ -1,41 +0,0 @@
-load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
-load("@rules_python//python:defs.bzl", "py_binary")
-
-# Copyright 2018 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/release:packager.bzl", "release_archive")
-
-# TODO(https://github.com/bazelbuild/rules_kotlin/issues/270): Replace with Starlark
-py_binary(
- name = "importer",
- srcs = ["importer.py"],
- visibility = ["//visibility:public"],
-)
-
-release_archive(
- name = "pkg",
- srcs = glob([
- "*.bzl",
- "*.py",
- ]),
- src_map = {
- "BUILD.release.bazel": "BUILD.bazel",
- },
-)
-
-bzl_library(
- name = "js",
- srcs = glob(["*.bzl"]),
- visibility = ["//kotlin:__subpackages__"],
-)
diff --git a/kotlin/internal/js/BUILD.release.bazel b/kotlin/internal/js/BUILD.release.bazel
deleted file mode 100644
index ff430dfc5..000000000
--- a/kotlin/internal/js/BUILD.release.bazel
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2018 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("@bazel_skylib//:bzl_library.bzl", "bzl_library")
-load("@rules_python//python:defs.bzl", "py_binary")
-
-py_binary(
- name = "importer",
- srcs = ["importer.py"],
- visibility = ["//visibility:public"],
-)
-
-bzl_library(
- name = "js",
- srcs = glob(["*.bzl"]),
- visibility = ["//visibility:public"],
-)
diff --git a/kotlin/internal/js/impl.bzl b/kotlin/internal/js/impl.bzl
deleted file mode 100644
index faf39846e..000000000
--- a/kotlin/internal/js/impl.bzl
+++ /dev/null
@@ -1,159 +0,0 @@
-# Copyright 2018 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(
- "//kotlin/internal:defs.bzl",
- _KtJsInfo = "KtJsInfo",
- _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
-)
-load(
- "//kotlin/internal:opts.bzl",
- "KotlincOptions",
- "kotlinc_options_to_flags",
-)
-load(
- "//kotlin/internal/utils:utils.bzl",
- _utils = "utils",
-)
-
-# The following kt-js flags are currently not used.
-# -Xfriend-modules=
-# -output-postfix Path to file which will be added to the end of output file
-# -output-prefix Path to file which will be added to the beginning of output file
-# -source-map-base-dirs Base directories which are used to calculate relative paths to source files in source map
-# -source-map-embed-sources { always, never, inlining }
-# Embed source files into source map
-# -source-map-prefix Prefix for paths in a source map
-# -Xtyped-arrays
-
-def kt_js_library_impl(ctx):
- toolchain = ctx.toolchains[_TOOLCHAIN_TYPE]
-
- libraries = depset([d[_KtJsInfo].jar for d in ctx.attr.deps])
-
- args = _utils.init_args(
- ctx,
- "kt_js_library",
- _utils.derive_module_name(ctx),
- )
-
- kotlinc_options = ctx.attr.kotlinc_opts[KotlincOptions] if ctx.attr.kotlinc_opts else toolchain.kotlinc_options
-
- args.add_all(
- "--kotlin_js_passthrough_flags",
- kotlinc_options_to_flags(kotlinc_options) + [
- "-source-map",
- "-Xir-produce-klib-dir",
- "-no-stdlib",
- "-module-kind",
- ctx.attr.module_kind,
- "-target",
- ctx.attr.js_target,
- ],
- )
-
- args.add("--output", ctx.outputs.js)
- args.add("--kotlin_output_js_jar", ctx.outputs.jar)
- args.add("--kotlin_output_srcjar", ctx.outputs.srcjar)
- args.add("--strict_kotlin_deps", "off")
- args.add("--reduced_classpath_mode", "NONE")
-
- args.add_all("--kotlin_js_libraries", libraries, omit_if_empty = False)
- args.add_all("--sources", ctx.files.srcs)
-
- inputs, _, input_manifests = ctx.resolve_command(tools = [toolchain.kotlinbuilder, toolchain.kotlin_home])
-
- ctx.actions.run(
- mnemonic = "KotlinCompile",
- inputs = depset(inputs + ctx.files.srcs, transitive = [libraries]),
- outputs = [
- ctx.outputs.js,
- ctx.outputs.js_map,
- ctx.outputs.jar,
- ctx.outputs.srcjar,
- ],
- executable = toolchain.kotlinbuilder.files_to_run.executable,
- execution_requirements = {"supports-workers": "1"},
- arguments = [args],
- progress_message = "Compiling Kotlin to JS %%{label} { kt: %d }" % len(ctx.files.srcs),
- input_manifests = input_manifests,
- env = {
- "REPOSITORY_NAME": _utils.builder_workspace_name(ctx),
- },
- )
-
- return [
- DefaultInfo(
- files = depset([ctx.outputs.js, ctx.outputs.js_map]),
- ),
- _KtJsInfo(
- js = ctx.outputs.js,
- js_map = ctx.outputs.js_map,
- jar = ctx.outputs.jar,
- srcjar = ctx.outputs.srcjar,
- ),
- ]
-
-# buildifier: disable=unused-variable
-def _strip_version(jarfile):
- """strip version suffix if present
- e.g. kotlinx-html-js-0.6.12.jar -> kotlinx-html-js.jar
- """
- if not jarfile.endswith(".jar"):
- fail("_strip_version expects paths ending with .jar")
- segments = jarfile[:-len(".jar")].split("-")
-
- # Remove the last segment if all digits separated by dot
- parts = segments[-1].split(".")
- if len([p for p in parts if not p.isdigit()]) == 0:
- segments = segments[0:-1]
- return "%s.jar" % "-".join(segments)
-
-def kt_js_import_impl(ctx):
- if len(ctx.files.jars) != 1:
- fail("a single jar should be supplied, multiple jars not supported")
- jar_file = ctx.files.jars[0]
-
- srcjar = ctx.files.srcjar[0] if len(ctx.files.srcjar) == 1 else None
-
- args = ctx.actions.args()
- args.add("--jar", jar_file)
- args.add("--import_pattern", "^[^/.]+\\.js$")
- args.add("--import_out", ctx.outputs.js)
- args.add("--aux_pattern", "^[^/]+\\.js\\.map$")
- args.add("--aux_out", ctx.outputs.js_map)
-
- tools, _, input_manifest = ctx.resolve_command(tools = [ctx.attr._importer])
- ctx.actions.run(
- inputs = [jar_file],
- tools = tools,
- executable = ctx.executable._importer,
- outputs = [
- ctx.outputs.js,
- ctx.outputs.js_map,
- ],
- arguments = [args],
- input_manifests = input_manifest,
- )
-
- return [
- DefaultInfo(
- files = depset([ctx.outputs.js, ctx.outputs.js_map]),
- ),
- _KtJsInfo(
- js = ctx.outputs.js,
- js_map = ctx.outputs.js_map,
- jar = jar_file,
- srcjar = srcjar,
- ),
- ]
diff --git a/kotlin/internal/js/importer.py b/kotlin/internal/js/importer.py
deleted file mode 100644
index c6d023c5e..000000000
--- a/kotlin/internal/js/importer.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright 2018 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.
-import argparse
-import os
-import re
-import shutil
-import tempfile
-import zipfile
-
-
-def _is_jar(jar):
- if not os.path.exists(jar):
- raise argparse.ArgumentTypeError("jar:{0} does not exist".format(jar))
- else:
- return zipfile.ZipFile(jar)
-
-
-def _extract_root_entry(jar, filename_pattern, output_path, touch=False):
- """
- Extracts a root entry from a jar. and write it to a path.
-
- output_path is absolute and the basename is used to extract the entry from the jar.
-
- :param jar: The jar from which to make the extraction.
- :param filename_pattern: Regular expression to match when searching for the file in the jar.
- :param output_path: An absolute file path to where the entry should be written.
- :param touch: Should the file be touched if it was not found in the jar.
- """
- target = None
- for filename in jar.namelist():
- if filename_pattern.match(filename):
- target = filename
- break
-
- if not target:
- if touch:
- f = open(output_path, 'a')
- f.close()
- return
- else:
- raise FileNotFoundError("No file matching {0} was found in jar".format(filename_pattern))
-
- # Extract the target file to a temporary location.
- temp_dir = tempfile.gettempdir()
- temp_file = os.path.join(temp_dir, os.path.basename(target))
- jar.extract(target, path=temp_dir)
-
- # Move the temp file into the final output location.
- shutil.move(temp_file, output_path)
-
-
-def _main(p):
- args = p.parse_args()
- _extract_root_entry(args.jar, args.import_pattern, args.import_out)
- for (p, e) in zip(args.aux_pattern, args.aux_out):
- _extract_root_entry(args.jar, p, e, touch=True)
-
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument("--jar", type=_is_jar, required=True)
-parser.add_argument("--import_pattern", required=True, type=re.compile,
- help="regular expression to match when searching the jar for the KotlinJS file")
-parser.add_argument("--import_out", required=True, help="path where the extracted KotlinJS import should be stored")
-parser.add_argument(
- "--aux_pattern", nargs="*", type=re.compile,
- help="""regular expressions to match when searching the jar for additional files""")
-parser.add_argument(
- "--aux_out", nargs="*",
- help="""paths where additonal files from the jar should be stored, if the files do not exist these paths are touched.""")
-
-_main(parser)
diff --git a/kotlin/internal/js/js.bzl b/kotlin/internal/js/js.bzl
deleted file mode 100644
index e7a42fa70..000000000
--- a/kotlin/internal/js/js.bzl
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright 2018 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(
- "//kotlin/internal:defs.bzl",
- _KT_COMPILER_REPO = "KT_COMPILER_REPO",
- _KtJsInfo = "KtJsInfo",
- _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
-)
-load(
- "//kotlin/internal:opts.bzl",
- _KotlincOptions = "KotlincOptions",
-)
-load(
- "//kotlin/internal/js:impl.bzl",
- _kt_js_import_impl = "kt_js_import_impl",
- _kt_js_library_impl = "kt_js_library_impl",
-)
-
-_JS_STDLIB_MAP = {
- "kotlin-stdlib-js": "kotlin",
- "kotlin-test-js": "kotlin-test",
-}
-
-# The macro, and the ones using it exist to ensure compatibility with the nodejs rules, the nodejs rules process the
-# attributes and not the providers. Ideally providers would be used so the rules can pass the information along without
-# having to have user facing attributes visible.
-# module_root: if the module_root is made settable then there is a possibility of collisions. Keeping it simple here.
-# module_name: The require statement generated by Kotlinc-js seems to be based on the name of the jar. Unlike the jvm
-# compiler, there is no 'module-name' flag available. So to keep things simple it's hard coded to the module name.
-def _lock_attrs(name, kwargs):
- if native.repository_name().startswith("@") and native.repository_name().endswith(_KT_COMPILER_REPO):
- name = _JS_STDLIB_MAP.get(name, name)
- if kwargs.get("module_root") != None:
- fail("The module_root is an internal attribute.")
- else:
- kwargs["module_root"] = name + ".js"
- if kwargs.get("module_name") != None:
- fail("module_name is an internal attribute.")
- else:
- kwargs["module_name"] = name
- return kwargs
-
-kt_js_library = rule(
- attrs = {
- "srcs": attr.label_list(
- allow_empty = False,
- allow_files = [".kt"],
- mandatory = True,
- ),
- "data": attr.label_list(
- allow_files = True,
- default = [],
- ),
- "deps": attr.label_list(
- doc = """A list of other kotlin JS libraries.""",
- default = [],
- allow_empty = True,
- providers = [_KtJsInfo],
- ),
- "runtime_deps": attr.label_list(
- doc = """A list of other kotlin JS libraries that should be available at runtime.""",
- default = [],
- allow_empty = True,
- providers = [_KtJsInfo],
- ),
- "module_kind": attr.string(
- doc = """The Kind of a module generated by compiler, users should stick to commonjs.""",
- default = "commonjs",
- values = ["umd", "commonjs", "amd", "plain"],
- ),
- "js_target": attr.string(
- default = "v5",
- values = ["v5"],
- ),
- "module_root": attr.string(
- doc = "internal attriubte",
- mandatory = False,
- ),
- "module_name": attr.string(
- doc = "internal attribute",
- mandatory = False,
- ),
- "kotlinc_opts": attr.label(
- doc = """Kotlinc options to be used when compiling this target. These opts if provided
- will be used instead of the ones provided to the toolchain.""",
- default = None,
- providers = [_KotlincOptions],
- mandatory = False,
- ),
- "_toolchain": attr.label(
- doc = """The Kotlin JS Runtime.""",
- default = Label("//kotlin/compiler:kotlin-stdlib-js"),
- cfg = "target",
- ),
- },
- implementation = _kt_js_library_impl,
- outputs = dict(
- js = "%{name}.js",
- js_map = "%{name}.js.map",
- jar = "%{name}.jar",
- srcjar = "%{name}-sources.jar",
- ),
- toolchains = [_TOOLCHAIN_TYPE],
- provides = [_KtJsInfo],
-)
-
-def kt_js_library_macro(name, **kwargs):
- kwargs = _lock_attrs(name, kwargs)
-
- # TODO this is a runtime dep, it should be picked up from the _toolchain attr or from a provider.
- kwargs["deps"] = kwargs.get("deps", []) + ["@rules_kotlin//kotlin/compiler:kotlin-stdlib-js"]
- kt_js_library(name = name, **kwargs)
-
-kt_js_import = rule(
- attrs = {
- "jars": attr.label_list(
- allow_files = [".jar"],
- mandatory = True,
- ),
- "srcjar": attr.label(
- mandatory = False,
- allow_single_file = ["-sources.jar"],
- ),
- "runtime_deps": attr.label_list(
- default = [],
- allow_files = [".jar"],
- mandatory = False,
- ),
- "module_name": attr.string(
- doc = "internal attribute",
- mandatory = False,
- ),
- "module_root": attr.string(
- doc = "internal attriubte",
- mandatory = False,
- ),
- "_importer": attr.label(
- default = Label("//kotlin/internal/js:importer"),
- allow_files = True,
- executable = True,
- cfg = "exec",
- ),
- },
- outputs = dict(
- js = "%{module_name}.js",
- js_map = "%{module_name}.js.map",
- ),
- implementation = _kt_js_import_impl,
- provides = [_KtJsInfo],
-)
-
-def kt_js_import_macro(name, **kwargs):
- kwargs = _lock_attrs(name, kwargs)
- kt_js_import(name = name, **kwargs)
diff --git a/kotlin/internal/toolchains.bzl b/kotlin/internal/toolchains.bzl
index 0f455eb41..ce93cea89 100644
--- a/kotlin/internal/toolchains.bzl
+++ b/kotlin/internal/toolchains.bzl
@@ -3,7 +3,6 @@ load("@rules_java//java:defs.bzl", "JavaInfo", "java_common")
load(
"//kotlin/internal:defs.bzl",
_KT_COMPILER_REPO = "KT_COMPILER_REPO",
- _KtJsInfo = "KtJsInfo",
_TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
)
@@ -78,7 +77,6 @@ def _kotlin_toolchain_impl(ctx):
kotlin_home = ctx.attr.kotlin_home,
jvm_stdlibs = java_common.merge(compile_time_providers + runtime_providers),
jvm_emit_jdeps = ctx.attr._jvm_emit_jdeps[BuildSettingInfo].value,
- js_stdlibs = ctx.attr.js_stdlibs,
execution_requirements = {
"supports-workers": "1",
"supports-multiplex-workers": "1" if ctx.attr.experimental_multiplex_workers else "0",
@@ -202,16 +200,6 @@ _kt_toolchain = rule(
"21",
],
),
- "js_target": attr.string(
- default = "v5",
- values = ["v5"],
- ),
- "js_stdlibs": attr.label_list(
- default = [
- Label("//kotlin/compiler:kotlin-stdlib-js"),
- ],
- providers = [_KtJsInfo],
- ),
"experimental_multiplex_workers": attr.bool(
doc = """Run workers in multiplex mode.""",
default = False,
diff --git a/kotlin/js.bzl b/kotlin/js.bzl
deleted file mode 100644
index 2e454a20e..000000000
--- a/kotlin/js.bzl
+++ /dev/null
@@ -1,8 +0,0 @@
-load(
- "//kotlin/internal/js:js.bzl",
- _kt_js_import = "kt_js_import_macro",
- _kt_js_library = "kt_js_library_macro",
-)
-
-kt_js_import = _kt_js_import
-kt_js_library = _kt_js_library
diff --git a/kotlin/kotlin.bzl b/kotlin/kotlin.bzl
index 4eb3c8d1f..cba5b1687 100644
--- a/kotlin/kotlin.bzl
+++ b/kotlin/kotlin.bzl
@@ -24,11 +24,6 @@ load(
_kt_ksp_plugin = "kt_ksp_plugin",
_kt_register_toolchains = "kt_register_toolchains",
)
-load(
- ":js.bzl",
- _kt_js_import = "kt_js_import",
- _kt_js_library = "kt_js_library",
-)
load(
":jvm.bzl",
_kt_jvm_binary = "kt_jvm_binary",
@@ -56,26 +51,6 @@ def kt_kotlinc_options(**kwargs):
def kt_javac_options(**kwargs):
fail("use load('//kotlin:core.bzl', kt_javac_options)")
-def kt_js_library(**kwargs):
- """
- Forwarding macro for kt_js_library
-
- Deprecated:
- kt_js_library should be loaded from //kotlin:js.bzl
- """
- print("kt_js_library should be loaded from //kotlin:js.bzl")
- _kt_js_library(**kwargs)
-
-def kt_js_import(**kwargs):
- """
- Forwarding macro for kt_js_import
-
- Deprecated:
- kt_js_import should be loaded from //kotlin:js.bzl
- """
- print("kt_js_import should be loaded from //kotlin:js.bzl")
- _kt_js_import(**kwargs)
-
def kt_jvm_binary(**kwargs):
"""
Forwarding macro for kt_jvm_binary
diff --git a/src/main/kotlin/io/bazel/kotlin/builder/KotlinBuilderComponent.java b/src/main/kotlin/io/bazel/kotlin/builder/KotlinBuilderComponent.java
index d9da55e95..9cda68bd8 100644
--- a/src/main/kotlin/io/bazel/kotlin/builder/KotlinBuilderComponent.java
+++ b/src/main/kotlin/io/bazel/kotlin/builder/KotlinBuilderComponent.java
@@ -20,7 +20,6 @@
import dagger.Component;
import dagger.Provides;
import io.bazel.kotlin.builder.tasks.CompileKotlin;
-import io.bazel.kotlin.builder.tasks.js.Kotlin2JsTaskExecutor;
import io.bazel.kotlin.builder.tasks.jvm.InternalCompilerPlugins;
import io.bazel.kotlin.builder.tasks.jvm.KotlinJvmTaskExecutor;
import io.bazel.kotlin.builder.toolchain.KotlinToolchain;
@@ -34,8 +33,6 @@ public interface KotlinBuilderComponent {
KotlinJvmTaskExecutor jvmTaskExecutor();
- Kotlin2JsTaskExecutor jsTaskExecutor();
-
CompileKotlin work();
@Component.Builder
diff --git a/src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt b/src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt
index d94cd4e3c..ea1c03797 100644
--- a/src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt
+++ b/src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt
@@ -16,7 +16,6 @@
*/
package io.bazel.kotlin.builder.tasks
-import io.bazel.kotlin.builder.tasks.js.Kotlin2JsTaskExecutor
import io.bazel.kotlin.builder.tasks.jvm.KotlinJvmTaskExecutor
import io.bazel.kotlin.builder.toolchain.CompilationStatusException
import io.bazel.kotlin.builder.toolchain.CompilationTaskContext
@@ -26,7 +25,6 @@ import io.bazel.kotlin.builder.utils.Flag
import io.bazel.kotlin.builder.utils.partitionJvmSources
import io.bazel.kotlin.builder.utils.resolveNewDirectories
import io.bazel.kotlin.model.CompilationTaskInfo
-import io.bazel.kotlin.model.JsCompilationTask
import io.bazel.kotlin.model.JvmCompilationTask
import io.bazel.kotlin.model.Platform
import io.bazel.kotlin.model.RuleKind
@@ -45,7 +43,6 @@ class KotlinBuilder
@Inject
internal constructor(
private val jvmTaskExecutor: KotlinJvmTaskExecutor,
- private val jsTaskExecutor: Kotlin2JsTaskExecutor,
) {
companion object {
@JvmStatic
@@ -77,9 +74,6 @@ class KotlinBuilder
GENERATED_CLASSDIR("--kotlin_generated_classdir"),
FRIEND_PATHS("--kotlin_friend_paths"),
OUTPUT_JDEPS("--kotlin_output_jdeps"),
- OUTPUT_JS_JAR("--kotlin_output_js_jar"),
- JS_PASSTHROUGH_FLAGS("--kotlin_js_passthrough_flags"),
- JS_LIBRARIES("--kotlin_js_libraries"),
DEBUG("--kotlin_debug_tags"),
TASK_ID("--kotlin_task_id"),
ABI_JAR("--abi_jar"),
@@ -105,7 +99,6 @@ class KotlinBuilder
@Suppress("WHEN_ENUM_CAN_BE_NULL_IN_JAVA")
when (compileContext.info.platform) {
Platform.JVM -> executeJvmTask(compileContext, taskContext.directory, argMap)
- Platform.JS -> executeJsTask(compileContext, taskContext.directory, argMap)
Platform.UNRECOGNIZED -> throw IllegalStateException(
"unrecognized platform: ${compileContext.info}",
)
@@ -171,40 +164,6 @@ class KotlinBuilder
this
}
- private fun executeJsTask(
- context: CompilationTaskContext,
- workingDir: Path,
- argMap: ArgMap,
- ) = buildJsTask(context.info, workingDir, argMap).let { jsTask ->
- context.whenTracing { printProto("js task input", jsTask) }
- jsTaskExecutor.execute(context, jsTask)
- }
-
- private fun buildJsTask(
- info: CompilationTaskInfo,
- workingDir: Path,
- argMap: ArgMap,
- ): JsCompilationTask =
- with(JsCompilationTask.newBuilder()) {
- this.info = info
-
- with(directoriesBuilder) {
- temp = workingDir.toString()
- }
-
- with(inputsBuilder) {
- addAllLibraries(argMap.mandatory(KotlinBuilderFlags.JS_LIBRARIES))
- addAllKotlinSources(argMap.mandatory(KotlinBuilderFlags.SOURCES))
- }
- with(outputsBuilder) {
- js = argMap.mandatorySingle(KotlinBuilderFlags.OUTPUT)
- jar = argMap.mandatorySingle(KotlinBuilderFlags.OUTPUT_JS_JAR)
- srcjar = argMap.mandatorySingle(KotlinBuilderFlags.OUTPUT_SRCJAR)
- }
- addAllPassThroughFlags(argMap.mandatory(KotlinBuilderFlags.JS_PASSTHROUGH_FLAGS))
- build()
- }
-
private fun executeJvmTask(
context: CompilationTaskContext,
workingDir: Path,
diff --git a/src/main/kotlin/io/bazel/kotlin/builder/tasks/js/Kotlin2JsTaskExecutor.kt b/src/main/kotlin/io/bazel/kotlin/builder/tasks/js/Kotlin2JsTaskExecutor.kt
deleted file mode 100644
index b9ded3357..000000000
--- a/src/main/kotlin/io/bazel/kotlin/builder/tasks/js/Kotlin2JsTaskExecutor.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-package io.bazel.kotlin.builder.tasks.js
-
-import io.bazel.kotlin.builder.toolchain.CompilationException
-import io.bazel.kotlin.builder.toolchain.CompilationTaskContext
-import io.bazel.kotlin.builder.toolchain.KotlinToolchain
-import io.bazel.kotlin.builder.utils.addAll
-import io.bazel.kotlin.builder.utils.jars.JarCreator
-import io.bazel.kotlin.builder.utils.jars.SourceJarCreator
-import io.bazel.kotlin.model.JsCompilationTask
-import java.nio.file.FileSystem
-import java.nio.file.FileSystems
-import java.nio.file.Files
-import java.nio.file.Path
-import java.util.stream.Collectors
-import javax.inject.Inject
-import javax.inject.Singleton
-import kotlin.io.path.absolute
-import kotlin.io.path.absolutePathString
-import kotlin.io.path.nameWithoutExtension
-
-@Singleton
-class Kotlin2JsTaskExecutor
- @Inject
- constructor(
- private val invoker: KotlinToolchain.K2JSCompilerInvoker,
- ) {
- private val fileSystem: FileSystem = FileSystems.getDefault()
-
- fun execute(
- context: CompilationTaskContext,
- task: JsCompilationTask,
- ) {
- val outputDirectory = task.compile(context)
- task.createJar(outputDirectory)
- task.createSourceJar()
- }
-
- private fun JsCompilationTask.compile(context: CompilationTaskContext): Path {
- val jsOut = fileSystem.getPath(outputs.js)
- val outputDirectory = jsOut.parent
- val baseName = jsOut.fileName.nameWithoutExtension
- val mapOut = outputDirectory.resolve("$baseName.js.map")
- val workingDirectory = fileSystem.getPath(directories.temp)
-
- val execRoot = fileSystem.getPath(".").absolute()
-
- val args =
- mutableListOf().apply {
- addAll(passThroughFlagsList)
- add("-Xdisable-default-scripting-plugin")
- add("-Xir-produce-js")
- add("-progressive")
- add("-Xoptimize-generated-js=false")
- addAll(
- "-libraries",
- inputs.librariesList
- .map {
- execRoot
- .resolve(
- it,
- ).absolutePathString()
- }.joinToString(":"),
- )
- addAll("-ir-output-name", baseName)
- addAll("-ir-output-dir", workingDirectory.toString())
- addAll("-Xir-module-name=${info.moduleName}")
- addAll(inputs.kotlinSourcesList.map { execRoot.resolve(it).absolutePathString() })
- }
-
- context.whenTracing { printLines("js compile args", args) }
- context.executeCompilerTask(args, invoker::compile)
- context.whenTracing {
- printLines(
- "outputs",
- Files.walk(outputDirectory).map { p -> p.toString() }.collect(Collectors.toList()),
- )
- }
- Files.copy(workingDirectory.resolve(jsOut.fileName), jsOut)
- Files.copy(workingDirectory.resolve(mapOut.fileName), mapOut)
-
- return workingDirectory
- }
-
- private fun JsCompilationTask.createSourceJar() {
- try {
- SourceJarCreator(fileSystem.getPath(outputs.srcjar), false)
- .also { creator ->
- creator.addSources(inputs.kotlinSourcesList.map { fileSystem.getPath(it) }.stream())
- }.execute()
- } catch (ex: Throwable) {
- throw CompilationException("could not create source jar", ex)
- }
- }
-
- private fun JsCompilationTask.createJar(jsDirectoryPath: Path) {
- try {
- JarCreator(fileSystem.getPath(outputs.jar)).use { creator ->
- creator.addDirectory(jsDirectoryPath)
- creator.execute()
- }
- } catch (ex: Throwable) {
- throw CompilationException("error creating js jar", ex)
- }
- }
- }
diff --git a/src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/KotlinJvmTaskExecutor.kt b/src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/KotlinJvmTaskExecutor.kt
index f8763b744..b1e07f733 100644
--- a/src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/KotlinJvmTaskExecutor.kt
+++ b/src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/KotlinJvmTaskExecutor.kt
@@ -25,7 +25,7 @@ import javax.inject.Singleton
/**
* Due to an inconsistency in the handling of -Xfriends-path, jvm uses a comma (property list
- * separator), js uses the system path separator.
+ * separator)
*/
const val X_FRIENDS_PATH_SEPARATOR = ","
diff --git a/src/main/kotlin/io/bazel/kotlin/builder/toolchain/KotlinToolchain.kt b/src/main/kotlin/io/bazel/kotlin/builder/toolchain/KotlinToolchain.kt
index 291377d16..5f0d0f1af 100644
--- a/src/main/kotlin/io/bazel/kotlin/builder/toolchain/KotlinToolchain.kt
+++ b/src/main/kotlin/io/bazel/kotlin/builder/toolchain/KotlinToolchain.kt
@@ -274,14 +274,4 @@ class KotlinToolchain private constructor(
toolchain.toolchainWithReflect(),
"io.bazel.kotlin.compiler.BazelK2JVMCompiler",
)
-
- @Singleton
- class K2JSCompilerInvoker
- @Inject
- constructor(
- toolchain: KotlinToolchain,
- ) : KotlinCliToolInvoker(
- toolchain.toolchainWithReflect(),
- "org.jetbrains.kotlin.cli.js.K2JsIrCompiler",
- )
}
diff --git a/src/main/protobuf/kotlin_model.proto b/src/main/protobuf/kotlin_model.proto
index 2a3b5146b..3fb6ca2da 100644
--- a/src/main/protobuf/kotlin_model.proto
+++ b/src/main/protobuf/kotlin_model.proto
@@ -54,7 +54,6 @@ enum RuleKind {
enum Platform {
JVM = 0;
- JS = 1;
}
// Common info about a Kotlin compilation task, this message is shared by all compilation tasks.
@@ -167,34 +166,3 @@ message JvmCompilationTask {
bool compile_kotlin = 6;
bool instrument_coverage = 7;
}
-
-message JsCompilationTask {
-
- // Directories used by the builder.
- message Directories {
- // A temp directory that the compiler may use.
- string temp = 4;
- }
-
- message Outputs {
- // The primary output
- string js = 1;
- string jar = 3;
- string srcjar = 4;
- }
-
- message Inputs {
- repeated string libraries = 1;
- // Partitioned from the builder flags, expanding the source_jars.
- repeated string kotlin_sources = 2;
- }
-
- CompilationTaskInfo info = 1;
- Outputs outputs = 3;
- Inputs inputs = 4;
-
- // flags that should be passed through straight to the kotlinc-js compiler.
- repeated string pass_through_flags = 5;
-
- Directories directories = 6;
-}
diff --git a/src/main/starlark/core/repositories/download.bzl b/src/main/starlark/core/repositories/download.bzl
index 29e8b6bd7..0a5b3f312 100644
--- a/src/main/starlark/core/repositories/download.bzl
+++ b/src/main/starlark/core/repositories/download.bzl
@@ -51,13 +51,6 @@ def kt_download_local_dev_dependencies():
urls = versions.RBE.URLS,
)
- maybe(
- http_archive,
- name = "build_bazel_rules_nodejs",
- sha256 = versions.RULES_NODEJS_SHA,
- url = "https://github.com/bazelbuild/rules_nodejs/releases/download/{0}/rules_nodejs-{0}.tar.gz".format(versions.RULES_NODEJS_VERSION),
- )
-
maybe(
http_archive,
name = "rules_jvm_external",
diff --git a/src/main/starlark/core/repositories/kotlin/artifacts.bzl b/src/main/starlark/core/repositories/kotlin/artifacts.bzl
index b541aaecb..3e6b4af52 100644
--- a/src/main/starlark/core/repositories/kotlin/artifacts.bzl
+++ b/src/main/starlark/core/repositories/kotlin/artifacts.bzl
@@ -1,17 +1,6 @@
"""A map of label to artifacts made available by the kotlinc github repo"""
KOTLINC_ARTIFACTS = struct(
- js = struct(
- plugin = {},
- runtime = {
- "kotlin-stdlib-js": "lib/kotlin-stdlib-js.jar",
- "kotlin-stdlib-js-klib": "lib/kotlin-stdlib-js.klib",
- "kotlin-stdlib-js-sources": "lib/kotlin-stdlib-js-sources.jar",
- "kotlin-test-js": "lib/kotlin-test-js.jar",
- "kotlin-test-js-sources": "lib/kotlin-test-js-sources.jar",
- },
- compile = {},
- ),
jvm = struct(
plugin = {
"allopen-compiler-plugin": "lib/allopen-compiler-plugin.jar",
@@ -57,7 +46,6 @@ KOTLINC_ARTIFACTS = struct(
"android-extensions-compiler": "lib/android-extensions-compiler.jar",
"android-extensions-runtime": "lib/android-extensions-runtime.jar",
"annotations": "lib/annotations-13_0.jar",
- "js_engines": "lib/js_engines.jar",
"kotlin-annotation-processing": "lib/kotlin-annotation-processing.jar",
"kotlin-annotation-processing-cli": "lib/kotlin-annotation-processing-cli.jar",
"kotlin-annotation-processing-compiler": "lib/kotlin-annotation-processing-compiler.jar",
@@ -83,7 +71,7 @@ KOTLINC_ARTIFACTS = struct(
KOTLINC_ARTIFACT_LIST = {
label: file
- for lang in ["js", "jvm", "core"]
+ for lang in ["jvm", "core"]
for type in ["compile", "plugin", "runtime"]
for (label, file) in getattr(getattr(KOTLINC_ARTIFACTS, lang), type).items()
}
diff --git a/src/main/starlark/core/repositories/versions.bzl b/src/main/starlark/core/repositories/versions.bzl
index d095b271f..88c8b0864 100644
--- a/src/main/starlark/core/repositories/versions.bzl
+++ b/src/main/starlark/core/repositories/versions.bzl
@@ -20,8 +20,6 @@ def _use_repository(name, version, rule, **kwargs):
maybe(rule, name = name, **http_archive_arguments)
versions = struct(
- RULES_NODEJS_VERSION = "5.5.3",
- RULES_NODEJS_SHA = "f10a3a12894fc3c9bf578ee5a5691769f6805c4be84359681a785a0c12e8d2b6",
BAZEL_TOOLCHAINS_VERSION = "4.1.0",
BAZEL_TOOLCHAINS_SHA = "179ec02f809e86abf56356d8898c8bd74069f1bd7c56044050c2cd3d79d0e024",
# IMPORTANT! rules_kotlin does not use the bazel_skylib unittest in production
diff --git a/src/test/kotlin/io/bazel/kotlin/builder/BUILD b/src/test/kotlin/io/bazel/kotlin/builder/BUILD
index 5f6505d1d..010f6a407 100644
--- a/src/test/kotlin/io/bazel/kotlin/builder/BUILD
+++ b/src/test/kotlin/io/bazel/kotlin/builder/BUILD
@@ -36,7 +36,6 @@ java_library(
"JdepsMergerTestComponent.java",
"KotlinAbstractTestBuilder.java",
"KotlinBuilderTestComponent.java",
- "KotlinJsTestBuilder.java",
"KotlinJvmTestBuilder.java",
],
data = [
diff --git a/src/test/kotlin/io/bazel/kotlin/builder/KotlinBuilderTestComponent.java b/src/test/kotlin/io/bazel/kotlin/builder/KotlinBuilderTestComponent.java
index f1425e7ea..d13570e0d 100644
--- a/src/test/kotlin/io/bazel/kotlin/builder/KotlinBuilderTestComponent.java
+++ b/src/test/kotlin/io/bazel/kotlin/builder/KotlinBuilderTestComponent.java
@@ -20,7 +20,6 @@
import dagger.BindsInstance;
import dagger.Component;
import io.bazel.kotlin.builder.tasks.KotlinBuilder;
-import io.bazel.kotlin.builder.tasks.js.Kotlin2JsTaskExecutor;
import io.bazel.kotlin.builder.tasks.jvm.KotlinJvmTaskExecutor;
import io.bazel.kotlin.builder.toolchain.KotlinToolchain;
@@ -36,8 +35,6 @@ public interface KotlinBuilderTestComponent {
KotlinJvmTaskExecutor jvmTaskExecutor();
- Kotlin2JsTaskExecutor jsTaskExecutor();
-
@Component.Builder
interface Builder {
@BindsInstance
diff --git a/src/test/kotlin/io/bazel/kotlin/builder/KotlinJsTestBuilder.java b/src/test/kotlin/io/bazel/kotlin/builder/KotlinJsTestBuilder.java
deleted file mode 100644
index 35315cef1..000000000
--- a/src/test/kotlin/io/bazel/kotlin/builder/KotlinJsTestBuilder.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2018 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.
- */
-package io.bazel.kotlin.builder;
-
-import io.bazel.kotlin.builder.toolchain.KotlinToolchain;
-import io.bazel.kotlin.model.CompilationTaskInfo;
-import io.bazel.kotlin.model.JsCompilationTask;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.util.Arrays;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.function.Consumer;
-
-public final class KotlinJsTestBuilder extends KotlinAbstractTestBuilder {
- private static final List PASSTHROUGH_FLAGS =
- Arrays.asList("-source-map", "-module-kind", "commonjs", "-target", "v5", "-Xir-produce-klib-dir");
- private static final JsCompilationTask.Builder taskBuilder = JsCompilationTask.newBuilder();
- private static final KotlinBuilderComponent component =
- DaggerKotlinBuilderComponent.builder().toolchain(withReflect(toolchainForTest())).build();
- private static final EnumSet ALL_DIRECTORY_TYPES =
- EnumSet.allOf(DirectoryType.class);
- private final TaskBuilder taskBuilderInstance = new TaskBuilder();
-
- private static KotlinToolchain withReflect(KotlinToolchain toolchain) {
- return toolchain.toolchainWithReflect(
- new File(Deps.Dep.fromLabel("@rules_kotlin//kotlin/compiler:kotlin-reflect").singleCompileJar())
- );
- }
-
- @Override
- JsCompilationTask buildTask() {
- return taskBuilder.build();
- }
-
- @Override
- void setupForNext(CompilationTaskInfo.Builder infoBuilder) {
- taskBuilder.clear().setInfo(infoBuilder);
- DirectoryType.createAll(instanceRoot(), ALL_DIRECTORY_TYPES);
- taskBuilder.addAllPassThroughFlags(PASSTHROUGH_FLAGS);
- try {
- taskBuilder.getDirectoriesBuilder().setTemp(
- Files.createDirectories(directory(DirectoryType.TEMP).resolve("working")).toString());
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- taskBuilder
- .getOutputsBuilder()
- .setJar(directory(DirectoryType.TEMP).resolve(label() + ".jar").toAbsolutePath().toString())
- .setSrcjar(directory(DirectoryType.TEMP).resolve(label() + "-sources.jar").toAbsolutePath().toString())
- .setJs(directory(DirectoryType.TEMP).resolve(label() + ".js").toAbsolutePath().toString());
- }
-
- public String runCompilationTask(Consumer setup, Consumer> outlines) {
- resetForNext();
- setup.accept(taskBuilderInstance);
- try {
- return runCompileTask(
- (taskContext, task) -> {
- component.jsTaskExecutor().execute(taskContext, task);
- String jsFile = task.getOutputs().getJs();
- assertFilesExist(
- jsFile,
- jsFile + ".map",
- task.getOutputs().getJar(),
- task.getOutputs().getSrcjar());
- return task.getOutputs().getJar();
- });
- } finally{
- outlines.accept(outLines());
- }
- }
-
- public void runCompilationTask(Consumer setup) {
- runCompilationTask(setup, l -> {});
- }
-
- public final class TaskBuilder {
- public void addSource(String filename, String... lines) {
- taskBuilder.getInputsBuilder().addKotlinSources(writeSourceFile(filename, lines).toString());
- }
-
- public void addDependency(String filename) {
- taskBuilder.getInputsBuilder().addLibraries(filename);
- }
-
- public void addArg(String flag) {
- taskBuilder.addPassThroughFlags(flag );
- }
- }
-}
diff --git a/src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel b/src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel
index be9f0cb8b..cddfd4b0a 100644
--- a/src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel
+++ b/src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel
@@ -99,14 +99,6 @@ kt_rules_test(
],
)
-kt_rules_test(
- name = "KotlinBuilderJsTest",
- srcs = ["js/KotlinBuilderJsTest.java"],
- data = [
- "//kotlin/compiler:kotlin-stdlib-js-klib",
- ],
-)
-
kt_rules_test(
name = "KotlinJvmTaskExecutorTest",
srcs = ["jvm/KotlinJvmTaskExecutorTest.kt"],
@@ -122,7 +114,6 @@ test_suite(
tests = [
":JdepsMergerTest",
":JdepsParserTest",
- ":KotlinBuilderJsTest",
":KotlinBuilderJvmAbiTest",
":KotlinBuilderJvmBasicTest",
":KotlinBuilderJvmCoverageTest",
diff --git a/src/test/kotlin/io/bazel/kotlin/builder/tasks/js/KotlinBuilderJsTest.java b/src/test/kotlin/io/bazel/kotlin/builder/tasks/js/KotlinBuilderJsTest.java
deleted file mode 100644
index 0a34a04a8..000000000
--- a/src/test/kotlin/io/bazel/kotlin/builder/tasks/js/KotlinBuilderJsTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package io.bazel.kotlin.builder.tasks.js;
-
-import io.bazel.kotlin.builder.Deps.Dep;
-import io.bazel.kotlin.builder.KotlinJsTestBuilder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import static com.google.common.truth.Truth.assertThat;
-
-@RunWith(JUnit4.class)
-public class KotlinBuilderJsTest {
- private static final KotlinJsTestBuilder builder = new KotlinJsTestBuilder();
-
- private Dep stdLib = Dep.fromLabel("//kotlin/compiler:kotlin-stdlib-js-klib");
-
- @Test
- public void testSimpleJsCompile() {
- builder.runCompilationTask(
- it -> {
- it.addDependency(stdLib.singleCompileJar());
- it.addArg("-Xreport-output-files");
- it.addArg("-Xreport-perf");
- it.addArg("-verbose");
- it.addSource(
- "AClass.kt",
- "package something",
- "class AClass{",
- " fun foo() : String {",
- " return \"bar\"",
- " }",
- "}");
- },
- lines -> {
- lines.forEach(System.out::println);
- });
- }
-
- @Test
- public void testFuncJsCompile() {
-
- builder.runCompilationTask(
- it -> {
- it.addDependency(stdLib.singleCompileJar());
- it.addArg("-Xreport-output-files");
- it.addArg("-Xreport-perf");
- it.addArg("-verbose");
- it.addSource(
- "auth/Auth.kt",
- "package express.something",
- "fun isAuthenticated(user: String): Boolean {",
- " return user != \"bob\"",
- "}");
- },
- lines -> {
- lines.forEach(System.out::println);
- });
- }
-
- @Test
- public void testJsErrorRendering() {
- builder.runFailingCompileTaskAndValidateOutput(
- () ->
- builder.runCompilationTask(
- it -> {
- it.addSource("AClass.kt", "package something", "class AClass{");
- it.addDependency(stdLib.singleCompileJar());
- }),
- lines ->
- assertThat(lines)
- .contains("sources/AClass.kt:2:14: error: missing '}"));
- }
-}