reflow the repository with buildifier
diff --git a/BUILD b/BUILD
index 54f21e0..ed426b9 100644
--- a/BUILD
+++ b/BUILD
@@ -16,10 +16,10 @@
test_suite(
name = "all_tests",
tests = [
- "//kotlin/builder/unittests",
"//kotlin/builder/integrationtests",
- "//tests/integrationtests"
- ]
+ "//kotlin/builder/unittests",
+ "//tests/integrationtests",
+ ],
)
# Local tests. Tests that shouldn't be run on the CI server.
@@ -27,6 +27,6 @@
name = "all_local_tests",
tests = [
":all_tests",
- "//tests/integrationtests:integrationtests_local"
- ]
-)
\ No newline at end of file
+ "//tests/integrationtests:integrationtests_local",
+ ],
+)
diff --git a/Makefile b/Makefile
index 5a2e962..70b0c47 100644
--- a/Makefile
+++ b/Makefile
@@ -9,9 +9,8 @@
bazel shutdown
bazel test --strategy=KotlinCompile=local //:all_tests
-reformat:
- buildifier -mode=fix -v kotlin/*.bzl
- buildifier -mode=fix -v kotlin/internal/*.bzl
+sky.reflow:
+ scripts/reflow_skylark
deps.regen:
scripts/regen_deps
diff --git a/WORKSPACE b/WORKSPACE
index 8f7d383..f77b88a 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -11,51 +11,60 @@
# 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.
-workspace(name="io_bazel_rules_kotlin")
-load("//kotlin/internal/repositories:repositories.bzl","github_archive")
+workspace(name = "io_bazel_rules_kotlin")
+
+load("//kotlin/internal/repositories:repositories.bzl", "github_archive")
github_archive(
name = "com_google_protobuf",
- repo = "google/protobuf",
commit = "106ffc04be1abf3ff3399f54ccf149815b287dd9",
+ repo = "google/protobuf",
)
github_archive(
name = "build_bazel_rules_nodejs",
- repo = "bazelbuild/rules_nodejs",
commit = "df3d2f577ec57ef5a622c809288a29545470c15d",
+ repo = "bazelbuild/rules_nodejs",
)
+
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
+
node_repositories(package_json = [])
github_archive(
name = "io_bazel_rules_sass",
+ commit = "38989d69ef3ba5847640f007fee5cc489be6ede9",
repo = "bazelbuild/rules_sass",
- commit = "38989d69ef3ba5847640f007fee5cc489be6ede9"
)
+
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
+
sass_repositories()
github_archive(
name = "bazel_skylib",
+ commit = "3fea8cb680f4a53a129f7ebace1a5a4d1e035914",
repo = "bazelbuild/bazel-skylib",
- commit = "3fea8cb680f4a53a129f7ebace1a5a4d1e035914"
)
github_archive(
name = "io_bazel_skydoc",
+ commit = "f531844d137c7accc44d841c08a2a2a366688571",
repo = "bazelbuild/skydoc",
- commit="f531844d137c7accc44d841c08a2a2a366688571"
)
+
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
+
skydoc_repositories()
http_jar(
name = "bazel_deps",
- url = "https://github.com/hsyed/bazel-deps/releases/download/v0.1.0/parseproject_deploy.jar",
sha256 = "05498224710808be9687f5b9a906d11dd29ad592020246d4cd1a26eeaed0735e",
+ url = "https://github.com/hsyed/bazel-deps/releases/download/v0.1.0/parseproject_deploy.jar",
)
load("//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
+
kotlin_repositories()
+
kt_register_toolchains()
diff --git a/examples/dagger/BUILD b/examples/dagger/BUILD
index fedb1ae..58048fd 100644
--- a/examples/dagger/BUILD
+++ b/examples/dagger/BUILD
@@ -58,7 +58,7 @@
name = "coffee_lib",
srcs = glob(["src/**"]) + [
# Adding a file ending with .srcjar is how code generation patterns are implemented.
- ":tea_lib_src"
+ ":tea_lib_src",
],
deps = [
":dagger_lib",
diff --git a/kotlin/BUILD b/kotlin/BUILD
index af730cc..b6a5992 100644
--- a/kotlin/BUILD
+++ b/kotlin/BUILD
@@ -17,7 +17,7 @@
toolchain_type(
name = "kt_toolchain_type",
- visibility = ["//visibility:public"]
+ visibility = ["//visibility:public"],
)
-kt_toolchain_ide_info(name="kt_toolchain_ide_info")
\ No newline at end of file
+kt_toolchain_ide_info(name = "kt_toolchain_ide_info")
diff --git a/kotlin/builder/BUILD b/kotlin/builder/BUILD
index 5e7417f..234c3f9 100644
--- a/kotlin/builder/BUILD
+++ b/kotlin/builder/BUILD
@@ -36,24 +36,24 @@
filegroup(
name = "data_for_tests",
+ testonly = 1,
srcs = [
":compiler_lib",
"@com_github_jetbrains_kotlin//:kotlin-annotation-processing",
"@com_github_jetbrains_kotlin//:kotlin-compiler",
"@com_github_jetbrains_kotlin//:kotlin-script-runtime",
],
- testonly = 1,
visibility = ["//visibility:private"],
)
java_library(
name = "builder_lib_for_tests",
- runtime_deps = [
- "@com_github_jetbrains_kotlin//:kotlin-reflect",
- "@com_github_jetbrains_kotlin//:kotlin-stdlib",
- ],
testonly = 1,
data = [":data_for_tests"],
+ visibility = [
+ "//kotlin/builder/integrationtests:__subpackages__",
+ "//kotlin/builder/unittests:__subpackages__",
+ ],
exports = [
"//kotlin/builder/src/io/bazel/kotlin/builder",
"//third_party/jvm/com/google/truth",
@@ -63,8 +63,8 @@
"@io_bazel_rules_kotlin_com_google_guava_guava//jar",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java//jar",
],
- visibility = [
- "//kotlin/builder/integrationtests:__subpackages__",
- "//kotlin/builder/unittests:__subpackages__"
- ]
+ runtime_deps = [
+ "@com_github_jetbrains_kotlin//:kotlin-reflect",
+ "@com_github_jetbrains_kotlin//:kotlin-stdlib",
+ ],
)
diff --git a/kotlin/builder/bootstrap.bzl b/kotlin/builder/bootstrap.bzl
index fc3ed89..663fd4e 100644
--- a/kotlin/builder/bootstrap.bzl
+++ b/kotlin/builder/bootstrap.bzl
@@ -13,7 +13,7 @@
# limitations under the License.
load("//kotlin:kotlin.bzl", _for_ide = "kt_jvm_library")
-_BOOTSTRAP_LIB_ARGS=["-jvm-target","1.8"]
+_BOOTSTRAP_LIB_ARGS = ["-jvm-target", "1.8"]
def _resolve_dep_label(d):
if d.startswith("//kotlin/builder/src/io/bazel/kotlin") and not d.endswith("_for_ide"):
@@ -22,12 +22,12 @@
# untested
return d + "_for_ide"
else:
- _ , _, target = d.rpartition("/")
+ _, _, target = d.rpartition("/")
return d + ":" + target + "_for_ide"
else:
return d
-def kt_bootstrap_library(name, srcs, deps=[], neverlink_deps=[], runtime_deps=[]):
+def kt_bootstrap_library(name, srcs, deps = [], neverlink_deps = [], runtime_deps = []):
"""
Simple compilation of a kotlin library using a non-persistent worker. The target is a JavaInfo provider.
@@ -44,9 +44,9 @@
name = dep_label,
srcs = deps + neverlink_deps,
tags = ["no-ide"],
- visibility=["//visibility:private"]
+ visibility = ["//visibility:private"],
)
- command="""
+ command = """
KOTLIN_HOME=external/com_github_jetbrains_kotlin
function join_by { local IFS="$$1"; shift; echo "$$*"; }
@@ -69,30 +69,31 @@
rm $${NAME}_temp.jar
""" % (name, dep_label, " ".join(_BOOTSTRAP_LIB_ARGS))
native.genrule(
- name = jar_label,
+ name = jar_label,
tools = [
"@com_github_jetbrains_kotlin//:home",
"@local_jdk//:jdk",
"@bazel_tools//tools/jdk:singlejar",
- dep_label
+ dep_label,
],
srcs = srcs,
outs = [name + ".jar"],
tags = ["no-ide"],
visibility = ["//visibility:private"],
- cmd = command
+ cmd = command,
)
native.java_import(
name = name,
jars = [jar_label],
tags = ["no-ide"],
- runtime_deps=deps + runtime_deps,
- visibility=["//visibility:public"]
+ runtime_deps = deps + runtime_deps,
+ visibility = ["//visibility:public"],
)
+
# hsyed todo this part of the graph should not be wired up outside of development.
_for_ide(
name = name + "_for_ide",
srcs = srcs,
deps = [_resolve_dep_label(d) for d in deps] + neverlink_deps,
- visibility = ["//kotlin/builder:__subpackages__"]
+ visibility = ["//kotlin/builder:__subpackages__"],
)
diff --git a/kotlin/builder/integrationtests/BUILD b/kotlin/builder/integrationtests/BUILD
index ff0448b..4485930 100644
--- a/kotlin/builder/integrationtests/BUILD
+++ b/kotlin/builder/integrationtests/BUILD
@@ -15,5 +15,5 @@
name = "integrationtests",
srcs = glob(["*.java"]),
test_class = "io.bazel.kotlin.builder.KotlinBuilderTestSuite",
- deps = ["//kotlin/builder:builder_lib_for_tests"]
-)
\ No newline at end of file
+ deps = ["//kotlin/builder:builder_lib_for_tests"],
+)
diff --git a/kotlin/builder/proto/BUILD b/kotlin/builder/proto/BUILD
index 4eec6f4..4ee0813 100644
--- a/kotlin/builder/proto/BUILD
+++ b/kotlin/builder/proto/BUILD
@@ -11,31 +11,33 @@
# 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(default_visibility=["//visibility:public"])
+package(default_visibility = ["//visibility:public"])
proto_library(
name = "kotlin_model_proto",
srcs = [":kotlin_model.proto"],
- visibility=["//visibility:public"]
+ visibility = ["//visibility:public"],
)
java_proto_library(
name = "kotlin_model_java_proto",
- deps = [":kotlin_model_proto"]
+ deps = [":kotlin_model_proto"],
)
-_PROTO_LIBS=["deps", "worker_protocol"]
+_PROTO_LIBS = [
+ "deps",
+ "worker_protocol",
+]
[proto_library(
- name="%s_proto" % lib,
- srcs=["%s.proto" % lib]
- ) for lib in _PROTO_LIBS]
+ name = "%s_proto" % lib,
+ srcs = ["%s.proto" % lib],
+) for lib in _PROTO_LIBS]
[java_proto_library(
- name="%s_java_proto" % lib,
- deps=["%s_proto" % lib],
- ) for lib in _PROTO_LIBS]
-
+ name = "%s_java_proto" % lib,
+ deps = ["%s_proto" % lib],
+) for lib in _PROTO_LIBS]
java_import(
name = "deps",
diff --git a/kotlin/builder/proto/jars/libkotlin_model_proto-speed.jar b/kotlin/builder/proto/jars/libkotlin_model_proto-speed.jar
index 3e72540..1038b72 100755
--- a/kotlin/builder/proto/jars/libkotlin_model_proto-speed.jar
+++ b/kotlin/builder/proto/jars/libkotlin_model_proto-speed.jar
Binary files differ
diff --git a/kotlin/builder/src/io/bazel/kotlin/builder/BUILD b/kotlin/builder/src/io/bazel/kotlin/builder/BUILD
index f270e45..ca0cfa2 100644
--- a/kotlin/builder/src/io/bazel/kotlin/builder/BUILD
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/BUILD
@@ -36,6 +36,11 @@
srcs = glob(["*.java"]),
visibility = ["//kotlin/builder:__subpackages__"],
exports = [":builder_kt"],
+ runtime_deps = [
+ "@com_github_jetbrains_kotlin//:kotlin-stdlib-jdk7",
+ "@com_github_jetbrains_kotlin//:kotlin-stdlib-jdk8",
+ "@io_bazel_rules_kotlin_com_google_code_gson_gson//jar",
+ ],
deps = [
":builder_kt",
"//kotlin/builder/proto:kotlin_model",
@@ -43,9 +48,4 @@
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java//jar",
],
- runtime_deps = [
- "@com_github_jetbrains_kotlin//:kotlin-stdlib-jdk7",
- "@com_github_jetbrains_kotlin//:kotlin-stdlib-jdk8",
- "@io_bazel_rules_kotlin_com_google_code_gson_gson//jar",
- ]
)
diff --git a/kotlin/builder/src/io/bazel/kotlin/builder/toolchain/KotlinToolException.kt b/kotlin/builder/src/io/bazel/kotlin/builder/toolchain/KotlinToolException.kt
index 50702e8..20ecd30 100644
--- a/kotlin/builder/src/io/bazel/kotlin/builder/toolchain/KotlinToolException.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/toolchain/KotlinToolException.kt
@@ -1,3 +1,18 @@
+/*
+ * 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.toolchain
sealed class KotlinToolException(
diff --git a/kotlin/builder/unittests/BUILD b/kotlin/builder/unittests/BUILD
index aeb66b8..aeaac28 100644
--- a/kotlin/builder/unittests/BUILD
+++ b/kotlin/builder/unittests/BUILD
@@ -18,9 +18,9 @@
test_class = "io.bazel.kotlin.builder.BuilderUnitTestSuite",
deps = [
"//kotlin/builder:builder_lib_for_tests",
- "//third_party/jvm/com/google/truth:truth",
+ "//third_party/jvm/com/google/truth",
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"@io_bazel_rules_kotlin//kotlin/builder/proto:deps",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java//jar",
- ]
+ ],
)
diff --git a/kotlin/internal/BUILD b/kotlin/internal/BUILD
index 6561c52..c3ade48 100644
--- a/kotlin/internal/BUILD
+++ b/kotlin/internal/BUILD
@@ -15,23 +15,23 @@
config_setting(
name = "builder_debug_timings",
- values = { "define": "kt_timings=1" }
+ values = {"define": "kt_timings=1"},
)
config_setting(
name = "builder_debug_trace",
- values = { "define": "kt_trace=1" }
+ values = {"define": "kt_trace=1"},
)
define_kt_toolchain(
name = "default_toolchain",
- debug=
+ debug =
select({
":builder_debug_trace": ["trace"],
- "//conditions:default": []
+ "//conditions:default": [],
}) +
select({
":builder_debug_timings": ["timings"],
- "//conditions:default": []
- })
-)
\ No newline at end of file
+ "//conditions:default": [],
+ }),
+)
diff --git a/kotlin/internal/common/common.bzl b/kotlin/internal/common/common.bzl
index ceee057..fa3c954 100644
--- a/kotlin/internal/common/common.bzl
+++ b/kotlin/internal/common/common.bzl
@@ -1,4 +1,4 @@
-load("//kotlin/internal:defs.bzl", _TOOLCHAIN_TYPE="TOOLCHAIN_TYPE")
+load("//kotlin/internal:defs.bzl", _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE")
def _restore_label(l):
lbl = l.workspace_root
@@ -7,17 +7,17 @@
return lbl + "//" + l.package + ":" + l.name
def _derive_module_name(ctx):
- module_name=getattr(ctx.attr, "module_name", "")
+ module_name = getattr(ctx.attr, "module_name", "")
if module_name == "":
- module_name = (ctx.label.package.lstrip("/").replace("/","_") + "-" + ctx.label.name.replace("/", "_"))
+ module_name = (ctx.label.package.lstrip("/").replace("/", "_") + "-" + ctx.label.name.replace("/", "_"))
return module_name
def _init_builder_args(ctx, rule_kind, module_name):
- toolchain=ctx.toolchains[_TOOLCHAIN_TYPE]
+ toolchain = ctx.toolchains[_TOOLCHAIN_TYPE]
args = ctx.actions.args()
args.set_param_file_format("multiline")
- args.use_param_file("--flagfile=%s", use_always=True)
+ args.use_param_file("--flagfile=%s", use_always = True)
args.add("--target_label", ctx.label)
args.add("--rule_kind", rule_kind)
@@ -46,4 +46,4 @@
declare_output_directory = _declare_output_directory,
restore_label = _restore_label,
derive_module_name = _derive_module_name,
-)
\ No newline at end of file
+)
diff --git a/kotlin/internal/jvm/BUILD b/kotlin/internal/jvm/BUILD
index 37e64eb..9c0f139 100644
--- a/kotlin/internal/jvm/BUILD
+++ b/kotlin/internal/jvm/BUILD
@@ -10,4 +10,4 @@
# 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.
\ No newline at end of file
+# limitations under the License.
diff --git a/kotlin/internal/jvm/compile.bzl b/kotlin/internal/jvm/compile.bzl
index 75ead3d..aeb319b 100644
--- a/kotlin/internal/jvm/compile.bzl
+++ b/kotlin/internal/jvm/compile.bzl
@@ -32,22 +32,23 @@
kt = depset(kt_srcs)
java = depset(java_srcs)
- return struct (
+ return struct(
kt = kt,
java = java,
all_srcs = kt + java,
- src_jars = depset(src_jars)
+ src_jars = depset(src_jars),
)
# JAR ACTIONS ##########################################################################################################
def _fold_jars_action(ctx, rule_kind, output_jar, input_jars):
- args=[
+ args = [
"--normalize",
"--compression",
"--deploy_manifest_lines",
- "Target-Label: %s" % str(ctx.label),
- "Injecting-Rule-Kind: %s" % rule_kind,
- "--output", output_jar.path
+ "Target-Label: %s" % str(ctx.label),
+ "Injecting-Rule-Kind: %s" % rule_kind,
+ "--output",
+ output_jar.path,
]
for i in input_jars:
args += ["--sources", i.path]
@@ -57,7 +58,7 @@
outputs = [output_jar],
executable = ctx.executable._singlejar,
arguments = args,
- progress_message="Merging Kotlin output jar " + output_jar.short_path
+ progress_message = "Merging Kotlin output jar " + output_jar.short_path,
)
_CONVENTIONAL_RESOURCE_PATHS = [
@@ -67,7 +68,7 @@
def _adjust_resources_path_by_strip_prefix(path, resource_strip_prefix):
if not path.startswith(resource_strip_prefix):
- fail("Resource file %s is not under the specified prefix to strip" % path)
+ fail("Resource file %s is not under the specified prefix to strip" % path)
clean_path = path[len(resource_strip_prefix):]
return resource_strip_prefix, clean_path
@@ -76,14 +77,14 @@
for cp in _CONVENTIONAL_RESOURCE_PATHS:
dir_1, dir_2, rel_path = path.partition(cp)
if rel_path:
- return dir_1 + dir_2, rel_path
+ return dir_1 + dir_2, rel_path
return "", path
def _adjust_resources_path(path, resource_strip_prefix):
if resource_strip_prefix:
- return _adjust_resources_path_by_strip_prefix(path,resource_strip_prefix)
+ return _adjust_resources_path_by_strip_prefix(path, resource_strip_prefix)
else:
- return _adjust_resources_path_by_default_prefixes(path)
+ return _adjust_resources_path_by_default_prefixes(path)
def _add_resources_cmd(ctx):
res_cmd = []
@@ -93,9 +94,10 @@
if target_path[0] == "/":
target_path = target_path[1:]
line = "{target_path}={c_dir}{res_path}\n".format(
- res_path=res_path,
- target_path=target_path,
- c_dir=c_dir)
+ res_path = res_path,
+ target_path = target_path,
+ c_dir = c_dir,
+ )
res_cmd.extend([line])
return "".join(res_cmd)
@@ -108,17 +110,17 @@
rm -f {resources_jar_output}
{zipper} c {resources_jar_output} @{path}
""".format(
- path=zipper_arg_path.path,
- resources_jar_output=resources_jar_output.path,
- zipper=ctx.executable._zipper.path,
+ path = zipper_arg_path.path,
+ resources_jar_output = resources_jar_output.path,
+ zipper = ctx.executable._zipper.path,
)
ctx.action(
- mnemonic="KotlinZipResourceJar",
- inputs=ctx.files.resources + [ctx.executable._zipper,zipper_arg_path],
- outputs=[resources_jar_output],
- command=cmd,
- progress_message="Creating intermediate resource jar %s" % ctx.label,
- arguments=[]
+ mnemonic = "KotlinZipResourceJar",
+ inputs = ctx.files.resources + [ctx.executable._zipper, zipper_arg_path],
+ outputs = [resources_jar_output],
+ command = cmd,
+ progress_message = "Creating intermediate resource jar %s" % ctx.label,
+ arguments = [],
)
return resources_jar_output
@@ -136,30 +138,30 @@
friend_paths: A list of jars paths that this compilation unit should have package private access to.
srcs: a struct with the various input sources partitioned.
"""
- toolchain=ctx.toolchains[TOOLCHAIN_TYPE]
+ toolchain = ctx.toolchains[TOOLCHAIN_TYPE]
- friends=getattr(ctx.attr, "friends", [])
+ friends = getattr(ctx.attr, "friends", [])
deps = [d[JavaInfo] for d in friends + ctx.attr.deps] + [toolchain.jvm_stdlibs]
compile_jars = java_common.merge(deps).compile_jars
if len(friends) == 0:
- module_name=common.derive_module_name(ctx)
- friend_paths=depset()
+ module_name = common.derive_module_name(ctx)
+ friend_paths = depset()
elif len(friends) == 1:
if friends[0][KtJvmInfo] == None:
fail("only kotlin dependencies can be friends")
elif ctx.attr.module_name:
fail("if friends has been set then module_name cannot be provided")
else:
- friend_paths=depset([j.path for j in friends[0][JavaInfo].compile_jars])
+ friend_paths = depset([j.path for j in friends[0][JavaInfo].compile_jars])
module_name = friends[0][KtJvmInfo].module_name
else:
fail("only one friend is possible")
- classes_directory=common.declare_output_directory(ctx, "jvm", "classes")
- generated_classes_directory=common.declare_output_directory(ctx, "jvm", "generated_classes")
- sourcegen_directory=common.declare_output_directory(ctx, "jvm", "sourcegenfiles")
- temp_directory=common.declare_output_directory(ctx, "jvm", "temp")
+ classes_directory = common.declare_output_directory(ctx, "jvm", "classes")
+ generated_classes_directory = common.declare_output_directory(ctx, "jvm", "generated_classes")
+ sourcegen_directory = common.declare_output_directory(ctx, "jvm", "sourcegenfiles")
+ temp_directory = common.declare_output_directory(ctx, "jvm", "temp")
args = common.init_args(ctx, rule_kind, module_name)
@@ -175,11 +177,11 @@
args.add("--kotlin_friend_paths", "\n".join(friend_paths.to_list()))
args.add("--classpath", compile_jars)
- args.add_all("--sources", srcs.all_srcs, omit_if_empty=True)
- args.add_all("--source_jars", srcs.src_jars, omit_if_empty=True)
+ args.add_all("--sources", srcs.all_srcs, omit_if_empty = True)
+ args.add_all("--source_jars", srcs.src_jars, omit_if_empty = True)
# Collect and prepare plugin descriptor for the worker.
- plugin_info=plugins.merge_plugin_infos(ctx.attr.plugins + ctx.attr.deps)
+ plugin_info = plugins.merge_plugin_infos(ctx.attr.plugins + ctx.attr.deps)
if len(plugin_info.annotation_processors) > 0:
args.add("--kotlin_plugins", plugin_info.to_json())
@@ -187,7 +189,7 @@
ctx.label,
len(srcs.kt),
len(srcs.java),
- len(srcs.src_jars)
+ len(srcs.src_jars),
)
inputs, _, input_manifests = ctx.resolve_command(tools = [toolchain.kotlinbuilder])
@@ -201,44 +203,44 @@
sourcegen_directory,
classes_directory,
temp_directory,
- generated_classes_directory
+ generated_classes_directory,
],
executable = toolchain.kotlinbuilder.files_to_run.executable,
execution_requirements = {"supports-workers": "1"},
arguments = [args],
progress_message = progress_message,
- input_manifests = input_manifests
+ input_manifests = input_manifests,
)
# create the java provider and the kotlin provider. Whilst a struct is being returned, and this is a valid way of
# creating a provider, it is intended that the client transforms this into an form.
return struct(
- java=JavaInfo(
+ java = JavaInfo(
output_jar = ctx.outputs.jar,
compile_jar = ctx.outputs.jar,
source_jar = ctx.outputs.srcjar,
- # jdeps = ctx.outputs.jdeps,
+ # jdeps = ctx.outputs.jdeps,
deps = deps,
runtime_deps = [d[JavaInfo] for d in ctx.attr.runtime_deps],
exports = [d[JavaInfo] for d in getattr(ctx.attr, "exports", [])],
- neverlink = getattr(ctx.attr, "neverlink", False)
+ neverlink = getattr(ctx.attr, "neverlink", False),
),
- kt=KtJvmInfo(
- srcs=ctx.files.srcs,
+ kt = KtJvmInfo(
+ srcs = ctx.files.srcs,
module_name = module_name,
# intelij aspect needs this.
outputs = struct(
jdeps = ctx.outputs.jdeps,
jars = [struct(
- class_jar = ctx.outputs.jar,
- ijar = None,
- source_jars = [ctx.outputs.srcjar]
- )]
+ class_jar = ctx.outputs.jar,
+ ijar = None,
+ source_jars = [ctx.outputs.srcjar],
+ )],
),
- )
+ ),
)
-def kt_jvm_produce_jar_actions(ctx, rule_kind, src_jars=[]):
+def kt_jvm_produce_jar_actions(ctx, rule_kind, src_jars = []):
"""Setup a kotlin compile action. This method takes care of all of the aspects of producing a jar.
Specifically this action will conditionally set up actions to fold resources and resourcejars and merge them onto a
@@ -250,13 +252,15 @@
Returns:
A JavaInfo struct for the output jar that this macro will build.
"""
+
# The main output jars
output_jar = ctx.outputs.jar
# The output of the compile step may be combined (folded) with other entities -- e.g., other class files from annotation processing, embedded resources.
- kt_compile_output_jar=output_jar
+ kt_compile_output_jar = output_jar
+
# the list of jars to merge into the final output, start with the resource jars if any were provided.
- output_merge_list=ctx.files.resource_jars
+ output_merge_list = ctx.files.resource_jars
# If this rule has any resources declared setup a zipper action to turn them into a jar and then add the declared zipper output to the merge list.
if len(ctx.files.resources) > 0:
@@ -265,9 +269,10 @@
# If this compile operation requires merging other jars setup the compile operation to go to a intermediate file and add that file to the merge list.
if len(output_merge_list) > 0:
# Intermediate jar containing the Kotlin compile output.
- kt_compile_output_jar=ctx.new_file(ctx.label.name + "-ktclass.jar")
+ kt_compile_output_jar = ctx.new_file(ctx.label.name + "-ktclass.jar")
+
# If we setup indirection than the first entry in the merge list is the result of the kotlin compile action.
- output_merge_list=[ kt_compile_output_jar ] + output_merge_list
+ output_merge_list = [kt_compile_output_jar] + output_merge_list
srcs = _partition_srcs(ctx.files.srcs)
@@ -283,6 +288,5 @@
ctx,
rule_kind = rule_kind,
output_jar = kt_compile_output_jar,
- srcs = srcs
+ srcs = srcs,
)
-
diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl
index bbc2133..2e79bf7 100644
--- a/kotlin/internal/jvm/impl.bzl
+++ b/kotlin/internal/jvm/impl.bzl
@@ -11,26 +11,26 @@
# 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/jvm:compile.bzl", _kt_jvm_produce_jar_actions="kt_jvm_produce_jar_actions")
-load("//kotlin/internal:defs.bzl", _KtJvmInfo="KtJvmInfo")
+load("//kotlin/internal/jvm:compile.bzl", _kt_jvm_produce_jar_actions = "kt_jvm_produce_jar_actions")
+load("//kotlin/internal:defs.bzl", _KtJvmInfo = "KtJvmInfo")
-def _make_providers(ctx, providers, transitive_files=depset(order="default")):
+def _make_providers(ctx, providers, transitive_files = depset(order = "default")):
return struct(
- kt=providers.kt,
- providers=[
+ kt = providers.kt,
+ providers = [
providers.java,
providers.kt,
DefaultInfo(
- files=depset([ctx.outputs.jar]),
- runfiles=ctx.runfiles(
- transitive_files=transitive_files,
- collect_default=True
+ files = depset([ctx.outputs.jar]),
+ runfiles = ctx.runfiles(
+ transitive_files = transitive_files,
+ collect_default = True,
),
- )
+ ),
],
)
-def _write_launcher_action(ctx, rjars, main_class, jvm_flags, args="", wrapper_preamble=""):
+def _write_launcher_action(ctx, rjars, main_class, jvm_flags, args = "", wrapper_preamble = ""):
"""Macro that writes out a launcher script shell script.
Args:
rjars: All of the runtime jars required to launch this java target.
@@ -72,10 +72,10 @@
for jar in ctx.attr.jars:
if JavaInfo in jar:
- jars += jar[JavaInfo].full_compile_jars
- source_jars += jar[JavaInfo].transitive_source_jars
- transitive_compile_time_jars += jar[JavaInfo].transitive_compile_time_jars
- transitive_runtime_jars += jar[JavaInfo].transitive_runtime_jars
+ jars += jar[JavaInfo].full_compile_jars
+ source_jars += jar[JavaInfo].transitive_source_jars
+ transitive_compile_time_jars += jar[JavaInfo].transitive_compile_time_jars
+ transitive_runtime_jars += jar[JavaInfo].transitive_runtime_jars
else:
for file in jar.files:
if file.basename.endswith("-sources.jar"):
@@ -91,11 +91,11 @@
java_info = java_common.create_provider(
use_ijar = False,
- source_jars=source_jars,
+ source_jars = source_jars,
compile_time_jars = jars,
- runtime_jars= runtime_jars,
- transitive_compile_time_jars=transitive_compile_time_jars,
- transitive_runtime_jars=transitive_runtime_jars
+ runtime_jars = runtime_jars,
+ transitive_compile_time_jars = transitive_compile_time_jars,
+ transitive_runtime_jars = transitive_runtime_jars,
)
# This is needed for intellij plugin, try to pair up jars with their sources so that the sources are mounted
@@ -107,18 +107,18 @@
artifacts = []
for jar in jars.to_list():
if jar.basename in source_tally:
- artifacts += [struct(class_jar=jar, source_jar=source_tally[jar.basename], ijar = None)]
+ artifacts += [struct(class_jar = jar, source_jar = source_tally[jar.basename], ijar = None)]
else:
- artifacts += [struct(class_jar=jar, ijar = None)]
+ artifacts += [struct(class_jar = jar, ijar = None)]
- kotlin_info=_KtJvmInfo(outputs=struct(jars=artifacts))
- default_info = DefaultInfo(files=depset(jars))
- return struct(kt = kotlin_info, providers= [default_info, java_info, kotlin_info])
+ kotlin_info = _KtJvmInfo(outputs = struct(jars = artifacts))
+ default_info = DefaultInfo(files = depset(jars))
+ return struct(kt = kotlin_info, providers = [default_info, java_info, kotlin_info])
def kt_jvm_library_impl(ctx):
return _make_providers(
ctx,
- _kt_jvm_produce_jar_actions(ctx, "kt_jvm_library")
+ _kt_jvm_produce_jar_actions(ctx, "kt_jvm_library"),
)
def kt_jvm_binary_impl(ctx):
@@ -127,33 +127,33 @@
ctx,
providers.java.transitive_runtime_jars,
ctx.attr.main_class,
- ctx.attr.jvm_flags
+ ctx.attr.jvm_flags,
)
return _make_providers(
ctx,
providers,
depset(
order = "default",
- transitive=[providers.java.transitive_runtime_jars],
- direct=[ctx.executable._java]
+ transitive = [providers.java.transitive_runtime_jars],
+ direct = [ctx.executable._java],
),
)
def kt_jvm_junit_test_impl(ctx):
providers = _kt_jvm_produce_jar_actions(ctx, "kt_jvm_test")
- runtime_jars=providers.java.transitive_runtime_jars + ctx.files._bazel_test_runner
+ runtime_jars = providers.java.transitive_runtime_jars + ctx.files._bazel_test_runner
_write_launcher_action(
ctx,
runtime_jars,
main_class = ctx.attr.main_class,
- jvm_flags = ["-ea", "-Dbazel.test_suite=%s"% ctx.attr.test_class] + ctx.attr.jvm_flags,
+ jvm_flags = ["-ea", "-Dbazel.test_suite=%s" % ctx.attr.test_class] + ctx.attr.jvm_flags,
)
return _make_providers(
ctx,
providers,
depset(
order = "default",
- transitive=[runtime_jars],
- direct=[ctx.executable._java]
+ transitive = [runtime_jars],
+ direct = [ctx.executable._java],
),
- )
\ No newline at end of file
+ )
diff --git a/kotlin/internal/jvm/jvm.bzl b/kotlin/internal/jvm/jvm.bzl
index 960ecb7..55f8b9e 100644
--- a/kotlin/internal/jvm/jvm.bzl
+++ b/kotlin/internal/jvm/jvm.bzl
@@ -94,20 +94,22 @@
########################################################################################################################
# Common Definitions
########################################################################################################################
-load("//kotlin/internal:defs.bzl", _KtJvmInfo="KtJvmInfo", _TOOLCHAIN_TYPE="TOOLCHAIN_TYPE")
+load("//kotlin/internal:defs.bzl", _KtJvmInfo = "KtJvmInfo", _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE")
+
# struct can't be used till skydoc is removed
load(
"//kotlin/internal/jvm:plugins.bzl",
- _kt_jvm_plugin_aspect="kt_jvm_plugin_aspect",
-)
-# struct can't be used till skydoc is removed
-load("//kotlin/internal/jvm:impl.bzl",
- _kt_jvm_binary_impl="kt_jvm_binary_impl",
- _kt_jvm_import_impl="kt_jvm_import_impl",
- _kt_jvm_junit_test_impl="kt_jvm_junit_test_impl",
- _kt_jvm_library_impl="kt_jvm_library_impl",
+ _kt_jvm_plugin_aspect = "kt_jvm_plugin_aspect",
)
+# struct can't be used till skydoc is removed
+load(
+ "//kotlin/internal/jvm:impl.bzl",
+ _kt_jvm_binary_impl = "kt_jvm_binary_impl",
+ _kt_jvm_import_impl = "kt_jvm_import_impl",
+ _kt_jvm_junit_test_impl = "kt_jvm_junit_test_impl",
+ _kt_jvm_library_impl = "kt_jvm_library_impl",
+)
########################################################################################################################
# Rule Attributes
@@ -117,7 +119,7 @@
default = [
Label("@io_bazel_rules_kotlin//kotlin:kt_toolchain_ide_info"),
],
- cfg="host",
+ cfg = "host",
allow_files = False,
),
"_singlejar": attr.label(
@@ -151,11 +153,12 @@
),
"deps": attr.label_list(
aspects = [_kt_jvm_plugin_aspect],
- providers=[
+ providers = [
[JavaInfo],
],
- allow_files = False),
- "runtime_deps": attr.label_list(default = [], allow_files=False),
+ allow_files = False,
+ ),
+ "runtime_deps": attr.label_list(default = [], allow_files = False),
"resources": attr.label_list(
default = [],
allow_files = True,
@@ -171,7 +174,7 @@
aspects = [_kt_jvm_plugin_aspect],
),
"module_name": attr.string(
- mandatory = False
+ mandatory = False,
),
}.items())
@@ -188,27 +191,25 @@
jar = "%{name}.jar",
jdeps = "%{name}.jdeps",
# The params file, declared here so that validate it can be validated for testing.
-# jar_2_params = "%{name}.jar-2.params",
+ # jar_2_params = "%{name}.jar-2.params",
srcjar = "%{name}-sources.jar",
)
_binary_outputs = dict(_common_outputs.items() + {
}.items())
-
-
########################################################################################################################
# Simple Rules:
########################################################################################################################
kt_jvm_library = rule(
attrs = dict(_common_attr.items() + {
- "exports": attr.label_list(default = [], providers=[JavaInfo]),
- "neverlink": attr.bool(default=False),
+ "exports": attr.label_list(default = [], providers = [JavaInfo]),
+ "neverlink": attr.bool(default = False),
}.items()),
outputs = _common_outputs,
toolchains = [_TOOLCHAIN_TYPE],
implementation = _kt_jvm_library_impl,
- provides = [JavaInfo, _KtJvmInfo]
+ provides = [JavaInfo, _KtJvmInfo],
)
"""This rule compiles and links Kotlin and Java sources into a .jar file.
@@ -234,7 +235,7 @@
kt_jvm_binary = rule(
attrs = dict(_runnable_common_attr.items() + {
- "main_class": attr.string(mandatory = True)
+ "main_class": attr.string(mandatory = True),
}.items()),
executable = True,
outputs = _binary_outputs,
@@ -261,10 +262,10 @@
),
"friends": attr.label_list(
default = [],
- providers = [JavaInfo, _KtJvmInfo]
+ providers = [JavaInfo, _KtJvmInfo],
),
"test_class": attr.string(),
- "main_class": attr.string(default="com.google.testing.junit.runner.BazelTestRunner"),
+ "main_class": attr.string(default = "com.google.testing.junit.runner.BazelTestRunner"),
}.items()),
executable = True,
outputs = _binary_outputs,
@@ -298,11 +299,11 @@
"runtime_deps": attr.label_list(
default = [],
mandatory = False,
- providers = [JavaInfo]
- )
+ providers = [JavaInfo],
+ ),
},
implementation = _kt_jvm_import_impl,
- provides = [JavaInfo, _KtJvmInfo]
+ provides = [JavaInfo, _KtJvmInfo],
)
# The pairing of src and class is used by intellij to attatch sources, this is picked up via the kt provider attribute.
diff --git a/kotlin/internal/jvm/plugins.bzl b/kotlin/internal/jvm/plugins.bzl
index ab61a6f..6e37647 100644
--- a/kotlin/internal/jvm/plugins.bzl
+++ b/kotlin/internal/jvm/plugins.bzl
@@ -20,27 +20,27 @@
_EMPTY_PLUGIN_INFO = [KtJvmPluginInfo(annotation_processors = [])]
-def _mk_processor_entry(l,p):
- merged_info=java_common.merge([j[JavaInfo] for j in p.deps])
+def _mk_processor_entry(l, p):
+ merged_info = java_common.merge([j[JavaInfo] for j in p.deps])
classpath_jars = depset([cp for cp in merged_info.full_compile_jars])
classpath_jars = classpath_jars + merged_info.transitive_runtime_jars
return struct(
- label=l,
- processor_class=p.processor_class,
- classpath=[cpj.path for cpj in classpath_jars.to_list()],
- generates_api=p.generates_api,
+ label = l,
+ processor_class = p.processor_class,
+ classpath = [cpj.path for cpj in classpath_jars.to_list()],
+ generates_api = p.generates_api,
)
def _merge_plugin_infos(attrs):
- tally={}
- annotation_processors=[]
+ tally = {}
+ annotation_processors = []
for info in [a[KtJvmPluginInfo] for a in attrs]:
for p in info.annotation_processors:
if p.label not in tally:
tally[p.label] = True
annotation_processors.append(p)
return KtJvmPluginInfo(
- annotation_processors=annotation_processors
+ annotation_processors = annotation_processors,
)
def _restore_label(l):
@@ -52,13 +52,12 @@
def _kt_jvm_plugin_aspect_impl(target, ctx):
if ctx.rule.kind == "java_plugin":
return [KtJvmPluginInfo(
- annotation_processors = [_mk_processor_entry(_restore_label(ctx.label),ctx.rule.attr)]
+ annotation_processors = [_mk_processor_entry(_restore_label(ctx.label), ctx.rule.attr)],
)]
+ elif ctx.rule.kind == "java_library":
+ return [_merge_plugin_infos(ctx.rule.attr.exported_plugins)]
else:
- if ctx.rule.kind == "java_library":
- return [_merge_plugin_infos(ctx.rule.attr.exported_plugins)]
- else:
- return _EMPTY_PLUGIN_INFO
+ return _EMPTY_PLUGIN_INFO
kt_jvm_plugin_aspect = aspect(
doc = """This aspect processes collects Java Plugins info so that annotation processors may be configured for a
diff --git a/kotlin/internal/repositories/BUILD b/kotlin/internal/repositories/BUILD
index 37e64eb..9c0f139 100644
--- a/kotlin/internal/repositories/BUILD
+++ b/kotlin/internal/repositories/BUILD
@@ -10,4 +10,4 @@
# 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.
\ No newline at end of file
+# limitations under the License.
diff --git a/kotlin/internal/repositories/compiler_releases.bzl b/kotlin/internal/repositories/compiler_releases.bzl
index c7753e9..db57783 100644
--- a/kotlin/internal/repositories/compiler_releases.bzl
+++ b/kotlin/internal/repositories/compiler_releases.bzl
@@ -18,22 +18,22 @@
"1.2.60": {
"version": "1.2.60",
"url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.60/kotlin-compiler-1.2.60.zip",
- "sha256": "ff79f695c9be0a500d4b56a69d0b8657b3d106d78a35101e792248af904a623d"
+ "sha256": "ff79f695c9be0a500d4b56a69d0b8657b3d106d78a35101e792248af904a623d",
},
"1.2.51": {
"version": "1.2.51",
"url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.51/kotlin-compiler-1.2.51.zip",
- "sha256": "8a74711c805d3d265b93c13d8c40af5b4dad324591450d2eef0eafc1c9a6f92c"
+ "sha256": "8a74711c805d3d265b93c13d8c40af5b4dad324591450d2eef0eafc1c9a6f92c",
},
"1.2.50": {
"version": "1.2.50",
"url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.50/kotlin-compiler-1.2.50.zip",
- "sha256": "bc062c303b376711097a27bda4c28047eda0744e9acc64b9db640c19c7d171a9"
+ "sha256": "bc062c303b376711097a27bda4c28047eda0744e9acc64b9db640c19c7d171a9",
},
"1.2.41": {
"version": "1.2.41",
"url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.41/kotlin-compiler-1.2.41.zip",
- "sha256": "af872772f268da5ca79d263b2943f1d694d475dddb80b6d408e9548805ed265c"
+ "sha256": "af872772f268da5ca79d263b2943f1d694d475dddb80b6d408e9548805ed265c",
},
"1.2.40": {
"version": "1.2.40",
diff --git a/kotlin/internal/repositories/repositories.bzl b/kotlin/internal/repositories/repositories.bzl
index 3faa13c..0599d7a 100644
--- a/kotlin/internal/repositories/repositories.bzl
+++ b/kotlin/internal/repositories/repositories.bzl
@@ -13,10 +13,11 @@
# limitations under the License.
"""This file contains the Kotlin compiler repository definitions. It should not be loaded directly by client workspaces.
"""
-load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_file="http_file", _http_archive="http_archive")
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive", _http_file = "http_file")
load("//kotlin/internal:defs.bzl", "KT_COMPILER_REPO")
load("//kotlin/internal/repositories:compiler_releases.bzl", "KOTLIN_COMPILER_RELEASES", "KOTLIN_CURRENT_RELEASE")
-load("//third_party/jvm:workspace.bzl", _maven_dependencies="maven_dependencies")
+load("//third_party/jvm:workspace.bzl", _maven_dependencies = "maven_dependencies")
_BAZEL_JAVA_LAUNCHER_VERSION = "0.8.1"
@@ -44,7 +45,7 @@
This function should not be called directly instead `kotlin_repositories` from `//kotlin:kotlin.bzl` should be
called to ensure common deps are loaded.
"""
- release=KOTLIN_COMPILER_RELEASES[kotlin_release_version]
+ release = KOTLIN_COMPILER_RELEASES[kotlin_release_version]
if not release:
fail('"%s" not a valid kotlin release, current release is "%s"' % (kotlin_release_version, KOTLIN_CURRENT_RELEASE))
@@ -52,22 +53,21 @@
name = KT_COMPILER_REPO,
url = release["url"],
sha256 = release["sha256"],
- build_file= "@io_bazel_rules_kotlin//kotlin/internal/repositories:BUILD.com_github_jetbrains_kotlin",
+ build_file = "@io_bazel_rules_kotlin//kotlin/internal/repositories:BUILD.com_github_jetbrains_kotlin",
strip_prefix = "kotlinc",
)
_http_file(
name = "kt_java_stub_template",
urls = [("https://raw.githubusercontent.com/bazelbuild/bazel/" +
- _BAZEL_JAVA_LAUNCHER_VERSION +
- "/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" +
- "java_stub_template.txt")],
+ _BAZEL_JAVA_LAUNCHER_VERSION +
+ "/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" +
+ "java_stub_template.txt")],
sha256 = "86660ee7d5b498ccf611a1e000564f45268dbf301e0b2b08c984dcecc6513f6e",
)
def kotlin_repositories(
- kotlin_release_version=KOTLIN_CURRENT_RELEASE
-):
+ kotlin_release_version = KOTLIN_CURRENT_RELEASE):
"""Call this in the WORKSPACE file to setup the Kotlin rules.
Args:
diff --git a/kotlin/internal/toolchains.bzl b/kotlin/internal/toolchains.bzl
index 01e07bf..aeae3e8 100644
--- a/kotlin/internal/toolchains.bzl
+++ b/kotlin/internal/toolchains.bzl
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//kotlin/internal/common:common.bzl", _common="common")
-load("//kotlin/internal:defs.bzl", _TOOLCHAIN_TYPE="TOOLCHAIN_TYPE", _KT_COMPILER_REPO="KT_COMPILER_REPO")
+load("//kotlin/internal/common:common.bzl", _common = "common")
+load("//kotlin/internal:defs.bzl", _KT_COMPILER_REPO = "KT_COMPILER_REPO", _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE")
"""Kotlin Toolchains
@@ -38,8 +38,6 @@
```
"""
-
-
# The toolchain rules are not made private, at least the jvm ones so that they may be introspected in Intelij.
_common_attrs = {
"kotlin_home": attr.label(
@@ -67,11 +65,11 @@
],
),
"debug": attr.string_list(
- allow_empty=True,
- doc="""Debugging tags passed to the builder. Two tags are supported. `timings` will cause the builder to print
+ allow_empty = True,
+ doc = """Debugging tags passed to the builder. Two tags are supported. `timings` will cause the builder to print
timing information. `trace` will cause the builder to print tracing messages. These tags can be enabled via the default
toolchain via the defines `kt_timings=1` and `kt_trace=1`. The tags may also be picked up via the `tags` attribute
-defined directly on the rules."""
+defined directly on the rules.""",
),
"coroutines": attr.string(
default = "enable",
@@ -114,12 +112,9 @@
api_version = ctx.attr.api_version,
coroutines = ctx.attr.coroutines,
debug = ctx.attr.debug,
-
jvm_target = ctx.attr.jvm_target,
-
kotlinbuilder = ctx.attr.kotlinbuilder,
kotlin_home = ctx.files.kotlin_home,
-
jvm_stdlibs = java_common.create_provider(
compile_time_jars = ctx.files.jvm_stdlibs,
runtime_jars = ctx.files.jvm_runtime,
@@ -127,7 +122,7 @@
),
)
return [
- platform_common.ToolchainInfo(**toolchain)
+ platform_common.ToolchainInfo(**toolchain),
]
kt_toolchain = rule(
@@ -149,13 +144,12 @@
native.register_toolchains("@io_bazel_rules_kotlin//kotlin/internal:default_toolchain")
def define_kt_toolchain(
- name,
- language_version=None,
- api_version=None,
- jvm_target=None,
- coroutines=None,
- debug=[]
-):
+ name,
+ language_version = None,
+ api_version = None,
+ jvm_target = None,
+ coroutines = None,
+ debug = []):
"""Define a Kotlin JVM Toolchain, the name is used in the `toolchain` rule so can be used to register the toolchain
in the WORKSPACE file.
"""
@@ -167,34 +161,33 @@
jvm_target = jvm_target,
coroutines = coroutines,
debug = debug,
- visibility = ["//visibility:public"]
+ visibility = ["//visibility:public"],
)
native.toolchain(
name = name,
toolchain_type = _TOOLCHAIN_TYPE,
toolchain = impl_name,
- visibility = ["//visibility:public"]
+ visibility = ["//visibility:public"],
)
def _kt_toolchain_ide_info_impl(ctx):
- tc=ctx.toolchains[_TOOLCHAIN_TYPE]
+ tc = ctx.toolchains[_TOOLCHAIN_TYPE]
info = struct(
label = tc.label,
common = struct(
language_version = tc.language_version,
api_version = tc.api_version,
- coroutines = tc.coroutines
+ coroutines = tc.coroutines,
),
jvm = struct(
jvm_target = tc.jvm_target,
- )
+ ),
)
ctx.actions.write(ctx.outputs.ide_info, info.to_json())
- return [DefaultInfo(files=depset([ctx.outputs.ide_info]))]
+ return [DefaultInfo(files = depset([ctx.outputs.ide_info]))]
kt_toolchain_ide_info = rule(
outputs = {"ide_info": "kt_toolchain_ide_info.json"},
toolchains = [_TOOLCHAIN_TYPE],
implementation = _kt_toolchain_ide_info_impl,
)
-
diff --git a/kotlin/kotlin.bzl b/kotlin/kotlin.bzl
index 7bad54c..5b369d9 100644
--- a/kotlin/kotlin.bzl
+++ b/kotlin/kotlin.bzl
@@ -13,10 +13,10 @@
# limitations under the License.
load("//kotlin/internal/repositories:repositories.bzl", "kotlin_repositories")
load("//kotlin/internal:toolchains.bzl", "kt_register_toolchains")
-
-load("//kotlin/internal/jvm:jvm.bzl",
+load(
+ "//kotlin/internal/jvm:jvm.bzl",
"kt_jvm_binary",
+ "kt_jvm_import",
"kt_jvm_library",
"kt_jvm_test",
- "kt_jvm_import",
-)
\ No newline at end of file
+)
diff --git a/scripts/gen_proto_jars b/scripts/gen_proto_jars
index f4afc0f..217d1b3 100755
--- a/scripts/gen_proto_jars
+++ b/scripts/gen_proto_jars
@@ -1,3 +1,18 @@
+# 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.
+#!/usr/bin/env bash
+# Note: Written on a mac please make it compatible with linux if needed.
#!/usr/bin/env bash
# The script precompiles the ptoto deps. If this isn't used the client workspaces would have a dependency on protoc.
diff --git a/scripts/reflow_skylark b/scripts/reflow_skylark
new file mode 100755
index 0000000..3489993
--- /dev/null
+++ b/scripts/reflow_skylark
@@ -0,0 +1,27 @@
+# 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.
+#!/usr/bin/env bash
+# Note: Written on a mac please make it compatible with linux if needed.
+#!/usr/bin/env bash
+
+buildifier -mode=fix -v $(find kotlin -type f \
+ -iname "*.bzl" -or \
+ -iname "BUILD" -or \
+ -iname "BUILD.com_github_jetbrains_kotlin"
+)
+
+buildifier -mode=fix -v \
+ "third_party/BUILD" \
+ "WORKSPACE" \
+ "BUILD"
\ No newline at end of file
diff --git a/scripts/regen_deps b/scripts/regen_deps
index 1072e02..99c858e 100755
--- a/scripts/regen_deps
+++ b/scripts/regen_deps
@@ -1,3 +1,18 @@
+# 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.
+#!/usr/bin/env bash
+# Note: Written on a mac please make it compatible with linux if needed.
#!/usr/bin/env bash
set -e
diff --git a/tests/integrationtests/BUILD b/tests/integrationtests/BUILD
index ee2b8bc..6f22d63 100644
--- a/tests/integrationtests/BUILD
+++ b/tests/integrationtests/BUILD
@@ -11,18 +11,18 @@
# 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(default_visibility=["//tests/integrationtests:__subpackages__"])
+package(default_visibility = ["//tests/integrationtests:__subpackages__"])
test_suite(
name = "integrationtests",
- tests=[
- "//tests/integrationtests/jvm"
- ]
+ tests = [
+ "//tests/integrationtests/jvm",
+ ],
)
test_suite(
name = "integrationtests_local",
tests = [
- "//tests/integrationtests/jvm:jvm_local"
- ]
-)
\ No newline at end of file
+ "//tests/integrationtests/jvm:jvm_local",
+ ],
+)
diff --git a/tests/integrationtests/jvm/BUILD b/tests/integrationtests/jvm/BUILD
index 1b4a427..27ad6f4 100644
--- a/tests/integrationtests/jvm/BUILD
+++ b/tests/integrationtests/jvm/BUILD
@@ -11,47 +11,48 @@
# 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(default_visibility=["//visibility:private"])
+package(default_visibility = ["//visibility:private"])
+
# The tests are written in Kotlin, so the tests inately test a lot of the rule functionality.
load("//tests/rules:defs.bzl", "kt_it_assertion_test")
kt_it_assertion_test(
name = "basic_tests",
- cases="//tests/integrationtests/jvm/basic:cases",
- test_class="io.bazel.kotlin.testing.jvm.JvmBasicFunctionalTests",
+ cases = "//tests/integrationtests/jvm/basic:cases",
+ test_class = "io.bazel.kotlin.testing.jvm.JvmBasicFunctionalTests",
)
kt_it_assertion_test(
- name ="basic_local_tests",
- cases="//tests/integrationtests/jvm/basic:cases",
+ name = "basic_local_tests",
+ cases = "//tests/integrationtests/jvm/basic:cases",
test_class = "io.bazel.kotlin.testing.jvm.JvmBasicLocalTests",
)
kt_it_assertion_test(
name = "kapt_tests",
cases = "//tests/integrationtests/jvm/kapt:cases",
- test_class="io.bazel.kotlin.testing.jvm.KaptTests",
+ test_class = "io.bazel.kotlin.testing.jvm.KaptTests",
)
kt_it_assertion_test(
name = "example_tests",
- test_class="io.bazel.kotlin.testing.jvm.JvmExampleTests",
- data = [ "//examples/dagger:coffee_app"]
+ data = ["//examples/dagger:coffee_app"],
+ test_class = "io.bazel.kotlin.testing.jvm.JvmExampleTests",
)
test_suite(
name = "jvm",
tests = [
":basic_tests",
- ":kapt_tests",
":example_tests",
- "//tests/integrationtests/jvm/basic:friends_tests"
- ]
+ ":kapt_tests",
+ "//tests/integrationtests/jvm/basic:friends_tests",
+ ],
)
test_suite(
name = "jvm_local",
tests = [
- ":basic_local_tests"
- ]
+ ":basic_local_tests",
+ ],
)
diff --git a/tests/integrationtests/jvm/basic/BUILD b/tests/integrationtests/jvm/basic/BUILD
index 16950c4..fdda127 100644
--- a/tests/integrationtests/jvm/basic/BUILD
+++ b/tests/integrationtests/jvm/basic/BUILD
@@ -11,124 +11,125 @@
# 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:kotlin.bzl", "kt_jvm_test", "kt_jvm_library", "kt_jvm_binary")
+load("//kotlin:kotlin.bzl", "kt_jvm_binary", "kt_jvm_library", "kt_jvm_test")
kt_jvm_binary(
- name="test_module_name_bin",
- srcs=glob(["helloworld/Main.kt"]),
- main_class= "helloworld.Main",
+ name = "test_module_name_bin",
+ srcs = glob(["helloworld/Main.kt"]),
+ main_class = "helloworld.Main",
)
kt_jvm_library(
name = "test_module_name_lib",
- srcs = ["helloworld/Main.kt"]
+ srcs = ["helloworld/Main.kt"],
)
kt_jvm_library(
- name="test_module_name_attr_lib",
- srcs=glob(["helloworld/Main.kt"]),
- module_name = "hello-module"
+ name = "test_module_name_attr_lib",
+ srcs = glob(["helloworld/Main.kt"]),
+ module_name = "hello-module",
)
# a test resource library.
java_library(
name = "resourcejar",
+ resource_strip_prefix = "tests/integrationtests/jvm/basic/resourcejar",
resources = glob(["resourcejar/**"]),
- resource_strip_prefix = "tests/integrationtests/jvm/basic/resourcejar"
)
kt_jvm_library(
name = "test_embed_resources",
srcs = glob(["testresources/src/*.kt"]),
resources = glob(["testresources/resources/**/*"]),
- visibility = ["//visibility:public"]
+ visibility = ["//visibility:public"],
)
kt_jvm_library(
name = "test_merge_resourcesjar",
srcs = glob(["testresources/src/*.kt"]),
resource_jars = [":resourcejar"],
- visibility = ["//visibility:public"]
+ visibility = ["//visibility:public"],
)
-
kt_jvm_library(
name = "test_embed_resources_strip_prefix",
srcs = glob(["testresources/src/*.kt"]),
+ resource_strip_prefix = "tests/integrationtests/jvm/basic/testresources/resources",
resources = glob(["testresources/resources/**/*"]),
- resource_strip_prefix = "tests/integrationtests/jvm/basic/testresources/resources"
)
kt_jvm_library(
name = "conventional_strip_resources",
srcs = glob(["testresources/src/*.kt"]),
- resources = glob(["conventional_strip_resources/src/main/resources/**/*", "conventional_strip_resources/src/test/resources/**/*"])
+ resources = glob([
+ "conventional_strip_resources/src/main/resources/**/*",
+ "conventional_strip_resources/src/test/resources/**/*",
+ ]),
)
kt_jvm_library(
name = "propagation_test_exporter_lib",
srcs = ["propagation/Stub.kt"],
- exports = ["//third_party/jvm/junit"]
+ exports = ["//third_party/jvm/junit"],
)
kt_jvm_library(
name = "propagation_test_runtime_lib",
srcs = ["propagation/Stub.kt"],
- runtime_deps = ["//third_party/jvm/junit"]
+ runtime_deps = ["//third_party/jvm/junit"],
)
java_binary(
name = "propagation_ct_consumer",
- main_class = "testing.CompileTimeDependent",
srcs = ["propagation/CompileTimeDependent.java"],
- deps = [":propagation_test_exporter_lib"]
+ main_class = "testing.CompileTimeDependent",
+ deps = [":propagation_test_exporter_lib"],
)
java_binary(
name = "propagation_rt_via_export_consumer",
- main_class = "testing.RuntimeDependent",
srcs = ["propagation/RuntimeDependent.java"],
- deps = [":propagation_test_exporter_lib"]
+ main_class = "testing.RuntimeDependent",
+ deps = [":propagation_test_exporter_lib"],
)
java_binary(
name = "propagation_rt_via_runtime_deps_consumer",
- main_class = "testing.RuntimeDependent",
srcs = ["propagation/RuntimeDependent.java"],
- deps = [":propagation_test_runtime_lib"]
+ main_class = "testing.RuntimeDependent",
+ deps = [":propagation_test_runtime_lib"],
)
kt_jvm_library(
name = "test_friends_library",
- srcs = ["test_friends/Service.kt"]
+ srcs = ["test_friends/Service.kt"],
)
# This test should be explicetly executed as module name mangling handling could regress otherwise.
kt_jvm_test(
name = "friends_tests",
srcs = ["test_friends/TestFriendsTest.kt"],
+ friends = [":test_friends_library"],
test_class = "test.TestFriendsTest",
deps = [
- "//third_party/jvm/junit:junit"
+ "//third_party/jvm/junit",
],
- friends = [":test_friends_library"]
)
filegroup(
- name="cases",
+ name = "cases",
srcs = [
- ":test_module_name_bin",
- ":test_module_name_lib",
- ":test_module_name_attr_lib",
- ":test_embed_resources.jar",
- ":test_merge_resourcesjar.jar",
- ":test_embed_resources_strip_prefix.jar",
- ":test_module_name_bin.jar",
":conventional_strip_resources.jar",
":propagation_ct_consumer",
":propagation_rt_via_export_consumer",
- ":propagation_rt_via_runtime_deps_consumer"
+ ":propagation_rt_via_runtime_deps_consumer",
+ ":test_embed_resources.jar",
+ ":test_embed_resources_strip_prefix.jar",
+ ":test_merge_resourcesjar.jar",
+ ":test_module_name_attr_lib",
+ ":test_module_name_bin",
+ ":test_module_name_bin.jar",
+ ":test_module_name_lib",
],
- visibility=["//tests/integrationtests:__subpackages__"]
+ visibility = ["//tests/integrationtests:__subpackages__"],
)
-
diff --git a/tests/integrationtests/jvm/kapt/BUILD b/tests/integrationtests/jvm/kapt/BUILD
index c0c9e95..9ab3b6f 100644
--- a/tests/integrationtests/jvm/kapt/BUILD
+++ b/tests/integrationtests/jvm/kapt/BUILD
@@ -11,103 +11,147 @@
# 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(default_visibility=["//visibility:private"])
+package(default_visibility = ["//visibility:private"])
+
load("//kotlin:kotlin.bzl", "kt_jvm_library")
java_plugin(
name = "autovalue",
- deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
- processor_class = "com.google.auto.value.processor.AutoValueProcessor",
generates_api = 1,
+ processor_class = "com.google.auto.value.processor.AutoValueProcessor",
+ deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
)
java_plugin(
name = "autoservice",
+ generates_api = 0,
+ processor_class = "com.google.auto.service.processor.AutoServiceProcessor",
deps = [
"//third_party/jvm/com/google/auto/service:auto_service",
"//third_party/jvm/com/google/guava",
],
- processor_class = "com.google.auto.service.processor.AutoServiceProcessor",
- generates_api = 0
)
java_plugin(
name = "autovalue_no_processor_class",
- deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
generates_api = 1,
+ deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
)
kt_jvm_library(
name = "ap_kotlin",
srcs = ["kotlin/TestKtValue.kt"],
+ plugins = [":autovalue"],
deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
- plugins = [":autovalue"]
)
kt_jvm_library(
name = "ap_kotlin_mixed_no_plugin",
- srcs = ["kotlin/TestKtAPNoGenReference.kt", "java/TestAPNoGenReferences.java"],
- deps = ["//third_party/jvm/com/google/auto/value:auto_value"]
+ srcs = [
+ "java/TestAPNoGenReferences.java",
+ "kotlin/TestKtAPNoGenReference.kt",
+ ],
+ deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
)
kt_jvm_library(
name = "ap_kotlin_mixed",
- srcs = ["kotlin/TestKtValue.kt", "java/TestAutoValue.java"],
+ srcs = [
+ "java/TestAutoValue.java",
+ "kotlin/TestKtValue.kt",
+ ],
+ plugins = [":autovalue"],
deps = ["//third_party/jvm/com/google/auto/value:auto_value"],
- plugins = [":autovalue"]
)
kt_jvm_library(
name = "ap_kotlin_resources",
srcs = ["kotlin/TestKtService.kt"],
+ plugins = [":autoservice"],
deps = ["//third_party/jvm/com/google/auto/service:auto_service"],
- plugins = [":autoservice"]
)
kt_jvm_library(
name = "ap_kotlin_resources_mixed",
- srcs = ["kotlin/TestKtService.kt", "java/TestJavaService.java"],
+ srcs = [
+ "java/TestJavaService.java",
+ "kotlin/TestKtService.kt",
+ ],
+ plugins = [":autoservice"],
deps = ["//third_party/jvm/com/google/auto/service:auto_service"],
- plugins = [":autoservice"]
)
kt_jvm_library(
name = "ap_kotlin_mixed_multiple_plugins",
- srcs = ["kotlin/TestKtService.kt", "java/TestJavaService.java", "java/TestAutoValue.java", "kotlin/TestKtValue.kt"],
- deps = ["//third_party/jvm/com/google/auto/service:auto_service", "//third_party/jvm/com/google/auto/value:auto_value"],
- plugins = [":autoservice", ":autovalue"]
+ srcs = [
+ "java/TestAutoValue.java",
+ "java/TestJavaService.java",
+ "kotlin/TestKtService.kt",
+ "kotlin/TestKtValue.kt",
+ ],
+ plugins = [
+ ":autoservice",
+ ":autovalue",
+ ],
+ deps = [
+ "//third_party/jvm/com/google/auto/service:auto_service",
+ "//third_party/jvm/com/google/auto/value:auto_value",
+ ],
)
kt_jvm_library(
name = "ap_kotlin_mixed_multiple_plugins_one_without_processor_class",
- srcs = ["kotlin/TestKtService.kt", "java/TestJavaService.java", "java/TestAPNoGenReferences.java", "kotlin/TestKtAPNoGenReference.kt"],
- deps = ["//third_party/jvm/com/google/auto/service:auto_service", "//third_party/jvm/com/google/auto/value:auto_value"],
- plugins = [":autoservice", ":autovalue_no_processor_class"]
+ srcs = [
+ "java/TestAPNoGenReferences.java",
+ "java/TestJavaService.java",
+ "kotlin/TestKtAPNoGenReference.kt",
+ "kotlin/TestKtService.kt",
+ ],
+ plugins = [
+ ":autoservice",
+ ":autovalue_no_processor_class",
+ ],
+ deps = [
+ "//third_party/jvm/com/google/auto/service:auto_service",
+ "//third_party/jvm/com/google/auto/value:auto_value",
+ ],
)
java_library(
name = "library_exporting_autovalue_and_junit",
- exported_plugins = [":autovalue", ":autoservice"],
+ exported_plugins = [
+ ":autovalue",
+ ":autoservice",
+ ],
)
kt_jvm_library(
name = "ap_kotlin_mixed_inherit_plugin_via_exported_deps",
- srcs = ["kotlin/TestKtService.kt", "java/TestJavaService.java", "java/TestAutoValue.java", "kotlin/TestKtValue.kt"],
- deps = ["//third_party/jvm/com/google/auto/service:auto_service", "//third_party/jvm/com/google/auto/value:auto_value", "library_exporting_autovalue_and_junit"],
- plugins = [":autovalue"]
+ srcs = [
+ "java/TestAutoValue.java",
+ "java/TestJavaService.java",
+ "kotlin/TestKtService.kt",
+ "kotlin/TestKtValue.kt",
+ ],
+ plugins = [":autovalue"],
+ deps = [
+ "library_exporting_autovalue_and_junit",
+ "//third_party/jvm/com/google/auto/service:auto_service",
+ "//third_party/jvm/com/google/auto/value:auto_value",
+ ],
)
filegroup(
name = "cases",
srcs = [
":ap_kotlin.jar",
- ":ap_kotlin_mixed_no_plugin",
":ap_kotlin_mixed",
- ":ap_kotlin_resources",
- ":ap_kotlin_resources_mixed",
+ ":ap_kotlin_mixed_inherit_plugin_via_exported_deps",
":ap_kotlin_mixed_multiple_plugins",
":ap_kotlin_mixed_multiple_plugins_one_without_processor_class",
- ":ap_kotlin_mixed_inherit_plugin_via_exported_deps",
+ ":ap_kotlin_mixed_no_plugin",
+ ":ap_kotlin_resources",
+ ":ap_kotlin_resources_mixed",
],
- visibility=["//tests/integrationtests:__subpackages__"]
-)
\ No newline at end of file
+ visibility = ["//tests/integrationtests:__subpackages__"],
+)
diff --git a/tests/rules/BUILD b/tests/rules/BUILD
index f223bb6..780a73f 100644
--- a/tests/rules/BUILD
+++ b/tests/rules/BUILD
@@ -11,16 +11,17 @@
# 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(default_visibility=["//tests:__subpackages__"])
+package(default_visibility = ["//tests:__subpackages__"])
+
load("//kotlin:kotlin.bzl", "kt_jvm_library")
kt_jvm_library(
name = "assertion_test_case",
+ testonly = 1,
srcs = ["AssertionTestCase.kt"],
- visibility=["//tests:__subpackages__"],
- deps=[
+ visibility = ["//tests:__subpackages__"],
+ deps = [
"@com_github_jetbrains_kotlin//:kotlin-test",
"@io_bazel_rules_kotlin_com_google_guava_guava//jar",
],
- testonly=1
-)
\ No newline at end of file
+)
diff --git a/tests/rules/defs.bzl b/tests/rules/defs.bzl
index 1c9d131..d72e4f5 100644
--- a/tests/rules/defs.bzl
+++ b/tests/rules/defs.bzl
@@ -13,21 +13,21 @@
# limitations under the License.
load("//kotlin:kotlin.bzl", "kt_jvm_test")
-TEST_COMMON_DEPS=[
+TEST_COMMON_DEPS = [
"//tests/rules:assertion_test_case",
"//third_party/jvm/com/google/truth",
- "//third_party/jvm/junit:junit"
+ "//third_party/jvm/junit:junit",
]
-def kt_it_assertion_test(name, test_class, cases=None, data = [], deps=[]):
- parts=test_class.split(".")
+def kt_it_assertion_test(name, test_class, cases = None, data = [], deps = []):
+ parts = test_class.split(".")
if cases:
data = data + [cases]
kt_jvm_test(
- name=name,
- srcs=["%s.kt" % parts[len(parts)-1]],
+ name = name,
+ srcs = ["%s.kt" % parts[len(parts) - 1]],
deps = TEST_COMMON_DEPS + deps,
- test_class=test_class,
- data=data,
- visibility=["//visibility:private"]
- )
\ No newline at end of file
+ test_class = test_class,
+ data = data,
+ visibility = ["//visibility:private"],
+ )
diff --git a/third_party/BUILD b/third_party/BUILD
index d1ef82b..3e01d88 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
package(default_visibility = ["//visibility:public"])
+
load("//kotlin:kotlin.bzl", "kt_jvm_import")
java_binary(
@@ -31,10 +32,10 @@
name = "dagger_component_plugin",
generates_api = 1,
processor_class = "dagger.internal.codegen.ComponentProcessor",
+ visibility = ["//visibility:private"],
deps = [
"//third_party/jvm/com/google/dagger:dagger_compiler",
],
- visibility = ["//visibility:private"]
)
java_library(
@@ -44,4 +45,4 @@
"//third_party/jvm/com/google/dagger",
"//third_party/jvm/javax/inject:javax_inject",
],
-)
\ No newline at end of file
+)