Skip to content

Commit

Permalink
Reduce output from scalafmt, and lower reflective access option thr…
Browse files Browse the repository at this point in the history
…eshold for Google Java Format. (pantsbuild#14109)

Fixes pantsbuild#13951, and silences output from `scalafmt` like:
```
Reformatting...
Reformatting... (1.39 %, 20 / 1443)

Reformatting... (6.72 %, 97 / 1443)

...
```
... which is only useful when rendered as streaming.

[ci skip-rust]
[ci skip-build-wheels]
  • Loading branch information
stuhood authored Jan 7, 2022
1 parent 86ee38b commit 3b1974c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ async def setup_google_java_format(
toolcp_relpath: tool_classpath.digest,
}

maybe_java16_or_higher_options = []
if jdk_setup.jre_major_version >= 16:
maybe_java16_or_higher_options = [
maybe_java11_or_higher_options = []
if jdk_setup.jre_major_version >= 11:
maybe_java11_or_higher_options = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
Expand All @@ -99,7 +99,7 @@ async def setup_google_java_format(

args = [
*jdk_setup.args(bash, tool_classpath.classpath_entries(toolcp_relpath)),
*maybe_java16_or_higher_options,
*maybe_java11_or_higher_options,
"com.google.googlejavaformat.java.Main",
*(["--aosp"] if tool.aosp else []),
"--dry-run" if setup_request.check_only else "--replace",
Expand Down
2 changes: 2 additions & 0 deletions src/python/pants/backend/scala/lint/scalafmt/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ async def setup_scalafmt_partition(
]
if request.check_only:
args.append("--list")
else:
args.append("--quiet")
args.extend(request.files)

process = Process(
Expand Down

0 comments on commit 3b1974c

Please sign in to comment.