nemerosa/versioning

Please provide tag info in VersionInfo and allow custom logic for releases

Hubbitus opened this issue · 12 comments

I'm want use tag in my build artifacts name. But besides it parsed in GitInfoService class net.nemerosa.versioning.VersionInfo does not include it. So it does not returned for gradle in convenient versioning.info.

Additionally you have branchParser closure which I may try to override to provide logic, but I want do it also against tag names not branch names.
Could it be possible generalize it say accept VersionInfo and return also something more generic?

@Hubbitus, I've committed some adaptations on a separate branch. Can you review the changes and tell me what you think?

As for the branchParser, I'm not sure to understand what you want to achieve. I presume you want to have a different branch type if there is tag or not. Is that correct?

Best regards,
Damien.

The tag (and dirty) information is now present in version 2.3.0.

However, I didn't do anything about the branchParser in this release.

If you need to apply some custom logic to the way you compute the version, I'd suggest you do it directly into your Gradle file, by using the version present in the versioning.info object.

Best regards,
Damien.

Hello, @dcoraboeuf .
Thank you very much for the work and sorry for the silence. I'm ready to test any branch. What intended for that?

My suggestion about customization was to provide some DSL for configuration to configure in gradle script some release-parsing information for project not only based on branch, but provide full version object.

You describe it in https://github.com/nemerosa/versioning#customisation

But for example in case if I want extract release/snapshot information from tag name (let it be 'release/v1.0.1') and not from branch name provide overriding of

   branchParser = { String branch, String separator = '/' ->

is not sufficient.
Why it may not be more generic and accept full instance of class VersionInfo or SCMInfo for consideration in body?

Current you call it:

        // Version source
        String versionBranch = scmInfo.branch

        // Branch parsing
        BranchInfo branchInfo = branchParser(versionBranch, scmInfoService.branchTypeSeparator)

Why not just:

        // Branch parsing
        BranchInfo branchInfo = branchParser(scmInfo)

?

@Hubbitus,

Do you think you could make a pull request to propose the change?

Thanks,
Damien.

Yes, I could try.

Should it be against release/2.3 branch or master? As I see master does not include last changes. Is it intentionally?

Fixed :) You can branch from the master.

FYI - I'll be on leave until next Monday - so take your time :)

Thank you

Does it issue need to be reopened? Or I should fill new one?

I'll use the PR to track your change. Thanks.