Skip to content

Commit

Permalink
Replace deprecated cmd_helper.join_paths
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 561048003
Change-Id: I13286a820aec76a57a5fada7612b50c2349ad066
  • Loading branch information
mai93 authored and copybara-github committed Aug 29, 2023
1 parent 9e7aa13 commit 9721922
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tools/build_rules/java_rules_skylark.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ ready.

_JarsInfo = provider(fields = ["compile_time_jars", "runtime_jars"])

def _join_paths(separator, files):
"""Joins the paths of the files separated by the given separator.
Args:
separator: string to separate the files paths
files: list of files to join their paths
"""
return separator.join([f.path for f in files])

def _java_library_impl(ctx):
javac_options = ctx.fragments.java.default_javac_flags
class_jar = ctx.outputs.class_jar
Expand Down Expand Up @@ -48,7 +57,7 @@ def _java_library_impl(ctx):
sources_param_file = ctx.actions.declare_file(class_jar.basename + "-2.params")
ctx.actions.write(
output = sources_param_file,
content = cmd_helper.join_paths("\n", depset(sources)),
content = _join_paths("\n", sources),
is_executable = False,
)

Expand All @@ -69,7 +78,7 @@ def _java_library_impl(ctx):
cmd += "%s/bin/javac" % java_runtime.java_home
cmd += " " + " ".join(javac_options)
if compile_time_jars:
cmd += " -classpath '" + cmd_helper.join_paths(ctx.configuration.host_path_separator, compile_time_jars) + "'"
cmd += " -classpath '" + _join_paths(ctx.configuration.host_path_separator, compile_time_jars_list) + "'"
cmd += " -d " + build_output + files + "\n"

# We haven't got a good story for where these should end up, so
Expand Down

0 comments on commit 9721922

Please sign in to comment.