Search in sources :

Example 1 with SymCopyStep

use of com.facebook.buck.step.fs.SymCopyStep 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();
}
Also used : DefaultShellStep(com.facebook.buck.shell.DefaultShellStep) ExecutionContext(com.facebook.buck.step.ExecutionContext) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) StepExecutionResult(com.facebook.buck.step.StepExecutionResult) MkdirStep(com.facebook.buck.step.fs.MkdirStep) ImmutableList(com.google.common.collect.ImmutableList) SymCopyStep(com.facebook.buck.step.fs.SymCopyStep) IOException(java.io.IOException)

Aggregations

DefaultShellStep (com.facebook.buck.shell.DefaultShellStep)1 AbstractExecutionStep (com.facebook.buck.step.AbstractExecutionStep)1 ExecutionContext (com.facebook.buck.step.ExecutionContext)1 StepExecutionResult (com.facebook.buck.step.StepExecutionResult)1 MkdirStep (com.facebook.buck.step.fs.MkdirStep)1 SymCopyStep (com.facebook.buck.step.fs.SymCopyStep)1 ImmutableList (com.google.common.collect.ImmutableList)1 IOException (java.io.IOException)1