private static void logException(XTriggerLog xTriggerLog, Exception e) {
   e.printStackTrace();
   xTriggerLog.error(e.getMessage());
   for (StackTraceElement se : e.getStackTrace()) {
     xTriggerLog.error(se.toString());
   }
 }
Ejemplo n.º 2
0
 public boolean performUpdate() {
   // String solutionGlob = "glob:" + file.getAbsolutePath() + "\\*.sln";
   try {
     checkVersions();
   } catch (Throwable ex) {
     log.error(ex.toString());
     return false;
   }
   return updated;
 }
Ejemplo n.º 3
0
  private String getPackageVersion(String wsRoot, String id) throws IOException {
    String line;

    if (packages.containsKey(id)) {
      return packages.get(id);
    }

    String nuget =
        new File(nugetExe).isAbsolute() ? nugetExe : new File(wsRoot, nugetExe).getAbsolutePath();

    String cmd = String.format("\"%s\" list %s -NonInteractive", nuget, id);
    for (int retried = 0; retried < retryCount; retried++) {
      log.info(String.format("Running: %s", cmd));
      Process p = Runtime.getRuntime().exec(cmd);
      BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
      BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
      while ((line = stdout.readLine()) != null) {
        log.info(line);
        String[] parts = line.split(" ", 2);
        if (parts.length == 2 && parts[0].equalsIgnoreCase(id)) {
          packages.put(id, parts[1]);
          return parts[1];
        }
      }
      stdout.close();
      while ((line = stderr.readLine()) != null) {
        log.error(line);
      }
      stderr.close();
      try {
        p.waitFor();
        break;
      } catch (InterruptedException ex) {
        log.error(ex.toString());
        log.info(String.format("Retrying: %i", retried));
      }
    }
    return null;
  }