comparison agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java @ 27:76ed2d58c871

- reused home path between all srcsrv-related utilities - extracted JetSymbols utility class
author Evgeniy.Koshkin
date Wed, 07 Aug 2013 18:37:23 +0400
parents
children a5f3d4f24843
comparison
equal deleted inserted replaced
26:87b24e4efcc3 27:76ed2d58c871
1 package jetbrains.buildServer.symbols.tools;
2
3 import com.intellij.execution.configurations.GeneralCommandLine;
4 import jetbrains.buildServer.ExecResult;
5 import jetbrains.buildServer.SimpleCommandLineProcessRunner;
6 import jetbrains.buildServer.agent.BuildProgressLogger;
7
8 import java.io.File;
9 import java.util.Collection;
10
11 /**
12 * @author Evgeniy.Koshkin
13 */
14 public class JetSymbolsExe {
15
16 private static final String SYMBOLS_EXE = "JetBrains.CommandLine.Symbols.exe";
17 private static final String DUMP_SYMBOL_SIGN_CMD = "dumpSymbolSign";
18 private final File myExePath;
19
20 public JetSymbolsExe(File homeDir) {
21 myExePath = new File(homeDir, SYMBOLS_EXE);
22 }
23
24 public void dumpGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger){
25 final GeneralCommandLine commandLine = new GeneralCommandLine();
26 commandLine.setExePath(myExePath.getPath());
27 commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD);
28 commandLine.addParameter(String.format("/o=\"%s\"", output.getPath()));
29 for(File file : files){
30 commandLine.addParameter(file.getPath());
31 }
32 buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString()));
33 final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
34 final String stdout = execResult.getStdout();
35 if(!stdout.isEmpty()){
36 buildLogger.message("Stdout: " + stdout);
37 }
38 if (execResult.getExitCode() == 0) return;
39 buildLogger.warning(String.format("%s ends with non-zero exit code.", SYMBOLS_EXE));
40 buildLogger.warning("Stdout: " + stdout);
41 buildLogger.warning("Stderr: " + execResult.getStderr());
42 buildLogger.exception(execResult.getException());
43 }
44 }