Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .ci/docker/common/install_linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
# NB: Install all linter dependencies, the caching of lintrunner init could be
# done after Executorch becomes public
pip_install -r requirements-lintrunner.txt

# Install google-java-format
curl -L --retry 3 --retry-all-errors https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format_linux-x86-64 > /opt/google-java-format
chmod +x /opt/google-java-format
46 changes: 0 additions & 46 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,49 +125,3 @@ jobs:
uses: ./.github/workflows/_link_check.yml
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

android-java-format:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Check Java formatting
run: |
GOOGLE_JAVA_FORMAT_VERSION="1.24.0"
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" \
-o /tmp/google-java-format.jar

FILES_NEEDS_FORMAT=$(find extension/android/executorch_android/src/main/java/org/pytorch/executorch \
extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm \
extension/android/executorch_android/src/main/java/org/pytorch/executorch/annotations \
extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch \
extension/benchmark/android/benchmark/app/src/main/java/org/pytorch/minibench \
extension/benchmark/android/benchmark/app/src/androidTest/java/org/pytorch/minibench \
-type f -name "*.java" 2>/dev/null | \
xargs -r java -jar /tmp/google-java-format.jar -n)

if [ -n "$FILES_NEEDS_FORMAT" ]; then
echo "Warning: The following files need formatting:"
echo "$FILES_NEEDS_FORMAT"
echo ""
echo "Please use google-java-format from https://github.com/google/google-java-format/releases/"
echo ""
echo "To fix, run one of these commands:"
echo " # Using xargs (recommended):"
echo " find <paths> -type f -name '*.java' | xargs google-java-format -i"
echo ""
echo " # Or format specific files:"
echo "$FILES_NEEDS_FORMAT" | while IFS= read -r file; do
echo " google-java-format -i \"$file\""
done
exit 1
fi
Loading