diff --git a/scala/private/phases/phase_declare_executable.bzl b/scala/private/phases/phase_declare_executable.bzl index 53d0cdd50e..c7bce9a20e 100644 --- a/scala/private/phases/phase_declare_executable.bzl +++ b/scala/private/phases/phase_declare_executable.bzl @@ -5,8 +5,11 @@ # load( "@io_bazel_rules_scala//scala/private:rule_impls.bzl", - "declare_executable", + "is_windows", ) def phase_declare_executable(ctx, p): - return declare_executable(ctx) + if (is_windows(ctx)): + return ctx.actions.declare_file("%s.exe" % ctx.label.name) + else: + return ctx.actions.declare_file(ctx.label.name) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 7b0a4a8228..b8f58f8b6a 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -639,7 +639,7 @@ def _jar_path_based_on_java_bin(ctx): return jar_path def write_executable(ctx, executable, rjars, main_class, jvm_flags, wrapper, use_jacoco): - if (_is_windows(ctx)): + if (is_windows(ctx)): return write_executable_windows(ctx, executable, rjars, main_class, jvm_flags, wrapper, use_jacoco) else: return write_executable_non_windows(ctx, executable, rjars, main_class, jvm_flags, wrapper, use_jacoco) @@ -737,12 +737,6 @@ def write_executable_non_windows(ctx, executable, rjars, main_class, jvm_flags, ) return [] -def declare_executable(ctx): - if (_is_windows(ctx)): - return ctx.actions.declare_file("%s.exe" % ctx.label.name) - else: - return ctx.actions.declare_file(ctx.label.name) - def _collect_runtime_jars(dep_targets): runtime_jars = [] @@ -890,5 +884,5 @@ def _jacoco_offline_instrument(ctx, input_jar): def _jacoco_offline_instrument_format_each(in_out_pair): return (["%s=%s" % (in_out_pair[0].path, in_out_pair[1].path)]) -def _is_windows(ctx): +def is_windows(ctx): return ctx.configuration.host_path_separator == ";"