Skip to content

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

Merged
nedtwigg merged 2 commits into
diffplug:masterfrom
ohorn:google-java-format-aosp
Feb 5, 2018
Merged

nedtwigg merged 2 commits into
diffplug:masterfrom
ohorn:google-java-format-aosp

Conversation

@ohorn

@ohorn ohorn commented Jan 31, 2018

Copy link
Copy Markdown
Contributor

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

nedtwigg commented Feb 1, 2018

Copy link
Copy Markdown
Member

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

jbduncan commented Feb 1, 2018 •

Copy link
Copy Markdown
Member

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

ohorn commented Feb 3, 2018

Copy link
Copy Markdown
Contributor Author

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

nedtwigg commented Feb 6, 2018

Copy link
Copy Markdown
Member

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.

3 participants