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

IVY-982 Remove negated entries from wildcard bin #74

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@aprelev
Contributor

aprelev commented Aug 6, 2018

Issue

Configurations negation (exclusion) as in conf="*, !foo->@" does not work,
This issue is reported in IVY-982 and IVY-1547.

Why does it happen?

Resolve engine silently disrespects negation on the left part of maps-to operator because the exclusion was not implemented. When parsing dependency, e.g. conf="*, !foo → bar1; foo → bar2, bar3; % → bar4", all dependency configurations are collected into bins (map entries):

  • all-wildcard bin with all configurations required for * superset,
    such as bar1 in bin *;
  • others-wildcard bin with all configurations required for % superset,
    such as bar4 in bin %;
  • explicit bins for all explicit mappings,
    such as bar2 and bar3 in bin foo, and bar1 in bin !foo.

Resolving list of dependency configurations required for some target configuration X is done as follows:

  1. All configurations from X's explicit bin are added.
  2. All configurations from others-wildcard bin are added in case X's explicit bin is empty.
  3. All configurations from all-wildcard bin are added.

Note that explicit bins for negated target configurations are not referenced, and thus silently ignored. This fix introduces fourth step:

  1. All configurations from !X's explicit bin are removed.

@aprelev aprelev changed the title from Fix IVY-982 by subtracting negated entries from wildcard bin to Fix IVY-982 by removing negated entries from wildcard bin Aug 6, 2018

@twogee

This comment has been minimized.

Contributor

twogee commented Aug 6, 2018

@aprelev Unfortunately, the fix fails on Java 7 but not the later versions (reproduced on macOS here, too). Do you need assistance to investigate further?

@twogee

This comment has been minimized.

Contributor

twogee commented Aug 6, 2018

Sorting is a problem, in rootModuleConfs field of IvyNodeUsage by the looks of it.

        assertTrue(Arrays.asList("myconf1", "myconf2").containsAll(Arrays.asList(
                crp.getDependency(mod22).getConfigurations(crp.getConfiguration()))));

fits the bill, not sure if that's good enough, though.

Fix comparison issue with List interface
Arrays.equals() depends on order of the elements in the underlying arrays
@aprelev

This comment has been minimized.

Contributor

aprelev commented Aug 7, 2018

I replaced Arrays.equals() with List.containsAll(), as you suggested; thank you.

@twogee

This comment has been minimized.

Contributor

twogee commented Aug 7, 2018

The disk is full again 😦Anyway, in case there is only one element, Collections.singletonList() is preferable.

@aprelev

This comment has been minimized.

Contributor

aprelev commented Aug 7, 2018

Do you think overhead decrease achieved by using singletonList() outweighs breaking the pattern of List initialisations in test body? This is my second week with Java, these subtle differences are new to me.

@twogee

This comment has been minimized.

Contributor

twogee commented Aug 7, 2018

singletonList() for single-element lists is the pattern used across Ivy tests. Thriftiness is a virtue, despite what people may say 😄

@twogee

This comment has been minimized.

Contributor

twogee commented Aug 7, 2018

Thank you, the fix is in master now. Please rebase to verify and close the PR.

@aprelev aprelev closed this Aug 7, 2018

@aprelev aprelev changed the title from Fix IVY-982 by removing negated entries from wildcard bin to IVY-982 Remove negated entries from wildcard bin Aug 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment