spotless: Break into spotless-lib (reusable for other projects) and spotless-gradle

Spotless now has quite a few utilities for mass string manipulation which are useful outside of a gradle plugin:

  • ensuring idempotency, and working around it when there are bugs
  • writing functions in an easy-to-serialize way

If we break the core functionality into spotless-lib, that would allow spotless-maven, etc. It would also speed up the spotless test suite by relying less on the excellent but slow gradle testkit. Going to explore this in the spotless-lib branch.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

Looks perfect as-is. The gradle integration test is prrroobably overkill for future rules that get added when there’s a nice test in lib, but it’s nice to have a few end-to-end checks in the test suite. Well done!

@nedtwigg The bullet points in your last message have now been dealt with by yours truly. 😃

The tests have yet to be migrated, so that’s our next step.

Does 15 hours count as a few? Sorry for delay, had a lot on my plate today.

Haha, no worries! I happened to be asleep during most of those 15 hours, so it definitely counts as only “a few” in my book. 😃

Introduced testlib in 1fd857e, and moved lots of stuff out of gradle-plugin and into lib.

Cool stuff.

Should all have their implementations in lib. A lot of tests in plugin-gradle also belong in lib - basically everything that isn’t a subclass of GradleIntegrationTest.

Okay.

Just wanted to warn you that things are getting busy for me again, so I don’t know when I’ll be able to tackle any of the bullet points above (or indeed the rest of the seemingly never-ending deluge of tasks we need to finish up before shipping 3.x!)

So let’s tackle everything one step at a time and at our own pace. 😃

Does 15 hours count as a few? Sorry for delay, had a lot on my plate today. Probably won’t be able to write code for this for the rest of the week, but I think we’ve now got the final structure. I’ll start migrating artifacts into jcenter to get ready for putting them into mavenCentral.

Introduced testlib in 1fd857ee485ab06fe7cb14a3db00ba1af59cea9d, and moved lots of stuff out of gradle-plugin and into lib.

I think everything is now where it belongs, except:

  • FormatExtension.customReplace
  • FormatExtension.customReplaceRegex
  • FormatExtension.trimTrailingWhitespace

Should all have their implementations in lib. A lot of tests in plugin-gradle also belong in lib - basically everything that isn’t a subclass of GradleIntegrationTest.

They’re about moving all FormatterStep from plugin-gradle to lib, so that the they can be reused in other plugins. Hope you feel better soon 😃