Skip to content

Commit 6c16cff

Browse files
borkaehwittaiz
authored andcommitted
Move declare_executable to phase file (#919)
1 parent 358ab82 commit 6c16cff

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

scala/private/phases/phase_declare_executable.bzl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
#
66
load(
77
"@io_bazel_rules_scala//scala/private:rule_impls.bzl",
8-
"declare_executable",
8+
"is_windows",
99
)
1010

1111
def phase_declare_executable(ctx, p):
12-
return declare_executable(ctx)
12+
if (is_windows(ctx)):
13+
return ctx.actions.declare_file("%s.exe" % ctx.label.name)
14+
else:
15+
return ctx.actions.declare_file(ctx.label.name)

scala/private/rule_impls.bzl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def _jar_path_based_on_java_bin(ctx):
634634
return jar_path
635635

636636
def write_executable(ctx, executable, rjars, main_class, jvm_flags, wrapper, use_jacoco):
637-
if (_is_windows(ctx)):
637+
if (is_windows(ctx)):
638638
return write_executable_windows(ctx, executable, rjars, main_class, jvm_flags, wrapper, use_jacoco)
639639
else:
640640
return write_executable_non_windows(ctx, executable, rjars, main_class, jvm_flags, wrapper, use_jacoco)
@@ -732,12 +732,6 @@ def write_executable_non_windows(ctx, executable, rjars, main_class, jvm_flags,
732732
)
733733
return []
734734

735-
def declare_executable(ctx):
736-
if (_is_windows(ctx)):
737-
return ctx.actions.declare_file("%s.exe" % ctx.label.name)
738-
else:
739-
return ctx.actions.declare_file(ctx.label.name)
740-
741735
def _collect_runtime_jars(dep_targets):
742736
runtime_jars = []
743737

@@ -885,5 +879,5 @@ def _jacoco_offline_instrument(ctx, input_jar):
885879
def _jacoco_offline_instrument_format_each(in_out_pair):
886880
return (["%s=%s" % (in_out_pair[0].path, in_out_pair[1].path)])
887881

888-
def _is_windows(ctx):
882+
def is_windows(ctx):
889883
return ctx.configuration.host_path_separator == ";"

0 commit comments

Comments
 (0)