Skip to content

Allow to configure processors#353

Merged
piotrooo merged 5 commits intosemver4j:mainfrom
sschuberth:config-processors
Jun 23, 2025
Merged

Allow to configure processors#353
piotrooo merged 5 commits intosemver4j:mainfrom
sschuberth:config-processors

Conversation

@sschuberth
Copy link
Copy Markdown
Contributor

Please have a look at the individual commit messages for the details.

@sschuberth
Copy link
Copy Markdown
Contributor Author

As this makes Processors part of the public API, I believe we should also move them out of the org.semver4j.*internal*.range.processor package. Do you agree @piotrooo?

@sschuberth sschuberth force-pushed the config-processors branch from ca0eab3 to 74f3747 Compare June 6, 2025 08:13
@sschuberth
Copy link
Copy Markdown
Contributor Author

As this makes Processors part of the public API, I believe we should also move them out of the org.semver4j.*internal*.range.processor package.

I've done that now in a new commit.

@piotrooo
Copy link
Copy Markdown
Member

@sschuberth thanks for the contribution!

I think we need to merge #299 first, release a new version, and then address your PR. WDYT?

@piotrooo piotrooo added the enhancement New feature or request label Jun 10, 2025
@sschuberth
Copy link
Copy Markdown
Contributor Author

sschuberth commented Jun 10, 2025

I think we need to merge #299 first, release a new version, and then address your PR. WDYT?

I haven't looked deeply into the implementation of that PR. I realize it could create some minor conflicts with mine, but given that the PR / underlying issue was open much longer, I agree that it should go first.

@sschuberth
Copy link
Copy Markdown
Contributor Author

@piotrooo, this is ready for review again.

@sschuberth
Copy link
Copy Markdown
Contributor Author

@piotrooo, this is ready for review again.

Any idea about the Java 8 failure? Was that the reason to downgrade maven-surefire-plugin?

@piotrooo
Copy link
Copy Markdown
Member

Any idea about the Java 8 failure? Was that the reason to downgrade maven-surefire-plugin?

Yes, that was the reason...
I'll be preparing version 6 of the library without support for that dead Java 😄

@sschuberth
Copy link
Copy Markdown
Contributor Author

For your convenience, I've dropped Java 8 from CI already in my branch, so you could cleanly merge it if there are no other review findings.

@piotrooo
Copy link
Copy Markdown
Member

For your convenience, I've dropped Java 8 from CI already in my branch, so you could cleanly merge it if there are no other review findings.

I suggest aligning the version of maven-surefire-plugin with main, without removing anything from the CI workflow.

They are part of the public API of `RangesListFactory` now.

While at it, also move the only remaning `RangeProcessorPipeline` one
level up, out of the otherwise empty `internal.range` package.
This allow so see for which Java versions the build succeeds.
@sschuberth
Copy link
Copy Markdown
Contributor Author

Ok, I've dropped my first and last commit then.

Copy link
Copy Markdown
Member

@piotrooo piotrooo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one major question: how should I use this function? And even more importantly, why do I need it? Maybe this feature deserves a separate section in the README with some use cases?

@sschuberth
Copy link
Copy Markdown
Contributor Author

sschuberth commented Jun 23, 2025

And even more importantly, why do I need it?

One reason is to allow something that was possible before, in the original library from @vdurmont: Originally, we were able to explicitly construct an Ivy-only version range by using Requirement.buildIvy(), but ever since the switch to RangesListFactory.create() implicitly all version ranges were supported.

As we are partly dealing with version ranges in configuration files written by users, i.e. version ranges are user input, this opens a can of worms for us to also document any other syntaxes besides Ivy. And if this library ever supported more syntaxes, we'd need to adjust our docs again.

So to keep things simpler, not confuse the user, and also lower the risk of running into bugs / conflicts between version range syntaxes, we'd prefer to stay explicit here about which syntax(es) is / are supported.

how should I use this function?

Well, see the added test case.

I'm aiming to use it in this (Kotlin) code to limit the supported range syntax to Ivy, so

RangesListFactory.create(version).takeUnless { it.get().isEmpty() }

becomes

RangesListFactory.create(version, IvyProcessor()).takeUnless { it.get().isEmpty() }

Maybe this feature deserves a separate section in the README with some use cases?

I could add something to the README if required, but I actually believe the docs / test to be sufficient.

@piotrooo piotrooo merged commit d0070c4 into semver4j:main Jun 23, 2025
5 checks passed
@piotrooo
Copy link
Copy Markdown
Member

Thanks ❤️

@sschuberth sschuberth deleted the config-processors branch June 23, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants