comparison agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java @ 74:a5f3d4f24843 8.1.x

fixed TW-34285 - bundled new version of JetBrains.CommandLine.Symbols.exe; passed list of files via file
author Evgeniy.Koshkin
date Mon, 03 Mar 2014 12:58:24 +0400
parents 76ed2d58c871
children b3f951ab16eb
comparison
equal deleted inserted replaced
73:fd2005a04e4e 74:a5f3d4f24843
2 2
3 import com.intellij.execution.configurations.GeneralCommandLine; 3 import com.intellij.execution.configurations.GeneralCommandLine;
4 import jetbrains.buildServer.ExecResult; 4 import jetbrains.buildServer.ExecResult;
5 import jetbrains.buildServer.SimpleCommandLineProcessRunner; 5 import jetbrains.buildServer.SimpleCommandLineProcessRunner;
6 import jetbrains.buildServer.agent.BuildProgressLogger; 6 import jetbrains.buildServer.agent.BuildProgressLogger;
7 import jetbrains.buildServer.util.FileUtil;
7 8
8 import java.io.File; 9 import java.io.File;
10 import java.io.IOException;
9 import java.util.Collection; 11 import java.util.Collection;
10 12
11 /** 13 /**
12 * @author Evgeniy.Koshkin 14 * @author Evgeniy.Koshkin
13 */ 15 */
19 21
20 public JetSymbolsExe(File homeDir) { 22 public JetSymbolsExe(File homeDir) {
21 myExePath = new File(homeDir, SYMBOLS_EXE); 23 myExePath = new File(homeDir, SYMBOLS_EXE);
22 } 24 }
23 25
24 public void dumpGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger){ 26 public void dumpGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException {
25 final GeneralCommandLine commandLine = new GeneralCommandLine(); 27 final GeneralCommandLine commandLine = new GeneralCommandLine();
26 commandLine.setExePath(myExePath.getPath()); 28 commandLine.setExePath(myExePath.getPath());
27 commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD); 29 commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD);
28 commandLine.addParameter(String.format("/o=\"%s\"", output.getPath())); 30 commandLine.addParameter(String.format("/o=\"%s\"", output.getPath()));
29 for(File file : files){ 31 commandLine.addParameter(String.format("/i=\"%s\"", dumpPathsToFile(files).getPath()));
30 commandLine.addParameter(file.getPath());
31 }
32 buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString())); 32 buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString()));
33 final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null); 33 final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
34 final String stdout = execResult.getStdout(); 34 final String stdout = execResult.getStdout();
35 if(!stdout.isEmpty()){ 35 if(!stdout.isEmpty()){
36 buildLogger.message("Stdout: " + stdout); 36 buildLogger.message("Stdout: " + stdout);
39 buildLogger.warning(String.format("%s ends with non-zero exit code.", SYMBOLS_EXE)); 39 buildLogger.warning(String.format("%s ends with non-zero exit code.", SYMBOLS_EXE));
40 buildLogger.warning("Stdout: " + stdout); 40 buildLogger.warning("Stdout: " + stdout);
41 buildLogger.warning("Stderr: " + execResult.getStderr()); 41 buildLogger.warning("Stderr: " + execResult.getStderr());
42 buildLogger.exception(execResult.getException()); 42 buildLogger.exception(execResult.getException());
43 } 43 }
44
45 private File dumpPathsToFile(Collection<File> files) throws IOException {
46 final File result = FileUtil.createTempFile(DUMP_SYMBOL_SIGN_CMD, ".input");
47 StringBuilder contentBuilder = new StringBuilder();
48 for(File file : files){
49 contentBuilder.append(file.getPath()).append("\n");
50 }
51 FileUtil.writeToFile(result, contentBuilder.toString().getBytes());
52 return result;
53 }
44 } 54 }