[GitHub] ant-ivy pull request #74: Fix IVY-982 by subtracting negated entries from wi...

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy pull request #74: Fix IVY-982 by subtracting negated entries from wi...

bodewig
GitHub user aprelev opened a pull request:

    https://github.com/apache/ant-ivy/pull/74

    Fix IVY-982 by subtracting negated entries from wildcard bin

    ### Issue
    Configurations negation (exclusion) as in `conf="*, !foo->@"` does not work,
    This issue is reported in [IVY-982](https://issues.apache.org/jira/browse/IVY-982) and [IVY-1547](https://issues.apache.org/jira/browse/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](https://github.com/apache/ant-ivy/blob/89583444040dc5423bb143435f23ae0814f24542/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java#L347).
    2. All configurations from *others-wildcard bin* [are added](https://github.com/apache/ant-ivy/blob/89583444040dc5423bb143435f23ae0814f24542/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java#L350) in case `X`'s *explicit bin* is empty.
    3. All configurations from *all-wildcard bin* [are added](https://github.com/apache/ant-ivy/blob/89583444040dc5423bb143435f23ae0814f24542/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java#L358).
   
    Note that explicit bins for negated target configurations *are not referenced, and thus silently ignored*. This fix introduces fourth step:
   
    4. All configurations from `!X`'s *explicit bin* are removed.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aprelev/ant-ivy issue-ivy-1547-982

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ant-ivy/pull/74.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #74
   
----
commit 0c2c826e4c316fdcf42fd890097edef478b692a3
Author: Aprelev Arseny <aprelev.arseny@...>
Date:   2018-08-06T14:21:21Z

    Fix IVY-982 by subtracting negated entries from wildcard bin

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
Github user twogee commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    @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?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
In reply to this post by bodewig
Github user twogee commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    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()))));
    ```
    does the bill, not sure if that's good enough, though.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
In reply to this post by bodewig
Github user aprelev commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    I replaced `Arrays.equals()` with `List.containsAll()`, as you suggested; thank you.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
In reply to this post by bodewig
Github user twogee commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    The disk is full again 😦Anyway, in case there is only one element, `Collections.singletonList()` is preferable.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
In reply to this post by bodewig
Github user aprelev commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    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.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
In reply to this post by bodewig
Github user twogee commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    `singletonList()` for single-element lists is the pattern used across Ivy tests. Thriftiness is a virtue, despite what people may say 😄


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy issue #74: Fix IVY-982 by removing negated entries from wildcard bin

bodewig
In reply to this post by bodewig
Github user twogee commented on the issue:

    https://github.com/apache/ant-ivy/pull/74
 
    Thank you, the fix is in master now. Please rebase to verify and close the PR.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-ivy pull request #74: Fix IVY-982 by removing negated entries from wildc...

bodewig
In reply to this post by bodewig
Github user aprelev closed the pull request at:

    https://github.com/apache/ant-ivy/pull/74


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]