本文整理汇总了Java中jetbrains.buildServer.util.FileUtil.createTempFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.createTempFile方法的具体用法?Java FileUtil.createTempFile怎么用?Java FileUtil.createTempFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jetbrains.buildServer.util.FileUtil
的用法示例。
在下文中一共展示了FileUtil.createTempFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToTempFile
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private File writeToTempFile(@NotNull final File buildTempDir,
@NotNull final String text,
@NotNull final Map<String, String> runnerParameters) throws RunBuildException {
Closeable handle = null;
File file;
try {
file = FileUtil.createTempFile(buildTempDir, "powershell", ".ps1", true);
OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
handle = w;
if (PowerShellExecutionMode.PS1 == PowerShellExecutionMode.fromString(runnerParameters.get(RUNNER_EXECUTION_MODE))) {
w.write(BOM);
}
w.write(text);
return file;
} catch (IOException e) {
LOG.error("Error occurred while processing file for PowerShell script", e);
throw new RunBuildException("Failed to generate temporary resulting PowerShell script due to exception", e);
} finally {
FileUtil.close(handle);
}
}
示例2: patch
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
public void patch(File symbolsFile, BuildProgressLogger buildLogger) throws Exception {
final Collection<File> sourceFiles = mySrcToolExe.getReferencedSourceFiles(symbolsFile);
final String symbolsFileCanonicalPath = symbolsFile.getCanonicalPath();
if(sourceFiles.isEmpty()){
final String message = "No source information found in pdb file " + symbolsFileCanonicalPath;
buildLogger.warning(message);
LOG.debug(message);
return;
}
final File tmpFile = FileUtil.createTempFile(myWorkingDir, "pdb-", ".patch", false);
int processedFilesCount = mySrcSrvStreamBuilder.dumpStreamToFile(tmpFile, sourceFiles);
if(processedFilesCount == 0){
buildLogger.warning(String.format("Sources appeared in file %s weren't actually indexed. Looks like related binary file wasn't built during current build.", symbolsFileCanonicalPath));
} else {
buildLogger.message(String.format("Information about %d source files was updated", processedFilesCount));
}
myPdbStrExe.doCommand(PdbStrExeCommands.WRITE, symbolsFile, tmpFile, PdbStrExe.SRCSRV_STREAM_NAME);
}
示例3: generateNixScriptFile
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private File generateNixScriptFile(@NotNull final String argumentsToGenerate) throws RunBuildException {
final File script;
try {
script = FileUtil.createTempFile(getBuildTempDirectory(), "powershell_gen_" + System.currentTimeMillis(), ".sh", true);
myFilesToRemove.add(script);
FileUtil.writeFileAndReportErrors(script, argumentsToGenerate);
} catch (IOException e) {
throw new RunBuildException("Failed to generate .sh wrapper file");
}
return script;
}
示例4: generateRunScriptArguments
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private List<String> generateRunScriptArguments(@NotNull final String argumentsToGenerate) throws RunBuildException {
final File bat;
try {
bat = FileUtil.createTempFile(getBuildTempDirectory(), "powershell", ".bat", true);
myFilesToRemove.add(bat);
FileUtil.writeFileAndReportErrors(bat, "@" + argumentsToGenerate);
} catch (IOException e) {
throw new RunBuildException("Failed to generate .bat file");
}
return Arrays.asList("/c", bat.getPath());
}
示例5: getPdbSignature
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private PdbSignatureIndexEntry getPdbSignature(File pdbFile) throws Exception {
final File guidDumpFile = FileUtil.createTempFile(myBuildTempDirectory, "symbol-signature-local-", ".xml", false);
myJetSymbolsExe.dumpPdbGuidsToFile(Collections.singleton(pdbFile), guidDumpFile, myProgressLogger);
if(guidDumpFile.isFile())
return PdbSignatureIndexUtil.read(new FileInputStream(guidDumpFile), true).iterator().next();
else
throw new Exception("Failed to get signature of " + pdbFile.getPath());
}
示例6: getBinarySignature
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private PdbSignatureIndexEntry getBinarySignature(File binaryFile) throws Exception {
final File guidDumpFile = FileUtil.createTempFile(myBuildTempDirectory, "binary-signature-local-", ".xml", false);
BinaryGuidDumper.dumpBinaryGuidsToFile(Collections.singleton(binaryFile), guidDumpFile, myProgressLogger);
if(guidDumpFile.isFile())
return PdbSignatureIndexUtil.read(new FileInputStream(guidDumpFile), true).iterator().next();
else
throw new Exception("Failed to get signature of " + binaryFile.getPath());
}
示例7: dumpPathsToFile
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
private File dumpPathsToFile(Collection<File> files) throws IOException {
final File result = FileUtil.createTempFile(DUMP_SYMBOL_SIGN_CMD, ".input");
StringBuilder contentBuilder = new StringBuilder();
for(File file : files){
contentBuilder.append(file.getPath()).append("\n");
}
FileUtil.writeToFile(result, contentBuilder.toString().getBytes());
return result;
}
示例8: testSpacesInPaths
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@Test
public void testSpacesInPaths() throws Exception {
final File output = FileUtil.createTempFile("test spaces in paths", ".out");
final File input = FileUtil.createTempFile("test spaces in paths", ".in");
final int exitCode = myExe.dumpPdbGuidsToFile(Collections.singleton(input), output, new NullBuildProgressLogger());
assertEquals(0, exitCode);
}
示例9: testCmdParametersLengthLimit
import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@Test
public void testCmdParametersLengthLimit() throws Exception {
final File output = FileUtil.createTempFile("testCmdParametersLengthLimit", ".out");
final int dumpExitCode = myExe.dumpPdbGuidsToFile(getFilesCollection(500), output, new NullBuildProgressLogger());
assertEquals(0, dumpExitCode);
}