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

Fix artifact de-duplication so it selects the artifact with the right exclusions #613

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

cheister
Copy link
Collaborator

When we de-duplicate artifacts from coursier we just take the first artifact in the list. This is sometimes breaking artifacts that specify exclusions because the first artifact in the list may not match the exclusions for the dependency. The result is that you specify exclusions but nothing is excluded.

This PR fixes the de-duplication logic so it will select the duplicate artifact with the correct exclusions.

Since this also re-arranged the artifacts in the list I also sorted the list after all of the de-duplication was done. Sorting the artifacts based on their file path does re-arrange the sorting from coursier though.

@cheister cheister force-pushed the dedup-dependency-with-exclusions branch from a79894c to 5594d3e Compare October 26, 2021 23:39
Copy link
Member

@jin jin left a comment

Choose a reason for hiding this comment

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

Nice catch.

if sorted(duplicate_artifact["exclusions"]) == sorted(artifacts_with_exclusions[duplicate_coord]):
found_artifact_with_exclusion = True
deduped_artifact_with_exclusion = duplicate_artifact
if verbose and not found_artifact_with_exclusion:
Copy link
Member

Choose a reason for hiding this comment

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

Does this actually happen? Should this be a failure instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if this ever happens.

It did not happen for any of the builds I tested, and since in the past we always took the first one in the list regardless of exclusion I didn't think we should create an error here now. It seemed like the logging might useful for future debugging if there are errors with exclusions though.

@cheister cheister merged commit d98ea59 into master Oct 27, 2021
@cheister cheister deleted the dedup-dependency-with-exclusions branch October 27, 2021 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants