Skip to content

Commit

Permalink
[pigeon] added java linter tests for generated code (flutter#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke authored Mar 9, 2021
1 parent 7cc53c2 commit fb0b063
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/pigeon/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# exit when any command fails
set -ex

JAVA_LINTER=checkstyle-8.41-all.jar
JAVA_FORMATTER=google-java-format-1.3-all-deps.jar
GOOGLE_CHECKS=google_checks.xml

# TODO(blasten): Enable on stable when possible.
# https://github.com/flutter/flutter/issues/75187
if [[ "$CHANNEL" == "stable" ]]; then
Expand Down Expand Up @@ -76,6 +80,9 @@ test_pigeon_android() {
exit 1
fi

java -jar $JAVA_FORMATTER $temp_dir/Pigeon.java > $temp_dir/Pigeon.java
java -jar $JAVA_LINTER -c $GOOGLE_CHECKS $temp_dir/Pigeon.java

dartfmt -w $temp_dir/pigeon.dart
dartanalyzer $temp_dir/pigeon.dart --fatal-infos --fatal-warnings --packages ./e2e_tests/test_objc/.packages

Expand All @@ -98,11 +105,25 @@ test_null_safe_dart() {
rm -rf $temp_dir
}

###############################################################################
# Get java linter / formatter
###############################################################################
if [ ! -f "$JAVA_LINTER" ]; then
curl -L https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.41/$JAVA_LINTER > $JAVA_LINTER
fi
if [ ! -f "$JAVA_FORMATTER" ]; then
curl -L https://github.com/google/google-java-format/releases/download/google-java-format-1.3/$JAVA_FORMATTER > $JAVA_FORMATTER
fi
if [ ! -f "$GOOGLE_CHECKS" ]; then
curl -L https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/$GOOGLE_CHECKS > $GOOGLE_CHECKS
fi

###############################################################################
# Dart analysis and unit tests
###############################################################################
pub get
dartanalyzer bin lib
dart analyze bin
dart analyze lib
pub run test test/

###############################################################################
Expand Down

0 comments on commit fb0b063

Please sign in to comment.