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

tycho-versions-plugin: Support ci-friendly versions #3900

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

sratz
Copy link
Contributor

@sratz sratz commented May 31, 2024

In PomFile#getVersion(), resolve properties used in the raw version of the project. This is necessary so that downstream manipulators (MANIFEST.MF, feature.xml, category.xml, ...) can see the actual version and act on it.

Fixes #3744.

@sratz sratz requested a review from laeubi May 31, 2024 13:22
Copy link

github-actions bot commented May 31, 2024

Test Results

  594 files  ±0    594 suites  ±0   3h 56m 55s ⏱️ - 6m 16s
  424 tests +1    417 ✅ +2   7 💤 ±0  0 ❌  - 1 
1 272 runs  +3  1 250 ✅ +4  22 💤 ±0  0 ❌  - 1 

Results for commit 1746be2. ± Comparison against base commit a8592b4.

♻️ This comment has been updated with latest results.

@sratz sratz force-pushed the set-version-ci-friendly branch from 31fec6c to 19c4722 Compare May 31, 2024 16:49
In PomFile#getVersion(), resolve properties used in the raw version of
the project. This is necessary so that downstream manipulators
(MANIFEST.MF, feature.xml, category.xml, ...) can see the actual version
and act on it.

Fixes eclipse-tycho#3744.
@sratz sratz force-pushed the set-version-ci-friendly branch from 19c4722 to 1746be2 Compare May 31, 2024 20:56
@sratz
Copy link
Contributor Author

sratz commented May 31, 2024

I refactored things a bit more. In fact, the utility is not specific to versions, but just deals with properties in general.

Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

Looks very good, thank you!

@laeubi laeubi added the backport-to-tycho-4.0.x Can be added to a PR to trigger an automatic backport of the change label Jun 1, 2024
@laeubi laeubi merged commit f4e7ede into eclipse-tycho:main Jun 1, 2024
12 checks passed
@eclipse-tycho-bot
Copy link

💚 All backports created successfully

Status Branch Result
tycho-4.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@HannesWell
Copy link
Member

@sratz is it possible that the back-port of this has broken P2's use of version variables/ci-friendly versions?
https://github.com/eclipse-equinox/p2/blob/65348d689980d1e11708f934f1767f056e62907d/pom.xml#L25-L32

Since Tycho 4.0.9 the tycho-versions-plugin:set-parent-version goal cannot set the root version of p2 anymore: <version>${releaseVersion}${qualifier}</version>
See https://github.com/eclipse-equinox/p2/actions/runs/11973081501/job/33420895519

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-versions-plugin:4.0.9:set-parent-version (default-cli) on project rt.equinox.p2: Execution default-cli of goal org.eclipse.tycho:tycho-versions-plugin:4.0.9:set-parent-version failed: No group with name {releaseVersion} -> [Help 1]

I verified it locally that it works with Tycho 4.0.8 and we had corresponding release preparation PRs for p2 in the past.

@HannesWell
Copy link
Member

Verified locally that reverting this for tycho 4.0.x makes the p2 case work again:
mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=4.35.0-SNAPSHOT org.eclipse.tycho:tycho-versions-plugin:set-parent-version -DnewParentVersion=4.35.0-SNAPSHOT -Dtycho.version=4.0.11-SNAPSHOT

@sratz
Copy link
Contributor Author

sratz commented Nov 25, 2024

@sratz is it possible that the back-port of this has broken P2's use of version variables/ci-friendly versions?

I think it brought to light a hidden problem that already existed before:

SetVersionMojo (set-version) is supposed to descend to child modules / projects, while
SetParentVersionMojo (set-parent-version) is not

Is this assumption correct, @laeubi?

SetParentVersionMojo inherits from AbstractChangeMojo and inherits the same descend-logic. This logic, however, always looks at getVersion() of the children.

@laeubi
Copy link
Member

laeubi commented Nov 27, 2024

@sratz thats was at least the idea of it, but we can of course change things if it performs better.

@sratz sratz deleted the set-version-ci-friendly branch November 27, 2024 10:01
@sratz
Copy link
Contributor Author

sratz commented Nov 27, 2024

@laeubi I am trying to understand the original intention of the set-parent-version mojo.

Assuming the following directory structure:

pom.xml
    <version>1.0.0</version>

  child1\pom.xml <-- run org.eclipse.tycho:tycho-versions-plugin:set-parent-version -DnewParentVersion=2.0.0 here
      <parent>
          <version>1.0.0</version>
      </parent>
      <version>1.0.0</version>

    child1\child1a\pom.xml
        <parent>
            <version>1.0.0</version>
        </parent>
        <version>1.0.0</version>

    child1\child1b\pom.xml
        <parent>
            <version>1.0.0</version>
        </parent>
        <version>1.0.0</version>

  child2\pom.xml
      <parent>
          <version>1.0.0</version>
      </parent>
      <version>1.0.0</version>

    child2\child2a\pom.xml
        <parent>
            <version>1.0.0</version>
        </parent>
        <version>1.0.0</version>

    child2\child2b\pom.xml
        <parent>
            <version>1.0.0</version>
        </parent>
        <version>1.0.0</version>

The result is:

pom.xml
    <version>2.0.0</version>

  child1\pom.xml
      <parent>
          <version>2.0.0</version>
      </parent>
      <version>2.0.0</version>

    child1\child1a\pom.xml
        <parent>
            <version>2.0.0</version>
        </parent>
        <version>2.0.0</version>

    child1\child1b\pom.xml
        <parent>
            <version>2.0.0</version>
        </parent>
        <version>2.0.0</version>

  child2\pom.xml
      <parent>
          <version>2.0.0</version>
      </parent>
      <version>2.0.0</version>

    child2\child2a\pom.xml
        <parent>
            <version>2.0.0</version>
        </parent>
        <version>2.0.0</version>

    child2\child2b\pom.xml
        <parent>
            <version>2.0.0</version>
        </parent>
        <version>2.0.0</version>

Versions have essentially changed everywhere, even outside of the current directory.

Is this really the intention of the mojo?

@sratz
Copy link
Contributor Author

sratz commented Nov 27, 2024

The actual regression and IllegalArgumentException is fixed with #4453. Although I still think the set-parent-version mojo is strange and not really doing what it was intended for :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-tycho-4.0.x Can be added to a PR to trigger an automatic backport of the change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

set-version fails to update MANIFEST.MF if CI-firendly versions are in use
4 participants