corretto / amazon-corretto-crypto-provider

The Amazon Corretto Crypto Provider is a collection of high-performance cryptographic implementations exposed via standard JCA/JCE interfaces.
Apache License 2.0
238 stars 56 forks source link

Setup Automated Code Formatting with Spotless #287

Closed geedo0 closed 1 year ago

geedo0 commented 1 year ago

Description of changes: Spotless is a Gradle plugin that enforces style checking and automates remediation of any violations. This replaces our existing Checkstyle integration which has not been kept up and did not do any build-time enforcement of the rule-set.

I've configured it to check our Java source against the Google Java Format and apply our license header consistently. In the future we can integrate with the clang-format extension to handle the C++ source.

After this gets merged, you'll notice a few changes to our Gradle build. First and foremost, style violations will fail the build either locally or in our CI builds if it gets up to the PR. The build failure will prompt the user to run ./gradlew spotlessApply. Running that target will apply any style changes needed to pass the check phase of the build and we can all move along after it gets committed.

Note to reviewers: All changes under src/tst are automatically applied by the code formatter. The actual meat of this review are the changes to the build scripts.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

amirhosv commented 1 year ago

It would be great to add the information in the description of this PR to DEVELOPMENT-GUIDE.md.

geedo0 commented 1 year ago

There are some conflicts with main that needs to be resolved.

Latest revision is an interactive rebase with a clean re-application of the formatter.