Produce a single library for multiple file dependencies on the same file

Previously, the Gradle plugin’s ProjectLibraries produced a new library
for every file dependency, even if the dependencies where on the same
file. This would lead to a repackaging failure due to multiple
libraries having the same name.

This commit updates ProjectLibraries to treat file dependencies on the
same file as a single library, thereby resolving the name clash.

Fixes gh-1646
This commit is contained in:
Andy Wilkinson
2014-10-01 19:20:04 +01:00
parent 8349148bbf
commit bcd4c8eee2
7 changed files with 67 additions and 11 deletions

View File

@@ -199,6 +199,23 @@ class ProjectLibraries implements Libraries {
return name;
}
@Override
public int hashCode() {
return getFile().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof GradleLibrary) {
return getFile().equals(((GradleLibrary) obj).getFile());
}
return false;
}
@Override
public String toString() {
return getFile().getAbsolutePath();
}
}
/**