use of com.facebook.buck.shell.DefaultShellStep in project buck by facebook.
the class MultiarchFile method lipoBinaries.
private void lipoBinaries(BuildContext context, ImmutableList.Builder<Step> steps) {
ImmutableList.Builder<String> commandBuilder = ImmutableList.builder();
commandBuilder.addAll(lipo.getCommandPrefix(context.getSourcePathResolver()));
commandBuilder.add("-create", "-output", getProjectFilesystem().resolve(output).toString());
for (SourcePath thinBinary : thinBinaries) {
commandBuilder.add(context.getSourcePathResolver().getAbsolutePath(thinBinary).toString());
}
steps.add(new DefaultShellStep(getProjectFilesystem().getRootPath(), commandBuilder.build(), lipo.getEnvironment(context.getSourcePathResolver())));
}
use of com.facebook.buck.shell.DefaultShellStep in project buck by facebook.
the class CxxInferAnalyze method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
buildableContext.recordArtifact(specsDir);
buildableContext.recordArtifact(context.getSourcePathResolver().getRelativePath(getSourcePathToOutput()));
return ImmutableList.<Step>builder().add(new MkdirStep(getProjectFilesystem(), specsDir)).add(new SymCopyStep(getProjectFilesystem(), captureAndAnalyzeRules.captureRules.stream().map(CxxInferCapture::getSourcePathToOutput).map(context.getSourcePathResolver()::getRelativePath).collect(MoreCollectors.toImmutableList()), resultsDir)).add(new AbstractExecutionStep("write_specs_path_list") {
@Override
public StepExecutionResult execute(ExecutionContext executionContext) throws IOException {
try {
ImmutableList<String> specsDirsWithAbsolutePath = getSpecsOfAllDeps().stream().map(input -> context.getSourcePathResolver().getAbsolutePath(input).toString()).collect(MoreCollectors.toImmutableList());
getProjectFilesystem().writeLinesToPath(specsDirsWithAbsolutePath, specsPathList);
} catch (IOException e) {
executionContext.logError(e, "Error while writing specs path list file for the analyzer");
return StepExecutionResult.ERROR;
}
return StepExecutionResult.SUCCESS;
}
}).add(new DefaultShellStep(getProjectFilesystem().getRootPath(), getAnalyzeCommand(), ImmutableMap.of())).build();
}
use of com.facebook.buck.shell.DefaultShellStep in project buck by facebook.
the class AbstractElfExtractSectionsStep method execute.
@Override
public StepExecutionResult execute(ExecutionContext context) throws IOException, InterruptedException {
ImmutableMap<String, Long> addresses = getNewSectionAddresses();
Step objcopy = new DefaultShellStep(getFilesystem().getRootPath(), /* args */
getObjcopyCommand(addresses), /* env */
ImmutableMap.of());
return objcopy.execute(context);
}
use of com.facebook.buck.shell.DefaultShellStep in project buck by facebook.
the class CxxInferCapture method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
ImmutableList<String> frontendCommand = getFrontendCommand();
buildableContext.recordArtifact(context.getSourcePathResolver().getRelativePath(getSourcePathToOutput()));
Path inputRelativePath = context.getSourcePathResolver().getRelativePath(input);
return ImmutableList.<Step>builder().add(new MkdirStep(getProjectFilesystem(), resultsDir)).add(new MkdirStep(getProjectFilesystem(), output.getParent())).add(new WriteArgFileStep(inputRelativePath)).add(new DefaultShellStep(getProjectFilesystem().getRootPath(), frontendCommand, ImmutableMap.of())).build();
}
use of com.facebook.buck.shell.DefaultShellStep in project buck by facebook.
the class IntraDexReorderStep method reorderEntry.
private int reorderEntry(Path inputPath, boolean isPrimaryDex, ImmutableList.Builder<Step> steps) {
if (!isPrimaryDex) {
String tmpname = "dex-tmp-" + inputPath.getFileName().toString() + "-%s";
Path temp = BuildTargets.getScratchPath(filesystem, buildTarget, tmpname);
// Create tmp directory if necessary
steps.add(new MakeCleanDirectoryStep(filesystem, temp));
// un-zip
steps.add(new UnzipStep(filesystem, inputPath, temp));
// run reorder tool
steps.add(new DefaultShellStep(filesystem.getRootPath(), ImmutableList.of(reorderTool.toString(), reorderDataFile.toString(), temp.resolve("classes.dex").toString())));
Path outputPath = Paths.get(inputPath.toString().replace(inputSubDir, outputSubDir));
// re-zip
steps.add(new ZipStep(filesystem, outputPath, /* paths */
ImmutableSet.of(), /* junkPaths */
false, ZipCompressionLevel.MAX_COMPRESSION_LEVEL, temp));
} else {
// copy dex
// apply reorder directly on dex
steps.add(CopyStep.forFile(filesystem, inputPrimaryDexPath, outputPrimaryDexPath));
steps.add(new DefaultShellStep(filesystem.getRootPath(), ImmutableList.of(reorderTool.toString(), reorderDataFile.toString(), outputPrimaryDexPath.toString())));
}
return 0;
}
Aggregations