various tidy ups and documentation
diff --git a/kotlin/BUILD b/kotlin/BUILD
index f8db35a..9c0f139 100644
--- a/kotlin/BUILD
+++ b/kotlin/BUILD
@@ -11,9 +11,3 @@
# 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"])
-
-toolchain_type(
- name = "kt_toolchain_type",
- visibility = ["//visibility:public"],
-)
diff --git a/kotlin/internal/BUILD b/kotlin/internal/BUILD
index c3ade48..6a985b1 100644
--- a/kotlin/internal/BUILD
+++ b/kotlin/internal/BUILD
@@ -23,15 +23,11 @@
values = {"define": "kt_trace=1"},
)
+toolchain_type(
+ name = "kt_toolchain_type",
+ visibility = ["//visibility:public"],
+)
+
define_kt_toolchain(
name = "default_toolchain",
- debug =
- select({
- ":builder_debug_trace": ["trace"],
- "//conditions:default": [],
- }) +
- select({
- ":builder_debug_timings": ["timings"],
- "//conditions:default": [],
- }),
)
diff --git a/kotlin/internal/defs.bzl b/kotlin/internal/defs.bzl
index ea1b774..cde4313 100644
--- a/kotlin/internal/defs.bzl
+++ b/kotlin/internal/defs.bzl
@@ -13,7 +13,7 @@
# limitations under the License.#
# The Kotlin Toolchain type.
-TOOLCHAIN_TYPE = "@io_bazel_rules_kotlin//kotlin:kt_toolchain_type"
+TOOLCHAIN_TYPE = "@io_bazel_rules_kotlin//kotlin/internal:kt_toolchain_type"
# The name of the Kotlin compiler workspace.
KT_COMPILER_REPO = "com_github_jetbrains_kotlin"
diff --git a/kotlin/internal/js/impl.bzl b/kotlin/internal/js/impl.bzl
index 3b8a983..d565ed6 100644
--- a/kotlin/internal/js/impl.bzl
+++ b/kotlin/internal/js/impl.bzl
@@ -17,8 +17,8 @@
_TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
)
load(
- "//kotlin/internal/common:common.bzl",
- _common = "common",
+ "//kotlin/internal/utils:utils.bzl",
+ _utils = "utils",
)
# The following kt-js flags are currently not used.
@@ -44,10 +44,10 @@
libraries = depset([d[_KtJsInfo].jar for d in ctx.attr.deps])
- args = _common.init_args(
+ args = _utils.init_args(
ctx,
"kt_js_library",
- _common.derive_module_name(ctx),
+ _utils.derive_module_name(ctx),
)
args.add_all(
diff --git a/kotlin/internal/jvm/android.bzl b/kotlin/internal/jvm/android.bzl
index 413de97..8da7540 100644
--- a/kotlin/internal/jvm/android.bzl
+++ b/kotlin/internal/jvm/android.bzl
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load(
- ":jvm.bzl",
+ "//kotlin/internal/jvm:jvm.bzl",
_kt_jvm_library = "kt_jvm_library",
)
diff --git a/kotlin/internal/jvm/compile.bzl b/kotlin/internal/jvm/compile.bzl
index 71b3ec1..6ef2616 100644
--- a/kotlin/internal/jvm/compile.bzl
+++ b/kotlin/internal/jvm/compile.bzl
@@ -11,35 +11,21 @@
# 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", "KtJvmInfo", "TOOLCHAIN_TYPE")
-load("//kotlin/internal/jvm:plugins.bzl", "plugins")
-load("//kotlin/internal/common:common.bzl", "common")
+load(
+ "//kotlin/internal:defs.bzl",
+ _KtJvmInfo = "KtJvmInfo",
+ _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
+)
+load(
+ "//kotlin/internal/jvm:plugins.bzl",
+ _merge_plugin_infos = "merge_plugin_infos"
+)
+load(
+ "//kotlin/internal/utils:utils.bzl",
+ _utils = "utils",
+)
-# MISC UTILS ###########################################################################################################
-def _partition_srcs(srcs):
- kt_srcs = []
- java_srcs = []
- src_jars = []
-
- for f in srcs:
- if f.path.endswith(".kt"):
- kt_srcs.append(f)
- elif f.path.endswith(".java"):
- java_srcs.append(f)
- elif f.path.endswith(".srcjar"):
- src_jars.append(f)
-
- kt = depset(kt_srcs)
- java = depset(java_srcs)
-
- return struct(
- kt = kt,
- java = java,
- all_srcs = kt + java,
- src_jars = depset(src_jars),
- )
-
-# JAR ACTIONS ##########################################################################################################
+# INTERNAL ACTIONS #####################################################################################################
def _fold_jars_action(ctx, rule_kind, output_jar, input_jars):
args = [
"--normalize",
@@ -124,46 +110,75 @@
)
return resources_jar_output
-def kt_jvm_compile_action(ctx, rule_kind, output_jar, srcs):
- """This macro performs a compile operation in a single action.
+# MAIN ACTIONS #########################################################################################################
+def _declare_output_directory(ctx, aspect, dir_name):
+ return ctx.actions.declare_directory("_kotlinc/%s_%s/%s_%s" % (ctx.label.name, aspect, ctx.label.name, dir_name))
+
+def _partition_srcs(srcs):
+ """Partition sources for the jvm aspect."""
+ kt_srcs = []
+ java_srcs = []
+ src_jars = []
+
+ for f in srcs:
+ if f.path.endswith(".kt"):
+ kt_srcs.append(f)
+ elif f.path.endswith(".java"):
+ java_srcs.append(f)
+ elif f.path.endswith(".srcjar"):
+ src_jars.append(f)
+
+ kt = depset(kt_srcs)
+ java = depset(java_srcs)
+
+ return struct(
+ kt = kt,
+ java = java,
+ all_srcs = kt + java,
+ src_jars = depset(src_jars),
+ )
+
+def kt_jvm_compile_action(ctx, rule_kind, output_jar):
+ """This macro sets up a compile action for a Kotlin jar.
Args:
- rule_kind: The rule kind,
- output_jar: The jar file that this macro will use as the output of the action.
- module_name: The Kotlin module name, this must be provided and is used by the compiler for symbol mangling in
- advanced use cases.
- compile_jars: The compile time jars provided on the classpath for the compile operations -- callers are
- responsible for preparing the classpath. The stdlib (and jdk7 + jdk8) should generally be added to the classpath
- by the caller -- kotlin-reflect could be optional.
- 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.
+ rule_kind: The rule kind --e.g., `kt_jvm_library`.
+ output_jar: The jar file that this macro will use as the output of the action.
+ Returns:
+ A struct containing the providers JavaInfo (`java`) and `kt` (KtJvmInfo). This struct is not intended to be
+ used as a legacy provider -- rather the caller should transform the result.
"""
- toolchain = ctx.toolchains[TOOLCHAIN_TYPE]
+ toolchain = ctx.toolchains[_TOOLCHAIN_TYPE]
+ srcs = _partition_srcs(ctx.files.srcs)
+ if (len(srcs.kt) + len(srcs.java) == 0) and len(srcs.src_jars) == 0:
+ fail("no sources provided")
+
+ # TODO extract and move this into common. Need to make it generic first.
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)
+ module_name = _utils.derive_module_name(ctx)
friend_paths = depset()
elif len(friends) == 1:
- if friends[0][KtJvmInfo] == None:
+ 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])
- module_name = friends[0][KtJvmInfo].module_name
+ 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 = _declare_output_directory(ctx, "jvm", "classes")
+ generated_classes_directory = _declare_output_directory(ctx, "jvm", "generated_classes")
+ sourcegen_directory = _declare_output_directory(ctx, "jvm", "sourcegenfiles")
+ temp_directory = _declare_output_directory(ctx, "jvm", "temp")
- args = common.init_args(ctx, rule_kind, module_name)
+ args = _utils.init_args(ctx, rule_kind, module_name)
args.add("--classdir", classes_directory)
args.add("--sourcegendir", sourcegen_directory)
@@ -181,7 +196,7 @@
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 = _merge_plugin_infos(ctx.attr.plugins + ctx.attr.deps)
if len(plugin_info.annotation_processors) > 0:
args.add("--kotlin_plugins", plugin_info.to_json())
@@ -212,8 +227,6 @@
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(
output_jar = ctx.outputs.jar,
@@ -225,7 +238,7 @@
exports = [d[JavaInfo] for d in getattr(ctx.attr, "exports", [])],
neverlink = getattr(ctx.attr, "neverlink", False),
),
- kt = KtJvmInfo(
+ kt = _KtJvmInfo(
srcs = ctx.files.srcs,
module_name = module_name,
# intelij aspect needs this.
@@ -240,53 +253,37 @@
),
)
-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.
+def kt_jvm_produce_jar_actions(ctx, rule_kind):
+ """Setup The actions to compile a jar and merge additional resources onto it. see `kt_jvm_compile_action`."""
- Specifically this action will conditionally set up actions to fold resources and resourcejars and merge them onto a
- jar compiled by the builder. It indirects the output_jar -- i.e., if no resources or resource jars are present it
- won't do anything.
-
- Args:
- ctx: The rule context.
- Returns:
- A JavaInfo struct for the output jar that this macro will build.
- """
-
- # The main output jars
+ # The jar that is compiled from sources.
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.
+ # Indirection -- by default it is the same as the 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.
+ # A list of jars that should be merged with the output_jar, start with the resource jars if any were provided.
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 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:
output_merge_list = output_merge_list + [_build_resourcejar_action(ctx)]
- # 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 the merge list is not empty the kotlin compiler should compile to an intermediate jar.
if len(output_merge_list) > 0:
- # Intermediate jar containing the Kotlin compile output.
+ # Declare the intermediate 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.
+ # 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
- srcs = _partition_srcs(ctx.files.srcs)
-
- if (len(srcs.kt) + len(srcs.java) == 0) and len(srcs.src_jars) == 0:
- fail("no sources provided")
-
- # setup the merge action if needed.
- if len(output_merge_list) > 0:
+ # Setup the merge action
_fold_jars_action(ctx, rule_kind, output_jar, output_merge_list)
- # setup the compile action.
+ # Setup the compile action.
return kt_jvm_compile_action(
ctx,
rule_kind = rule_kind,
output_jar = kt_compile_output_jar,
- srcs = srcs,
)
diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl
index 2e79bf7..094c57f 100644
--- a/kotlin/internal/jvm/impl.bzl
+++ b/kotlin/internal/jvm/impl.bzl
@@ -11,8 +11,14 @@
# 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")):
return struct(
diff --git a/kotlin/internal/jvm/jvm.bzl b/kotlin/internal/jvm/jvm.bzl
index 83d9de1..7b8c19d 100644
--- a/kotlin/internal/jvm/jvm.bzl
+++ b/kotlin/internal/jvm/jvm.bzl
@@ -90,7 +90,11 @@
```
"""
-load("//kotlin/internal:defs.bzl", _KtJvmInfo = "KtJvmInfo", _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE")
+load(
+ "//kotlin/internal:defs.bzl",
+ _KtJvmInfo = "KtJvmInfo",
+ _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
+)
load(
"//kotlin/internal/jvm:plugins.bzl",
_kt_jvm_plugin_aspect = "kt_jvm_plugin_aspect",
diff --git a/kotlin/internal/jvm/plugins.bzl b/kotlin/internal/jvm/plugins.bzl
index 6e37647..f6a1790 100644
--- a/kotlin/internal/jvm/plugins.bzl
+++ b/kotlin/internal/jvm/plugins.bzl
@@ -18,8 +18,6 @@
},
)
-_EMPTY_PLUGIN_INFO = [KtJvmPluginInfo(annotation_processors = [])]
-
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])
@@ -31,7 +29,16 @@
generates_api = p.generates_api,
)
-def _merge_plugin_infos(attrs):
+def _restore_label(l):
+ lbl = l.workspace_root
+ if lbl.startswith("external/"):
+ lbl = lbl.replace("external/", "@")
+ return lbl + "//" + l.package + ":" + l.name
+
+_EMPTY_PLUGIN_INFO = [KtJvmPluginInfo(annotation_processors = [])]
+
+def merge_plugin_infos(attrs):
+ """Merge all of the plugin infos found in the provided sequence of attributes."""
tally = {}
annotation_processors = []
for info in [a[KtJvmPluginInfo] for a in attrs]:
@@ -43,25 +50,18 @@
annotation_processors = annotation_processors,
)
-def _restore_label(l):
- lbl = l.workspace_root
- if lbl.startswith("external/"):
- lbl = lbl.replace("external/", "@")
- return lbl + "//" + l.package + ":" + l.name
-
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)],
)]
elif ctx.rule.kind == "java_library":
- return [_merge_plugin_infos(ctx.rule.attr.exported_plugins)]
+ return [merge_plugin_infos(ctx.rule.attr.exported_plugins)]
else:
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
-rule.""",
+ doc = """This aspect collects Java Plugins info and other Kotlin compiler plugin configurations from the graph.""",
attr_aspects = [
"plugins",
"exported_plugins",
@@ -69,10 +69,3 @@
provides = [KtJvmPluginInfo],
implementation = _kt_jvm_plugin_aspect_impl,
)
-
-"""renders a java info into a kt.info.KtPluginInfo."""
-
-plugins = struct(
- kt_jvm_plugin_aspect = kt_jvm_plugin_aspect,
- merge_plugin_infos = _merge_plugin_infos,
-)
diff --git a/kotlin/internal/repositories/repositories.bzl b/kotlin/internal/repositories/repositories.bzl
index 0599d7a..4a5e6c2 100644
--- a/kotlin/internal/repositories/repositories.bzl
+++ b/kotlin/internal/repositories/repositories.bzl
@@ -14,10 +14,24 @@
"""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_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(
+ "@bazel_tools//tools/build_defs/repo:http.bzl",
+ _http_archive = "http_archive",
+ _http_file = "http_file",
+)
+load(
+ "//kotlin/internal:defs.bzl",
+ _KT_COMPILER_REPO = "KT_COMPILER_REPO",
+)
+load(
+ "//kotlin/internal/repositories:compiler_releases.bzl",
+ _KOTLIN_COMPILER_RELEASES = "KOTLIN_COMPILER_RELEASES",
+ _KOTLIN_CURRENT_RELEASE = "KOTLIN_CURRENT_RELEASE",
+)
+load(
+ "//third_party/jvm:workspace.bzl",
+ _maven_dependencies = "maven_dependencies",
+)
_BAZEL_JAVA_LAUNCHER_VERSION = "0.8.1"
@@ -45,12 +59,12 @@
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))
+ fail('"%s" not a valid kotlin release, current release is "%s"' % (kotlin_release_version, _KOTLIN_CURRENT_RELEASE))
_http_archive(
- name = KT_COMPILER_REPO,
+ name = _KT_COMPILER_REPO,
url = release["url"],
sha256 = release["sha256"],
build_file = "@io_bazel_rules_kotlin//kotlin/internal/repositories:BUILD.com_github_jetbrains_kotlin",
@@ -67,7 +81,7 @@
)
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 0d883bc..a22cba6 100644
--- a/kotlin/internal/toolchains.bzl
+++ b/kotlin/internal/toolchains.bzl
@@ -13,10 +13,6 @@
# limitations under the License.
load(
- "//kotlin/internal/common:common.bzl",
- _common = "common",
-)
-load(
"//kotlin/internal:defs.bzl",
_KT_COMPILER_REPO = "KT_COMPILER_REPO",
_KtJsInfo = "KtJsInfo",
@@ -48,7 +44,6 @@
def _kotlin_toolchain_impl(ctx):
toolchain = dict(
- label = _common.restore_label(ctx.label),
language_version = ctx.attr.language_version,
api_version = ctx.attr.api_version,
coroutines = ctx.attr.coroutines,
@@ -67,7 +62,7 @@
platform_common.ToolchainInfo(**toolchain),
]
-kt_toolchain = rule(
+_kt_toolchain = rule(
doc = """The kotlin toolchain. This should not be created directly `define_kt_toolchain` should be used. The
rules themselves define the toolchain using that macro.""",
attrs = {
@@ -157,7 +152,7 @@
)
def kt_register_toolchains():
- """This macro registers all of the default toolchains."""
+ """This macro registers the kotlin toolchain."""
native.register_toolchains("@io_bazel_rules_kotlin//kotlin/internal:default_toolchain")
def define_kt_toolchain(
@@ -165,19 +160,24 @@
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.
- """
+ coroutines = None):
+ """Define the Kotlin toolchain."""
impl_name = name + "_impl"
- kt_toolchain(
+ _kt_toolchain(
name = impl_name,
language_version = language_version,
api_version = api_version,
jvm_target = jvm_target,
coroutines = coroutines,
- debug = debug,
+ debug =
+ select({
+ "//kotlin/internal:builder_debug_trace": ["trace"],
+ "//conditions:default": [],
+ }) +
+ select({
+ "//kotlin/internal:builder_debug_timings": ["timings"],
+ "//conditions:default": [],
+ }),
visibility = ["//visibility:public"],
)
native.toolchain(
diff --git a/kotlin/internal/common/BUILD b/kotlin/internal/utils/BUILD
similarity index 100%
rename from kotlin/internal/common/BUILD
rename to kotlin/internal/utils/BUILD
diff --git a/kotlin/internal/common/common.bzl b/kotlin/internal/utils/utils.bzl
similarity index 75%
rename from kotlin/internal/common/common.bzl
rename to kotlin/internal/utils/utils.bzl
index 6f8f30e..77050a0 100644
--- a/kotlin/internal/common/common.bzl
+++ b/kotlin/internal/utils/utils.bzl
@@ -1,18 +1,26 @@
-load("//kotlin/internal:defs.bzl", _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE")
+load(
+ "//kotlin/internal:defs.bzl",
+ _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
+)
def _restore_label(l):
+ """Restore a label struct to a canonical label string."""
lbl = l.workspace_root
if lbl.startswith("external/"):
lbl = lbl.replace("external/", "@")
return lbl + "//" + l.package + ":" + l.name
+# TODO unexport this once init builder args can take care of friends.
def _derive_module_name(ctx):
+ """Gets the `module_name` attribute if it's set in the ctx, otherwise derive a unique module name using the elements
+ found in the label."""
module_name = getattr(ctx.attr, "module_name", "")
if module_name == "":
module_name = (ctx.label.package.lstrip("/").replace("/", "_") + "-" + ctx.label.name.replace("/", "_"))
return module_name
def _init_builder_args(ctx, rule_kind, module_name):
+ """Initialize an arg object for a task that will be executed by the Kotlin Builder."""
toolchain = ctx.toolchains[_TOOLCHAIN_TYPE]
args = ctx.actions.args()
@@ -38,12 +46,8 @@
return args
-def _declare_output_directory(ctx, aspect, dir_name):
- return ctx.actions.declare_directory("_kotlinc/%s_%s/%s_%s" % (ctx.label.name, aspect, ctx.label.name, dir_name))
-
-common = struct(
+utils = struct(
init_args = _init_builder_args,
- declare_output_directory = _declare_output_directory,
restore_label = _restore_label,
derive_module_name = _derive_module_name,
)
diff --git a/kotlin/kotlin.bzl b/kotlin/kotlin.bzl
index 77eb8c4..09158d0 100644
--- a/kotlin/kotlin.bzl
+++ b/kotlin/kotlin.bzl
@@ -11,8 +11,14 @@
# 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/repositories:repositories.bzl", "kotlin_repositories")
-load("//kotlin/internal:toolchains.bzl", "kt_register_toolchains")
+load(
+ "//kotlin/internal/repositories:repositories.bzl",
+ "kotlin_repositories",
+)
+load(
+ "//kotlin/internal:toolchains.bzl",
+ "kt_register_toolchains",
+)
load(
"//kotlin/internal/jvm:jvm.bzl",
"kt_jvm_binary",