Add option to configure via semverGit {} block#28
Add option to configure via semverGit {} block#28emlun wants to merge 6 commits intoNasdaq:masterfrom
Conversation
This allows for applying the plugin in the new `plugins {}` DSL.
deepy
left a comment
There was a problem hiding this comment.
I'll see if I can find something else later, but so far this looks great, just some minor things 👍
| this.extension.dirtyMarker.getOrNull(), | ||
| this.extension.gitDescribeArgs.getOrNull(), | ||
| this.extension.prefix.getOrNull(), | ||
| this.project.projectDir |
There was a problem hiding this comment.
Since the Project is only used for projectDir can we remove project entirely?
Makes it a little easier to reason about and also doesn't prevent additional blocks for configuration-cache compatibility
| result.getOutput().contains("Version: 2.0.0-new_-NEW_DIRTYsnapshot") | ||
|
|
||
| where: | ||
| config = """ |
There was a problem hiding this comment.
I like this clever use of where, unfortunately this also affects the test name giving this test the name: semverGit {} block overrides project.ext settings [config: plugins { id "com.cinnober.gradle.semver-git" apply false } ext.nextVersion = 'minor' ext.snapshotSuffix = 'LEGACYSNAPSHOT' ext.dirtyMarker = '-legacydirty' ext.gitDescribeArgs = '--match *[0-9].abc.[0-9]*.def.[0-9]*' ext.semverPrefix = 'legacy-version-' apply plugin: 'com.cinnober.gradle.semver-git' semverGit { nextVersion = 'major' snapshotSuffix = 'new_<dirty>snapshot' dirtyMarker = '-NEW_DIRTY' gitDescribeArgs = '--match *[0-9].[0-9]*.[0-9]* --long' prefix = 'new-version-' } , #0] in tools and reports 😀
There was a problem hiding this comment.
Yes, I noticed that too 😆 I experimented with a few alternatives, none of which really turned out any better:
-
Parameterize over the config
Mapinstead of the expanded config file contents- This also requires an additional parameter to select which kind of config to generate. It can be embedded into the same
configs()return value andsetupPluginWithClasspathcan "dynamic dispatch" on it, but the resulting test names aren't that much better. Doesn't seem worth the increased source code noise.
- This also requires an additional parameter to select which kind of config to generate. It can be embedded into the same
-
Parameterize over
configType << ["legacy", "extension"]instead of the configMap.- This works well enough, but then the
configTypeargument (an invariant across all of the tests) gets mingled in with the configMapargument (varies between tests), which entangles two orthogonal concerns. Doesn't seem worth the reduced code clarity.
- This works well enough, but then the
-
Parameterize over the
setupPluginWithClasspathfunction itself instead of its argument.- This allows the config
Mapto stay in thewhen:block instead (nice!), but makes the test names entirely incomprehensible (they show a closure type instead of the config contents).
- This allows the config
|
Alright, I found the corner-case. It's in this project's build-script 😁 Could you do this change and at the same time use After that it looks good enough to be merged, I'll have to chase some people to actually get it released though so that might take some extra time |
This allows the plugin to be applied with the new
plugins {}DSL.Fixes #3. Alleviates #14. Fixes #26.