public static String getWarnings(String localPath, String revId) { String lintFile = BackupManager.getDailyRevisionBackupPath(localPath, revId) + "/lint.txt"; if (!Util.isFileExist(lintFile)) return "unknown"; List<String> fileContentLines = Util.getFileContentLines(lintFile); if (fileContentLines.size() == 0) return "unknown"; String lastLine = fileContentLines.get(fileContentLines.size() - 1); if (lastLine.indexOf("warnings") == -1 && lastLine.indexOf("errors") == -1) return "unknown"; return lastLine; }
public String perform(String localPath) { int times = 5; while (!lint(localPath) && times > 0) { times--; } SvnInfo currentSvnInfo = SvnManager.getInstance().getCurrentSvnInfo(localPath); String revision = currentSvnInfo.getLastChangedRevId(); String path = BackupManager.getDailyRevisionBackupPath(localPath, revision); Util.copyFile("testreport/testresult_lint.txt", path + "/lint.txt"); logger.info(localPath + ", revid:" + revision + ", path:" + path); String lintfile = BackupManager.getDailyRevisionBackupPath(localPath, revision) + "/lint.txt"; if (!isLastestLintFileCreate(localPath, revision)) { Util.copyFile("testreport/testresult_lint.txt", lintfile); } return lintfile; }
private boolean lint(String localPath) { List<String> cmdOutput = Util.getCmdOutput(SystemEnv.lint + " " + localPath + " > testreport/testresult_lint.txt"); for (String s : cmdOutput) { logger.info(s); if (s.contains("EXCEPTION_ACCESS_VIOLATION")) return false; } return true; }
public static boolean isLastestLintFileCreate(String localPath, String revision) { String fileName = BackupManager.getDailyRevisionBackupPath(localPath, revision) + "/lint.txt"; return Util.isFileExist(fileName); }