@@ -125,49 +125,3 @@ jobs:
125125 uses : ./.github/workflows/_link_check.yml
126126 with :
127127 ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
128-
129- android-java-format :
130- runs-on : ubuntu-latest
131- permissions :
132- contents : read
133- steps :
134- - uses : actions/checkout@v4
135- with :
136- ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
137-
138- - uses : actions/setup-java@v4
139- with :
140- distribution : ' temurin'
141- java-version : ' 17'
142-
143- - name : Check Java formatting
144- run : |
145- GOOGLE_JAVA_FORMAT_VERSION="1.24.0"
146- curl -sSfL "https://github.com/google/google-java-format/releases/download/v${GOOGLE_JAVA_FORMAT_VERSION}/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar" \
147- -o /tmp/google-java-format.jar
148-
149- FILES_NEEDS_FORMAT=$(find extension/android/executorch_android/src/main/java/org/pytorch/executorch \
150- extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm \
151- extension/android/executorch_android/src/main/java/org/pytorch/executorch/annotations \
152- extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch \
153- extension/benchmark/android/benchmark/app/src/main/java/org/pytorch/minibench \
154- extension/benchmark/android/benchmark/app/src/androidTest/java/org/pytorch/minibench \
155- -type f -name "*.java" 2>/dev/null | \
156- xargs -r java -jar /tmp/google-java-format.jar -n)
157-
158- if [ -n "$FILES_NEEDS_FORMAT" ]; then
159- echo "Warning: The following files need formatting:"
160- echo "$FILES_NEEDS_FORMAT"
161- echo ""
162- echo "Please use google-java-format from https://github.com/google/google-java-format/releases/"
163- echo ""
164- echo "To fix, run one of these commands:"
165- echo " # Using xargs (recommended):"
166- echo " find <paths> -type f -name '*.java' | xargs google-java-format -i"
167- echo ""
168- echo " # Or format specific files:"
169- echo "$FILES_NEEDS_FORMAT" | while IFS= read -r file; do
170- echo " google-java-format -i \"$file\""
171- done
172- exit 1
173- fi
0 commit comments