public boolean patch()

in teamcity-symbol-agent/src/main/java/jetbrains/buildServer/symbols/PdbFilePatcher.java [45:76]


  public boolean patch(File symbolsFile) throws Exception {
    final PdbType pdbType = myJetSymbolsExe.getPdbType(symbolsFile, myProgressLogger);
    final PdbFilePatcherAdapter patherAdapter = myPatcheAdapterFactory.create(pdbType);

    final Collection<File> sourceFiles = patherAdapter.getReferencedSourceFiles(symbolsFile);
    final String symbolsFileCanonicalPath = symbolsFile.getCanonicalPath();
    if (sourceFiles.isEmpty()) {
      final String message = "No source information found in pdb file " + symbolsFileCanonicalPath;
      myProgressLogger.warning(message);
      LOG.warn(message);
      return false;
    }

    final File tmpFile = FileUtil.createTempFile(myWorkingDir, "pdb-", ".patch", false);
    try {
      int processedFilesCount = patherAdapter.serializeSourceLinks(tmpFile, sourceFiles);
      if (processedFilesCount == 0) {
        myProgressLogger.message(String.format("No local source files were found for pdb file %s. Looks like it was not produced during the current build.", symbolsFileCanonicalPath));
        return false;
      } else {
        myProgressLogger.message(String.format("Information about %d source files will be updated.", processedFilesCount));
      }

      final ExecResult result = patherAdapter.updatePdbSourceLinks(symbolsFile, tmpFile);
      if (result.getExitCode() != 0) {
        throw new IOException(String.format("Failed to update symbols file %s: %s", symbolsFile, result.getStderr()));
      }
    } finally {
      FileUtil.delete(tmpFile);
    }
    return true;
  }