Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions kotlin/internal/lint/ktlint_fix.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ PATH=\"$(dirname "{binjava}"):$PATH\" "$TOOL" {args} $SRCS
executable = ctx.executable._ktlint_tool.path,
args = " ".join(args),
srcs = " ".join([src.path for src in ctx.files.srcs]),
binjava = ctx.attr._java[java_common.JavaRuntimeInfo].java_executable_runfiles_path,
binjava = ctx.toolchains["@bazel_tools//tools/jdk:runtime_toolchain_type"].java_runtime.java_executable_runfiles_path,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

content = ctx.expand_location(content, [ctx.attr._ktlint_tool])
Expand All @@ -109,10 +109,11 @@ PATH=\"$(dirname "{binjava}"):$PATH\" "$TOOL" {args} $SRCS
is_executable = True,
)

files = [ctx.executable._ktlint_tool] + ctx.files._java
files = [ctx.executable._ktlint_tool]
transitive_files = ctx.toolchains["@bazel_tools//tools/jdk:runtime_toolchain_type"].java_runtime.files
if editorconfig:
files.append(editorconfig)
runfiles = ctx.runfiles(files = files)
runfiles = ctx.runfiles(files = files, transitive_files = transitive_files)

return [
DefaultInfo(
Expand Down Expand Up @@ -141,10 +142,10 @@ ktlint_fix = rule(
executable = True,
cfg = "target",
),
"_java": attr.label(
default = "@bazel_tools//tools/jdk:current_java_runtime",
),
},
toolchains = [
"@bazel_tools//tools/jdk:runtime_toolchain_type",
],
executable = True,
doc = "Lint Kotlin files and automatically fix them as needed",
)