Esempio n. 1
0
 /** Updates {@link #requiredClasspath} to include dependencies from the given output artifact. */
 private void collectDependenciesFromArtifact(String path) throws IOException {
   try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(path))) {
     Deps.Dependencies deps = Deps.Dependencies.parseFrom(bis);
     // Sanity check to make sure we have a valid proto.
     if (!deps.hasRuleLabel()) {
       throw new IOException("Could not parse Deps.Dependencies message from proto.");
     }
     for (Deps.Dependency dep : deps.getDependencyList()) {
       if (dep.getKind() == Kind.EXPLICIT || dep.getKind() == Kind.IMPLICIT) {
         requiredClasspath.add(dep.getPath());
       }
     }
   } catch (IOException e) {
     throw new IOException(String.format("error reading deps artifact: %s", path), e);
   }
 }