Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move declare_executable to phase file #919

Merged
merged 1 commit into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions scala/private/phases/phase_declare_executable.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 2 additions & 8 deletions scala/private/rule_impls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,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)
Expand Down Expand Up @@ -732,12 +732,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 = []

Expand Down Expand Up @@ -885,5 +879,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 == ";"