コード例 #1
0
ファイル: RepositoryName.java プロジェクト: whuwxl/bazel
 private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
   try {
     repositoryName = RepositoryName.create((String) in.readObject());
   } catch (LabelSyntaxException e) {
     throw new IOException("Error serializing repository name: " + e.getMessage());
   }
 }
コード例 #2
0
ファイル: RepositoryName.java プロジェクト: whuwxl/bazel
 /**
  * Extracts the repository name from a PathFragment that was created with {@code
  * PackageIdentifier.getPathFragment}.
  *
  * @return a {@code Pair} of the extracted repository name and the path fragment with stripped of
  *     "external/"-prefix and repository name, or null if none was found or the repository name
  *     was invalid.
  */
 public static Pair<RepositoryName, PathFragment> fromPathFragment(PathFragment path) {
   if (path.segmentCount() < 2 || !path.getSegment(0).equals(Label.EXTERNAL_PATH_PREFIX)) {
     return null;
   }
   try {
     RepositoryName repoName = RepositoryName.create("@" + path.getSegment(1));
     PathFragment subPath = path.subFragment(2, path.segmentCount());
     return Pair.of(repoName, subPath);
   } catch (LabelSyntaxException e) {
     return null;
   }
 }
コード例 #3
0
ファイル: RepositoryName.java プロジェクト: whuwxl/bazel
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeObject(repositoryName.toString());
 }