diff --git a/scala/private/phases/phase_merge_jars.bzl b/scala/private/phases/phase_merge_jars.bzl index 880c5bd4e..a8507a5f1 100644 --- a/scala/private/phases/phase_merge_jars.bzl +++ b/scala/private/phases/phase_merge_jars.bzl @@ -12,19 +12,27 @@ def phase_merge_jars(ctx, p): Use --compression to reduce size of deploy jars. """ deploy_jar = ctx.outputs.deploy_jar - jars_list = p.compile.rjars.to_list() + runtime_jars = p.compile.rjars main_class = getattr(ctx.attr, "main_class", "") progress_message = "Merging Scala jar: %s" % ctx.label - args = ["--compression", "--normalize", "--sources"] - args.extend([j.path for j in jars_list]) + args = ctx.actions.args() + args.add_all(["--compression", "--normalize", "--sources"]) + args.add_all(runtime_jars, map_each = _fileToPath) + if main_class: - args.extend(["--main_class", main_class]) - args.extend(["--output", deploy_jar.path]) + args.add_all(["--main_class", main_class]) + args.add_all(["--output", deploy_jar.path]) + + args.set_param_file_format("multiline") + args.use_param_file("@%s") ctx.actions.run( - inputs = jars_list, + inputs = runtime_jars, outputs = [deploy_jar], executable = ctx.executable._singlejar, mnemonic = "ScalaDeployJar", progress_message = progress_message, - arguments = args, + arguments = [args], ) + +def _fileToPath(file): + return file.path diff --git a/test/src/main/scala/scalarules/test/large_classpath/BUILD b/test/src/main/scala/scalarules/test/large_classpath/BUILD index e9f1415a5..4d8783082 100644 --- a/test/src/main/scala/scalarules/test/large_classpath/BUILD +++ b/test/src/main/scala/scalarules/test/large_classpath/BUILD @@ -1,4 +1,4 @@ -load("//scala:scala.bzl", "scala_binary") +load("//scala:scala.bzl", "scala_binary", "scala_library") load(":helper.bzl", "create_dependencies", "get_dependency_labels") scala_binary( @@ -8,12 +8,17 @@ scala_binary( unused_dependency_checker_mode = "off", visibility = ["//visibility:public"], deps = get_dependency_labels( - amount = 250, + amount = 1000, length = 20, ), ) +scala_library( + name = "triggerDeployJarCreation", + data = [":largeClasspath_deploy.jar"], +) + create_dependencies( - amount = 250, + amount = 1000, length = 20, )