-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add option to configure via semverGit {} block #28
base: master
Are you sure you want to change the base?
Conversation
This allows for applying the plugin in the new `plugins {}` DSL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
result.getOutput().contains("Version: 2.0.0-new_-NEW_DIRTYsnapshot") | ||
|
||
where: | ||
config = """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I noticed that too 😆 I experimented with a few alternatives, none of which really turned out any better:
-
Parameterize over the config
Map
instead 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 andsetupPluginWithClasspath
can "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
configType
argument (an invariant across all of the tests) gets mingled in with the configMap
argument (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
setupPluginWithClasspath
function itself instead of its argument.- This allows the config
Map
to 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.