tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Problem with stripping of build quialifier

Open jan-pesta opened this issue 7 months ago • 4 comments

Hi,

We have more graduate versioning in our project and we are now facing problem with stripping qualifier value which has been introduced with issue #611.

Our versioning is following similar pattern 20.8.1.qualifier

if I want to replace qualifiers in order 0, 1, 2 I got following results

20.8.1.0, 20.8.1, 20.8.1.2, where the middle one is missing qualifier version as it is already presented.

Problem is that this change change the versioning order which we are expecting: 20.8.1.0 < 20.8.1.1 < 20.8.1.2

Thanks.

jan-pesta avatar Jun 10 '25 05:06 jan-pesta

Can you provide an integration-test to demonstrate the issue?

laeubi avatar Jun 10 '25 05:06 laeubi

Hi, I will try. https://github.com/eclipse-tycho/tycho/pull/5048

I just find out in code:

private TychoProjectVersion calculateQualifiedVersion(Date timestamp)
			throws MojoFailureException, MojoExecutionException {
        Version osgiVersion = getParsedOSGiVersion();
        if (osgiVersion != null) {

            if (!VersioningHelper.QUALIFIER.equals(osgiVersion.getQualifier())) {
                // fully expended or absent qualified. nothing to expand
                String unqualifiedVersion = osgiVersion.getMajor() + "." + osgiVersion.getMinor() + "."
                        + osgiVersion.getMicro();
                return new TychoProjectVersion(unqualifiedVersion, osgiVersion.getQualifier());
            }
        }
	String qualifier = getDesiredQualifier(timestamp);

        validateQualifier(qualifier);

	String pomOSGiVersion = getUnqualifiedVersion();
	String suffix = "." + qualifier;
	if (pomOSGiVersion.endsWith(suffix)) {
		return new TychoProjectVersion(pomOSGiVersion.substring(0, pomOSGiVersion.length() - suffix.length()),
				qualifier);
	}
	return new TychoProjectVersion(pomOSGiVersion, qualifier);
    }

when suffix is matching versioning end, it is removed.

jan-pesta avatar Jun 10 '25 05:06 jan-pesta

@laeubi and @jan-pesta we are facing a similar issue. Do you think, this is fixable in a 4.x version of Tycho?

jocwurs avatar Jun 12 '25 13:06 jocwurs

@jocwurs Tycho 4.x is more or less EOL... this does not mean it is impossible but you should check out https://github.com/eclipse-tycho/tycho/blob/master/CONTRIBUTING.md#backporting for details.

The best would be to check Tycho 5.x current tycho snapshot build, and possibly propose a fix there as it will be released next.

laeubi avatar Jun 12 '25 14:06 laeubi