Skip to content

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

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

Support for google-java-format's style option (AOSP style)#193
nedtwigg merged 2 commits intodiffplug:masterfrom
ohorn:google-java-format-aosp

Conversation

@ohorn
Copy link
Copy Markdown
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
Copy Markdown
Member

nedtwigg commented Feb 1, 2018

@jbduncan
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants