Skip to content

chore: use priority ordering in java repo finder #641

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

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

benmss
Copy link
Member

@benmss benmss commented Feb 15, 2024

This PR makes the configuration property repo_pom_paths a priority list. When the Repo Finder is resolving URLs to repositories, the first valid URL (based on the ordering of the repo_pom_paths) will be returned. By default, the highest priority SCM entry in a POM should be url, as this most reliably represents the URL of the source repository.

Closes #640

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 15, 2024
@benmss benmss force-pushed the 640-use-priority-ordering-in-java-repo-finder branch from 28c0858 to f98d2d0 Compare February 15, 2024 05:09
@benmss benmss marked this pull request as ready for review February 15, 2024 05:36
@benmss benmss force-pushed the 640-use-priority-ordering-in-java-repo-finder branch from 787062d to 38d9537 Compare February 23, 2024 03:08
@tromai
Copy link
Member

tromai commented Feb 23, 2024

I have tested your implementation and it seems that because calling defaults.get_list method (implementation here) without duplicated_ok=True will first convert the list specified in defaults.ini to a set before returning. A set in Python doesn't preserve the inserting order of elements. This will result in the order of elements not following the original order as specified in defaults.ini and impact the behavior of JavaRepoFinder._read_pom.
@behnazh-w It sounds to me that we need to improve defaults.get_list regarding the order of the elements in the list. defaults.get_list altering the order of the list as the default behavior is not what we expected. However, improving that function might be out of scope for this PR. For now I think @benmss can address it by calling

tags = defaults.get_list("repofinder.java", "repo_pom_paths", duplicated_ok=True)

At this place.
I don't have a strong opinion on whether we fix it in this PR or in a separated PR.

Copy link
Member

@tromai tromai left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. LGTM (given the assumption that the issue discussed in #641 (comment) is going to be addressed in a separated PR).

@benmss benmss force-pushed the 640-use-priority-ordering-in-java-repo-finder branch from 3dab90b to 8f7d2d8 Compare February 27, 2024 05:51
@behnazh-w
Copy link
Member

@behnazh-w It sounds to me that we need to improve defaults.get_list regarding the order of the elements in the list. defaults.get_list altering the order of the list as the default behavior is not what we expected.

Yes, agreed. @tromai can you please work on this issue in a separate PR?

@benmss benmss merged commit 40abe9e into staging Mar 5, 2024
@nathanwn nathanwn deleted the 640-use-priority-ordering-in-java-repo-finder branch March 5, 2024 04:19
art1f1c3R pushed a commit that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants