comparison agent/src/jetbrains/buildServer/symbols/SrcToolExe.java @ 12:662a0be55de7

- source indexing works! - few tests added
author Evgeniy.Koshkin
date Tue, 30 Jul 2013 22:10:30 +0400
parents
children
comparison
equal deleted inserted replaced
11:5fb218a7e574 12:662a0be55de7
1 /*
2 * Copyright 2000-2013 JetBrains s.r.o.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package jetbrains.buildServer.symbols;
18
19 import com.intellij.execution.configurations.GeneralCommandLine;
20 import jetbrains.buildServer.ExecResult;
21 import jetbrains.buildServer.SimpleCommandLineProcessRunner;
22 import jetbrains.buildServer.util.CollectionsUtil;
23 import jetbrains.buildServer.util.Converter;
24 import org.jetbrains.annotations.NotNull;
25
26 import java.io.File;
27 import java.util.Arrays;
28 import java.util.Collection;
29
30 /**
31 * @author Evgeniy.Koshkin
32 */
33 public class SrcToolExe {
34 private static final String DUMP_SOURCES_FROM_PDB_SWITCH = "-r";
35
36 private final File mySrcToolPath = new File("c:\\Program Files (x86)\\Windows Kits\\8.0\\Debuggers\\x64\\srcsrv\\srctool.exe");
37
38 public Collection<File> getReferencedSourceFiles(File symbolsFile) {
39 final GeneralCommandLine commandLine = new GeneralCommandLine();
40 commandLine.setExePath(mySrcToolPath.getPath());
41 commandLine.addParameter(symbolsFile.getAbsolutePath());
42 commandLine.addParameter(DUMP_SOURCES_FROM_PDB_SWITCH);
43 final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
44 return CollectionsUtil.convertAndFilterNulls(Arrays.asList(execResult.getOutLines()), new Converter<File, String>() {
45 public File createFrom(@NotNull String source) {
46 final File file = new File(source);
47 if (file.isFile()) return file;
48 return null; //last string is not a source file path
49 }
50 });
51 }
52 }