Skip to content
Merged
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
16 changes: 13 additions & 3 deletions private/rules/coursier.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def _java_path(repository_ctx):

# Generate the base `coursier` command depending on the OS, JAVA_HOME or the
# location of `java`.
def _generate_java_jar_command(repository_ctx, jar_path):
def _generate_java_jar_command_for_coursier(repository_ctx, jar_path):
coursier_opts = repository_ctx.os.environ.get("COURSIER_OPTS", "")
coursier_opts = coursier_opts.split(" ") if len(coursier_opts) > 0 else []

Expand All @@ -314,6 +314,16 @@ def _generate_java_jar_command(repository_ctx, jar_path):

return cmd

def _generate_java_jar_command(repository_ctx, jar_path):
java_path = _java_path(repository_ctx)

if java_path != None:
cmd = [java_path, "-jar"] + _get_java_proxy_args(repository_ctx) + [jar_path]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure -noverify is still needed as it has been deprecated since Java 13.

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We're an old project, so it's likely this is left over from the early days. However, we do want to continue to support Java 11 onwards, so we should only remove this flag if it won't compromise our ability to run there.

else:
cmd = [jar_path] + ["-J%s" % arg for arg in _get_java_proxy_args(repository_ctx)]

return cmd

# Extract the well-known environment variables http_proxy, https_proxy and
# no_proxy and convert them to java.net-compatible property arguments.
def _get_java_proxy_args(repository_ctx):
Expand Down Expand Up @@ -999,7 +1009,7 @@ def make_coursier_dep_tree(
"--" +
":".join([e["group"], e["artifact"]]))

cmd = _generate_java_jar_command(repository_ctx, repository_ctx.path("coursier"))
cmd = _generate_java_jar_command_for_coursier(repository_ctx, repository_ctx.path("coursier"))
cmd.extend(["fetch"])

cmd.extend(artifact_coordinates)
Expand Down Expand Up @@ -1191,7 +1201,7 @@ def _coursier_fetch_impl(repository_ctx):
repository_ctx.download(coursier_download_urls, "coursier", sha256 = COURSIER_CLI_SHA256, executable = True)

# Try running coursier once
cmd = _generate_java_jar_command(repository_ctx, repository_ctx.path("coursier"))
cmd = _generate_java_jar_command_for_coursier(repository_ctx, repository_ctx.path("coursier"))

# Add --help because calling the default coursier command on Windows will
# hang waiting for input
Expand Down