Skip to content

Commit

Permalink
Generate open modules
Browse files Browse the repository at this point in the history
In reality, the modules need more tweaking than the options given
here. Rather than trying to make this configurable now, just generate
the modules as being open.
  • Loading branch information
shs96c committed Sep 4, 2019
1 parent e21ca05 commit 9b41d15
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
import static net.bytebuddy.jar.asm.Opcodes.ACC_MANDATED;
import static net.bytebuddy.jar.asm.Opcodes.ACC_MODULE;
import static net.bytebuddy.jar.asm.Opcodes.ACC_OPEN;
import static net.bytebuddy.jar.asm.Opcodes.ACC_TRANSITIVE;

public class ModuleGenerator {
Expand Down Expand Up @@ -218,7 +219,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
null,
null,
null);
ModuleVisitor moduleVisitor = classWriter.visitModule(moduleName, 0, null);
ModuleVisitor moduleVisitor = classWriter.visitModule(moduleName, ACC_OPEN, null);
moduleVisitor.visitRequire("java.base", ACC_MANDATED, null);

Predicate<String> excludePredicate = excludes.stream()
Expand Down
2 changes: 1 addition & 1 deletion java/private/module.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _has_java_module_deps(target, ctx):
# in offering java modules
tags = getattr(ctx.rule.attr, "tags", [])
coordinates = read_coordinates(tags)
if not len(coordinates) or "jpms:no-include" in tags:
if not len(coordinates) or "jpms:compile_only" in tags:
return [GatheredJavaModuleInfo(
module_jars = depset([], transitive = [transitive]),
)]
Expand Down
4 changes: 2 additions & 2 deletions third_party/java/guava/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ maven_java_import(
jar = "listenablefuture-1.0.jar",
srcjar = "listenablefuture-1.0-sources.jar",
tags = [
"jpms:no-include",
"jpms:compile_only",
]
)

Expand All @@ -31,6 +31,6 @@ maven_java_import(
jar = "failureaccess-1.0.1.jar",
srcjar = "failureaccess-1.0.1-sources.jar",
tags = [
"jpms:no-include",
"jpms:compile_only",
],
)

0 comments on commit 9b41d15

Please sign in to comment.