Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add formatting checks to Travis-CI #17

Merged
merged 2 commits into from
Jan 24, 2017

Conversation

kruton
Copy link
Contributor

@kruton kruton commented Dec 23, 2016

This mirrors what the Android source tree used to have as presubmit
checks. It uses clang-format for formatting C++ and Java files, but
google-java-format for checking for unused imports and import ordering.

@@ -59,6 +71,8 @@ android:
- 'android-sdk-license-.+'

script:
- git rev-list $(git merge-base HEAD origin/master)..HEAD | xargs -i git clang-format --binary=$(which clang-format-3.8) --style=file {} && git diff --exit-code || { git reset --hard; false; }
- git rev-list $(git merge-base HEAD origin/master)..HEAD | xargs -i git diff-tree --no-commit-id --name-only -r {} | grep -E '\.java$' | xargs -r git ls-files | xargs -r java -jar $HOME/gjf.jar -a -i --fix-imports-only && git diff --exit-code || { git reset --hard; false; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it should logically work, but I got some weird results when I didn't have this rebased.

@kruton kruton closed this Jan 24, 2017
@kruton kruton reopened this Jan 24, 2017
@kruton kruton force-pushed the travis-ci-clang-format branch from 7707e0e to ee3b7ff Compare January 24, 2017 05:22
This mirrors what the Android source tree used to have as presubmit
checks. It uses clang-format for formatting C++ and Java files, but
google-java-format for checking for unused imports and import ordering.
@kruton kruton force-pushed the travis-ci-clang-format branch from ee3b7ff to 4b58bfc Compare January 24, 2017 05:23
@kruton kruton merged commit de27878 into google:master Jan 24, 2017
@kruton kruton deleted the travis-ci-clang-format branch January 24, 2017 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants