Skip to content

Commit 26ea255

Browse files
authored
docs(owlbot-java): explaining why not using formatter in pom.xml (#1511)
Fixes #1502
1 parent 653c514 commit 26ea255

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

docker/owlbot/java/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# build from the root of this repo:
1616
FROM gcr.io/cloud-devrel-public-resources/java8
1717

18+
# The OwlBot Java postprocessor does not rely on project's Java formatter.
19+
# When you upgrade the formatter version, see the issue below for the required
20+
# changes:
21+
# https://github.com/googleapis/synthtool/issues/1502
1822
ARG JAVA_FORMAT_VERSION=1.7
1923

2024
RUN apt-get install -y --no-install-recommends jq

docker/owlbot/java/bin/format_source.sh

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
set -e
1717

18+
# Why OwlBot Java postprocessor does not use the formatter defined in pom.xml?
19+
# It's because the postprocessor runs in a privileged (albeit limited)
20+
# environment. We limit the risk of running somebody else's malicious Maven
21+
# plugin code in the environment.
22+
1823
# Find all the java files relative to the current directory and format them
1924
# using google-java-format
2025
list="$(find . -name '*.java' -not -path ".*/samples/snippets/generated/**/*" )"
@@ -33,6 +38,7 @@ do
3338
fi
3439
done
3540

41+
# This JAR file is downloaded by Dockerfile
3642
cat $tmpfile | xargs java -jar /owlbot/google-java-format.jar --replace
3743

3844
rm $tmpfile

0 commit comments

Comments
 (0)