Skip to content

Commit

Permalink
Avoid creating JPMS module jars for now
Browse files Browse the repository at this point in the history
As we move to using rules_jvm_external, we will encounter some hiccups
with modules provided by third parties. Skirt around that by disabling
JPMS module generation for now.
  • Loading branch information
shs96c committed Nov 12, 2019
1 parent ccc9a3b commit 2171634
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions java/private/maven_artifacts.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ def _maven_artifacts_impl(ctx):
info = target[MavenInfo]

# Merge together all the binary jars
temp_bin_jar = ctx.actions.declare_file("%s-temp.jar" % ctx.attr.name)
combine_jars(ctx, ctx.executable._singlejar, info.artifact_jars.to_list(), temp_bin_jar)
bin_jar = ctx.outputs.binjar
combine_jars(ctx, ctx.executable._singlejar, info.artifact_jars.to_list(), bin_jar)
src_jar = ctx.outputs.srcjar
combine_jars(ctx, ctx.executable._singlejar, info.source_jars.to_list(), src_jar)

# Now generate the module info
module_jar = ctx.actions.declare_file("%s-module.jar" % ctx.attr.name)

args = ctx.actions.args()
args.add_all(["--coordinates", ctx.attr.maven_coordinates])
args.add_all(["--in", temp_bin_jar.path])
args.add_all(["--out", module_jar.path])
if len(ctx.attr.module_uses_services) > 0:
args.add_all(ctx.attr.module_uses_services, before_each = "--uses")

paths = [file.path for file in target[GatheredJavaModuleInfo].module_jars.to_list()]
if len(paths) > 0:
args.add_all(["--module-path", ctx.host_configuration.host_path_separator.join(paths)])
if len(ctx.attr.module_exclude_patterns) > 0:
args.add_all(ctx.attr.module_exclude_patterns, before_each = "--exclude")

ctx.actions.run(
mnemonic = "BuildModuleJar",
inputs = [temp_bin_jar] + target[GatheredJavaModuleInfo].module_jars.to_list(),
outputs = [module_jar],
executable = ctx.executable._generate_module,
arguments = [args],
)

# Now merge the module info and the binary jars
combine_jars(ctx, ctx.executable._singlejar, [temp_bin_jar, module_jar], ctx.outputs.binjar)
# # Now generate the module info
# module_jar = ctx.actions.declare_file("%s-module.jar" % ctx.attr.name)
#
# args = ctx.actions.args()
# args.add_all(["--coordinates", ctx.attr.maven_coordinates])
# args.add_all(["--in", temp_bin_jar.path])
# args.add_all(["--out", module_jar.path])
# if len(ctx.attr.module_uses_services) > 0:
# args.add_all(ctx.attr.module_uses_services, before_each = "--uses")
#
# paths = [file.path for file in target[GatheredJavaModuleInfo].module_jars.to_list()]
# if len(paths) > 0:
# args.add_all(["--module-path", ctx.host_configuration.host_path_separator.join(paths)])
# if len(ctx.attr.module_exclude_patterns) > 0:
# args.add_all(ctx.attr.module_exclude_patterns, before_each = "--exclude")
#
# ctx.actions.run(
# mnemonic = "BuildModuleJar",
# inputs = [temp_bin_jar] + target[GatheredJavaModuleInfo].module_jars.to_list(),
# outputs = [module_jar],
# executable = ctx.executable._generate_module,
# arguments = [args],
# )
#
# # Now merge the module info and the binary jars
# combine_jars(ctx, ctx.executable._singlejar, [temp_bin_jar, module_jar], ctx.outputs.binjar)

defaultInfo = target[DefaultInfo]

Expand Down

0 comments on commit 2171634

Please sign in to comment.