Skip to content

Commit 1a34456

Browse files
authored
chore: exclude firestore and spanner samples from formatting (#1295)
* chore: exclude firestore and spanner samples from formatting * chore: remove comment * chore: create a temporary file * chore: fix command
1 parent 6b5cee7 commit 1a34456

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docker/owlbot/java/bin/format_source.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,22 @@ set -e
1717

1818
# Find all the java files relative to the current directory and format them
1919
# using google-java-format
20-
find . -name '*.java' | xargs java -jar /owlbot/google-java-format.jar --replace
20+
list="$(find . -name '*.java' )"
21+
tmpfile=$(mktemp)
22+
23+
for file in $list;
24+
do
25+
if [[ "$file" =~ ".*/samples/snippets/src/main/java/com/example/firestore/Quickstart.java" ]];
26+
then
27+
echo "File skipped formatting: $file"
28+
elif [[ "$file" =~ ".*/samples/snippets/src/main/java/com/example/spanner/.*.java" ]];
29+
then
30+
echo "File skipped formatting: $file"
31+
else
32+
echo $file >> $tmpfile
33+
fi
34+
done
35+
36+
cat $tmpfile | xargs java -jar /owlbot/google-java-format.jar --replace
37+
38+
rm $tmpfile

0 commit comments

Comments
 (0)