Fix coordinates of resolved jars in IvyInfo.

Review Request #2818 - Created Sept. 14, 2015 and submitted

Information
John Sirois
pants
jsirois/ivy_quest/ivy_utils/fix_artifact_mapping_bug
1841, 2193
ed4164f...
Reviewers
pants-reviews
dturner-tw, mateor, nhoward_tw, stuhood, zundel
Previously `IvyInfo.get_resolved_jars_for_jar_library` would copy the
dependee's coordinate to all artifacts in its dependency graph.  Added a
failing unit test that this change fixed.

Also moved the test data used in this test into the same dir tree.

 src/python/pants/backend/jvm/ivy_utils.py                                                                          | 31 ++++++++++++++++++-------------
 src/python/pants/backend/jvm/jar_dependency_utils.py                                                               | 19 +++++++++++++------
 tests/python/pants_test/backend/jvm/tasks/BUILD                                                                    |  5 +++--
 tests/python/pants_test/{ => backend/jvm}/tasks/ivy_utils_resources/report_with_cycle.xml                          |  0
 tests/python/pants_test/{ => backend/jvm}/tasks/ivy_utils_resources/report_with_diamond.xml                        |  0
 tests/python/pants_test/{ => backend/jvm}/tasks/ivy_utils_resources/report_with_same_classifier_different_type.xml |  0
 tests/python/pants_test/backend/jvm/tasks/test_ivy_utils.py                                                        | 41 ++++++++++++++++++++++++++++++++---------
 7 files changed, 66 insertions(+), 30 deletions(-)

Before the fix, the new test failed as such:

>     self.assertEqual(expected, coordinate_by_path)
E     AssertionError: {u'ivy2cache_path/org3/name3.jar': M2Coordinate(org=u'org3', name=u'name3', rev= [truncated]... != {'ivy2cache_path/org3/name3.jar': M2Coordinate(org=u'org1', name=u'name1', rev=u [truncated]...
E     - {u'ivy2cache_path/org1/name1.jar': M2Coordinate(org=u'org1', name=u'name1', rev=u'0.0.1', classifier=None, type_=u'jar'),
E     ?  -
E     
E     + {'ivy2cache_path/org1/name1.jar': M2Coordinate(org=u'org1', name=u'name1', rev=u'0.0.1', classifier=None, type_=u'jar'),
E     -  u'ivy2cache_path/org2/name2.jar': M2Coordinate(org=u'org2', name=u'name2', rev=u'0.0.1', classifier=None, type_=u'jar'),
E     ?  -                                                       ^              ^
E     
E     +  'ivy2cache_path/org2/name2.jar': M2Coordinate(org=u'org1', name=u'name1', rev=u'0.0.1', classifier=None, type_=u'jar'),
E     ?                                                         ^              ^
E     
E     -  u'ivy2cache_path/org3/name3.jar': M2Coordinate(org=u'org3', name=u'name3', rev=u'0.0.1', classifier=None, type_=u'jar')}
E     ?  -                                                       ^              ^
E     
E     +  'ivy2cache_path/org3/name3.jar': M2Coordinate(org=u'org1', name=u'name1', rev=u'0.0.1', classifier=None, type_=u'jar')}
E     ?                                                         ^              ^

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/80342136

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
John Sirois
Nick Howard (Twitter)
John Sirois
John Sirois
Nick Howard (Twitter)
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...