Skip to content
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 heuristic to determine the baseline version automatically #3

Closed
Flowdalic opened this issue Mar 3, 2015 · 7 comments
Closed

Add heuristic to determine the baseline version automatically #3

Flowdalic opened this issue Mar 3, 2015 · 7 comments

Comments

@Flowdalic
Copy link
Contributor

It would be great if the plugin would automatically determine the baseline version automatically, so that I don't have to change it manually between releases.

My project only guarantees API compatibility between patchlevel releases (1.2.1, 1.2.3. 1.2.42, ...), so a simply heuristic could look like

  1. Remove the snapshot qualifier, i.e. -SNAPSHOT-X
  2. Remove all release qualifiers, i.e. -alphaX, -betaX, -rcX, where X is an arbitrary number of digits
  3. If the patchlevel number is
    • 0, then don't run clirr because there is no previous release to test against
    • otherwise decrement the patchlevel by one and run clirr against that release
@aalmiray
Copy link
Owner

aalmiray commented Mar 3, 2015

Hmm removing -SNAPSHOTmay be tricky. as some projects jump from 1.0.0 to 1.1.0 between snapshots, that is, no patch level. Automatically removing -SNAPSHOT would attempt to compare 1.1.0-SNAPSHOT against 1.1.0 and that's wrong.

I wonder if a custom version resolution mechanism could be enabled, so that you may inject your own logic as long as baseline is not specified (but I believe is annotated with @input). Hmm, choices, choices.

@Flowdalic
Copy link
Contributor Author

Automatically removing -SNAPSHOT would attempt to compare 1.1.0-SNAPSHOT against 1.1.0 and that's wrong.

Nope, because if the patchlevel version is 0, clirr should not run at all (see step 3.)

@aalmiray
Copy link
Owner

aalmiray commented Mar 3, 2015

Correct. According to your particular project rules the patch level 0 would prevent clirr for running. However the rule would break on projects that do not follow the patch level rule, which is the case of Griffon. So far we haven't had the need to use the patch level as every release brings new features, so we bump the minor number and leave patch as 0.

Current version is set to 2.3.0-SNAPSHOT. Automatically removing the tag will attempt to compare it against 2.3.0 but it should be 2.2.0.

I'm not saying the idea is without merit, what I'm saying that some rules look to be more specific to the workflow of the projects that you work with. This workflow may not apply to other projects. I think we can come to a compromise and make everyone happy, wouldn't you agree?

@Flowdalic
Copy link
Contributor Author

I think is pretty "easy" to serve both use cases:

Common steps

  1. Remove the snapshot qualifier, i.e. -SNAPSHOT-X
  2. Remove all release qualifiers, i.e. -alphaX, -betaX, -rcX, where X is an arbitrary number of digits

Note: This basically comes down to "Only consider the triple of <majorVersion>.<minorVersion>.<patchlevelVersion> for further processing" and it may be a good idea to define "If one version component is missing, then assume it's value is 0".

Non-Semver (only API compatiblity between patchlevel releases):

  1. If the patchlevel number is
    • 0, then don't run clirr because there is no previous release to test against
    • otherwise decrement the patchlevel by one and run clirr against that release

Semver

  1. If the minor version is
    • 0, then check patchlevel version, if it is
      • 0, then don't run clirr
      • otherwise decrement patchlevel and run clirr with that as baseline
    • then check patchlevel, if it is
      • 0 then, decrement minor by one and run clirr with that as baseline
      • otherwise decrement patchlevel by one and run clirr with that as baseline

@aalmiray
Copy link
Owner

2.0.0 => no run
2.0.4 => 2.0.3
2.1.0 => 2.0.0 (*)
2.1.3 => 2.1.2

(*) I suppose if one would like to check 2.1.0-SNAPSHOT against 2.0.9 then the baseline has to be made explicit, right?

@Flowdalic
Copy link
Contributor Author

Non-Semver

2.0.0 => no run
2.0.4 => 2.0.3
2.1.0 => no run (API binary compatibility is not guranteed between any version prior 2.1.0)
2.1.3 => 2.1.2

Semver

2.0.0 => no run
2.0.4 => 2.0.3
2.1.0 => 2.0.0
2.1.3 => 2.1.2 **

** this made me realize that there is a bug in the description of the semver case. It must read
"decrement patchlevel by one" if minor != 0 && patchlevel != 0. Now fixed.

(*) I suppose if one would like to check 2.1.0-SNAPSHOT against 2.0.9 then the baseline has to be made explicit, right?

Yes, If you use non-semver, then releases with a 0 patchlevel likely don't have a binary compatible prior version (or in other words, it's not guranteed that they have one).

@Flowdalic
Copy link
Contributor Author

👍 Please remember me to buy you a beverage of your choice if we ever meet. :)

🎉

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

No branches or pull requests

2 participants