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

Support for google-java-format's style option (AOSP style) #193

Merged
merged 2 commits into from
Feb 5, 2018

Conversation

ohorn
Copy link
Contributor

@ohorn ohorn commented Jan 31, 2018

The google-java-format CLI exposes an option --aosp to switch from the default Google Java Style to AOSP-compliant style (4-space indentation). Such a configuration option is missing from Spotless.

This PR adds a corresponding configuration option to Spotloss:

spotless {
  java {
    googleJavaFormat().aosp()
  }
}

Internally, google-java-format implements the style option as an enum class. Therefore, I've added a second, more general configuration option to switch to any possible enum value. However, as of version 1.5, the only values are GOOGLE (default) and AOSP.

spotless {
  java {
    googleJavaFormat('1.5').style('AOSP')
  }
}

Added configuration option to switch the style of the
googleJavaFormat step.
@nedtwigg
Copy link
Member

nedtwigg commented Feb 1, 2018

Fantastic, thanks very much @ohorn! Do you mind adding a bullet to https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md and https://github.com/diffplug/spotless/blob/master/CHANGES.md

I'll release this by Monday, if that's alright for your schedule.

@jbduncan
Copy link
Member

jbduncan commented Feb 1, 2018

I don't really have anything else to add here; this PR looks pretty durn good to me! Thank you very much from me as well @ohorn. :)

@ohorn
Copy link
Contributor Author

ohorn commented Feb 3, 2018

Thank you. I've added some remarks to the CHANGES.md files. Please change if it doesn't fit.

@nedtwigg nedtwigg merged commit cc595b6 into diffplug:master Feb 5, 2018
@nedtwigg
Copy link
Member

nedtwigg commented Feb 6, 2018

Published in libs 1.10.0 and plugin-gradle 3.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants