OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] ant-ivy issue #73: Enable XML report parser to produce qualified extra attri...


Github user aprelev commented on the issue:

    https://github.com/apache/ant-ivy/pull/73
  
    As of now, two sets of dependencies are constructed in a different ways:
    
    - *currently resolved dependecies* are produced by Ivy resolve engine, with **both qualified and unqualified attributes** (`super.qualifiedExtraAttributes != super.extraAttributes`), and
    - *previously resolved dependencies* are parsed from last report by `XmlReportParser`, with **unqualified attributes only** (`super.qualifiedExtraAttributes == super.extraAttributes`).
    
    Set comparison at `ConfigurationResolveReport::checkIfChanged()` invokes `ModuleRevisionId::equals()` for individual dependencies comparison, which compares `super.qualifiedExtraAttributes` maps as in:
    ```Java
    @Override
    public boolean equals(Object obj) {
      ...
      return other.getRevision().equals(getRevision())
        && !(other.getBranch() == null && getBranch() != null)
        && !(other.getBranch() != null && !other.getBranch().equals(getBranch()))
        && other.getModuleId().equals(getModuleId())
        && other.getQualifiedExtraAttributes().equals(getQualifiedExtraAttributes()); //< here
    }
    ```
    which, obviously, yields a `false`, since keys in `other.getQualifiedExtraAttributes()` map are stripped of qualifiers as explained above.
    
    That is why I introduced parameterised version of `ExtendableItemHelper::getExtraAttributes()` used by `XmlReportParser`, this way parsed dependencies have both versions of qualifiers, same as resolved dependencies.
    
    As I pointed out in original PR message, issue may instead be solved by modifying `ModuleRevisionId::equals()` to use `super.extraAttributes`, provided attributes namespaces cannot clash, of course, which will result in ignoring qualifiers:
    ```Java
    @Override
    public boolean equals(Object obj) {
      ...
      return other.getRevision().equals(getRevision())
        && !(other.getBranch() == null && getBranch() != null)
        && !(other.getBranch() != null && !other.getBranch().equals(getBranch()))
        && other.getModuleId().equals(getModuleId())
        && other.getExtraAttributes().equals(getExtraAttributes()); //< ignoring qualifiers
    }
    ```
    At what point do you suggest we check for presense of `':'` in the names of attributes? 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: dev-help@xxxxxxxxxxxxxx