Пример #1
0
 /**
  * Returns a relative path that should be unique across all remote and packages, based on the
  * repository and package names.
  */
 public PathFragment getPathFragment() {
   return repository.isDefault()
       ? pkgName
       : new PathFragment(ExternalPackage.NAME)
           .getRelative(repository.strippedName())
           .getRelative(pkgName);
 }
Пример #2
0
 @Override
 public int compareTo(PackageIdentifier that) {
   return ComparisonChain.start()
       .compare(repository.toString(), that.repository.toString())
       .compare(pkgName, that.pkgName)
       .result();
 }
Пример #3
0
 @Override
 public boolean equals(Object object) {
   if (this == object) {
     return true;
   }
   if (!(object instanceof PackageIdentifier)) {
     return false;
   }
   PackageIdentifier that = (PackageIdentifier) object;
   return pkgName.equals(that.pkgName) && repository.equals(that.repository);
 }
Пример #4
0
 /**
  * Returns the name of this package.
  *
  * <p>There are certain places that expect the path fragment as the package name ('foo/bar') as a
  * package identifier. This isn't specific enough for packages in other repositories, so their
  * stringified version is '@baz//foo/bar'.
  */
 @Override
 public String toString() {
   return (repository.isDefault() ? "" : repository + "//") + pkgName;
 }
Пример #5
0
 public PackageIdentifier(String repository, PathFragment pkgName) throws SyntaxException {
   this(RepositoryName.create(repository), pkgName);
 }