jetbrains.buildServer.ExecResult Java Examples
The following examples show how to use
jetbrains.buildServer.ExecResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SrcToolExe.java From teamcity-symbol-server with Apache License 2.0 | 6 votes |
public ExecResult dumpSources(final File pdbFile, final BuildProgressLogger buildLogger){ final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setWorkDirectory(myPath.getParent()); commandLine.setExePath(myPath.getPath()); commandLine.addParameter(pdbFile.getAbsolutePath()); commandLine.addParameter(DUMP_REFERENCES_SWITCH); commandLine.addParameter(ZERRO_ON_SUCCESS_SWITCH); buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString())); final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null); if (execResult.getExitCode() != 0) { buildLogger.warning(String.format("%s completed with exit code %s.", SRCTOOL_EXE, execResult)); buildLogger.warning("Stdout: " + execResult.getStdout()); buildLogger.warning("Stderr: " + execResult.getStderr()); final Throwable exception = execResult.getException(); if(exception != null){ buildLogger.exception(exception); } } return execResult; }
Example #2
Source File: PdbFilePatcherAdapterImpl.java From teamcity-symbol-server with Apache License 2.0 | 6 votes |
@Override public Collection<File> getReferencedSourceFiles(final File symbolsFile) throws IOException { final ExecResult result = mySrcToolExe.dumpSources(symbolsFile, myBuildLogger); if (result.getExitCode() != 0) { throw new IOException(String.format("Failed to dump sources from symbols file %s: %s", symbolsFile, result)); } String[] outLines = result.getOutLines(); ArrayList<File> resultCollection = new ArrayList<File>(); for(int index = 0; index < outLines.length - 1; index++) { final String line = outLines[index]; if (line != null) { resultCollection.add(new File(line)); } } return resultCollection; }
Example #3
Source File: UserUIDAndGIDImpl.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Nullable private String runCommand(@NotNull String command) { final GeneralCommandLine cmd = new GeneralCommandLine(); cmd.setExePath("/bin/sh"); cmd.addParameter("-c"); cmd.addParameter(command); final ExecResult result = SimpleCommandLineProcessRunner.runCommand(cmd, new byte[0]); //noinspection ThrowableResultOfMethodCallIgnored if (result.getException() != null || result.getExitCode() != 0) { LOG.info(("Failed to call '" + command+ "'. Exit code: " + result.getExitCode() + "\n " + result.getStdout() + "\n" + result.getStderr()).trim()); return null; } return result.getStdout().trim(); }
Example #4
Source File: PdbStrExe.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
public ExecResult doCommand(final PdbStrExeCommands cmd, final File pdbFile, final File inputStreamFile, final String streamName){ final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setWorkDirectory(myPath.getParent()); commandLine.setExePath(myPath.getPath()); commandLine.addParameter(cmd.getCmdSwitch()); commandLine.addParameter(String.format("%s:%s", PATH_TO_PDB_FILE_SWITCH, pdbFile.getAbsolutePath())); commandLine.addParameter(String.format("%s:%s", PATH_TO_INPUT_FILE_SWITCH, inputStreamFile.getAbsolutePath())); commandLine.addParameter(STREAM_NAME_SWITCH + ":" + streamName); return SimpleCommandLineProcessRunner.runCommand(commandLine, null); }
Example #5
Source File: JetSymbolsExe.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
public int dumpPdbGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException { final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(myExePath.getPath()); commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD); commandLine.addParameter(String.format("/o=%s", output.getPath())); commandLine.addParameter(String.format("/i=%s", dumpPathsToFile(files).getPath())); final ExecResult execResult = executeCommandLine(commandLine, buildLogger); if (execResult.getExitCode() == 0 && !execResult.getStdout().isEmpty()) { buildLogger.message("Stdout: " + execResult.getStdout()); } return execResult.getExitCode(); }
Example #6
Source File: JetSymbolsExe.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
public Collection<File> getReferencedSourceFiles(File symbolsFile, BuildProgressLogger buildLogger) { final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(myExePath.getPath()); commandLine.addParameter(LIST_SOURCES_CMD); commandLine.addParameter(symbolsFile.getAbsolutePath()); final ExecResult execResult = executeCommandLine(commandLine, buildLogger); if (execResult.getExitCode() == 0) { return CollectionsUtil.convertAndFilterNulls(Arrays.asList(execResult.getOutLines()), File::new); } else { return Collections.emptyList(); } }
Example #7
Source File: JetSymbolsExe.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
public PdbType getPdbType(File symbolsFile, BuildProgressLogger buildLogger) { final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(myExePath.getPath()); commandLine.addParameter(GET_PDB_TYPE_CMD); commandLine.addParameter(symbolsFile.getAbsolutePath()); final ExecResult execResult = executeCommandLine(commandLine, buildLogger); if (execResult.getExitCode() == 0) { return parsePdbType(execResult.getOutLines(), buildLogger); } else { buildLogger.error("Cannot parse PDB type."); return PdbType.Undefined; } }
Example #8
Source File: JetSymbolsExe.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
public ExecResult updatePortablePdbSourceUrls(final File symbolsFile, final File sourceUrlsFile, final BuildProgressLogger buildLogger) { final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(myExePath.getPath()); commandLine.addParameter(UPDATE_SOURCE_URLS_CMD); commandLine.addParameter(symbolsFile.getAbsolutePath()); commandLine.addParameter(String.format("/i=%s", sourceUrlsFile.getPath())); return executeCommandLine(commandLine, buildLogger); }
Example #9
Source File: JetSymbolsExe.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
private ExecResult executeCommandLine(GeneralCommandLine commandLine, BuildProgressLogger buildLogger) { buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString())); final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null); if (execResult.getExitCode() != 0) { buildLogger.warning(String.format("%s completed with exit code %s.", SYMBOLS_EXE, execResult)); buildLogger.warning("Stdout: " + execResult.getStdout()); buildLogger.warning("Stderr: " + execResult.getStderr()); final Throwable exception = execResult.getException(); if(exception != null){ buildLogger.exception(exception); } } return execResult; }
Example #10
Source File: PdbFilePatcher.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
/** * Executes patching process. * * @param symbolsFile is a source PDB file. * @param buildLogger is a build logger. * @return true if file was patched, otherwise false. * @throws Exception is error has happen during patching process. */ 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; }
Example #11
Source File: PdbStrExeTest.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
public void testRead() throws Exception { final File tempFile = createTempFile(); assertTrue(tempFile.length() == 0); ExecResult execResult = myTool.doCommand(PdbStrExeCommands.READ, myIndexedPdbFile, tempFile, PdbStrExe.SRCSRV_STREAM_NAME); assertEquals(0, execResult.getExitCode()); assertFalse(tempFile.length() == 0); }
Example #12
Source File: PortablePdbFilePatcherAdapterImpl.java From teamcity-symbol-server with Apache License 2.0 | 4 votes |
@Override public ExecResult updatePdbSourceLinks(final File symbolsFile, final File sourceLinksFile) { return myJetSymbolsExe.updatePortablePdbSourceUrls(symbolsFile, sourceLinksFile, myBuildLogger); }
Example #13
Source File: PdbFilePatcherAdapterImpl.java From teamcity-symbol-server with Apache License 2.0 | 4 votes |
@Override public ExecResult updatePdbSourceLinks(final File symbolsFile, final File sourceLinksFile) { return myPdbStrExe.doCommand(PdbStrExeCommands.WRITE, symbolsFile, sourceLinksFile, PdbStrExe.SRCSRV_STREAM_NAME); }
Example #14
Source File: PdbFilePatcherAdapter.java From teamcity-symbol-server with Apache License 2.0 | votes |
public ExecResult updatePdbSourceLinks(File symbolsFile, File sourceLinksFile);