Skip to content

Commit

Permalink
Update toolchain config to allow reflective access to `com.sun.tools.…
Browse files Browse the repository at this point in the history
…javac.parser`

Reported here: google/error-prone#2271 (comment)

PiperOrigin-RevId: 423272568
  • Loading branch information
cushon authored and copybara-github committed Jan 21, 2022
1 parent ce1a5d0 commit 43c7b97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/main/starlark/builtins_bzl/common/cc/semantics.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def _get_loose_mode_in_hdrs_check_allowed_attr():

def _get_def_parser():
return attr.label(
default = "@bazel_tools//tools/def_parser:def_parser",
allow_single_file = True,
cfg = "exec",
default = "@bazel_tools//tools/def_parser:def_parser",
allow_single_file = True,
cfg = "exec",
)

semantics = struct(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def _get_coverage_runner(ctx):
if not runner:
fail("jacocorunner not set in java_toolchain")
runner_jar = runner.executable

# wrap the jar in JavaInfo so we can add it to deps for java_common.compile()
return JavaInfo(output_jar = runner_jar, compile_jar = runner_jar)

Expand Down
16 changes: 8 additions & 8 deletions src/main/starlark/builtins_bzl/common/proto/proto_semantics.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Proto Semantics
"""

def _preprocess(ctx):
pass
pass

semantics = struct(
PROTO_COMPILER_LABEL = "@com_google_protobuf//:protoc",
EXTRA_ATTRIBUTES = {
"import_prefix": attr.string(),
},
EXTRA_FRAGMENTS = [],
preprocess = _preprocess,
PROTO_COMPILER_LABEL = "@com_google_protobuf//:protoc",
EXTRA_ATTRIBUTES = {
"import_prefix": attr.string(),
},
EXTRA_FRAGMENTS = [],
preprocess = _preprocess,
# This constant is used in ProtoCompileActionBuilder to generate an error message that's
# displayed when a strict proto deps violation occurs.
#
Expand All @@ -36,4 +36,4 @@ semantics = struct(
"--direct_dependencies_violation_msg=" +
"%%s is imported, but %s doesn't directly depend on a proto_library that 'srcs' it."
),
)
)
2 changes: 1 addition & 1 deletion tools/jdk/default_java_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ BASE_JDK9_JVM_OPTS = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",

# quiet warnings from com.google.protobuf.UnsafeUtil,
# see: https://github.com/google/protobuf/issues/3781
Expand Down

0 comments on commit 43c7b97

Please sign in to comment.