Search in sources :

Example 1 with MakeExecutableStep

use of com.facebook.buck.step.fs.MakeExecutableStep in project buck by facebook.

the class RemoteFile method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    Path tempFile = BuildTargets.getScratchPath(getProjectFilesystem(), getBuildTarget(), "%s/" + output.getFileName());
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), tempFile.getParent()));
    steps.add(new DownloadStep(getProjectFilesystem(), downloader, uri, sha1, tempFile));
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), output.getParent()));
    if (type == Type.EXPLODED_ZIP) {
        steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), output));
        steps.add(new UnzipStep(getProjectFilesystem(), tempFile, output));
    } else {
        steps.add(CopyStep.forFile(getProjectFilesystem(), tempFile, output));
    }
    if (type == Type.EXECUTABLE) {
        steps.add(new MakeExecutableStep(getProjectFilesystem(), output));
    }
    buildableContext.recordArtifact(output);
    return steps.build();
}
Also used : ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) UnzipStep(com.facebook.buck.zip.UnzipStep) ImmutableList(com.google.common.collect.ImmutableList) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) Step(com.facebook.buck.step.Step) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) CopyStep(com.facebook.buck.step.fs.CopyStep) UnzipStep(com.facebook.buck.zip.UnzipStep) MakeExecutableStep(com.facebook.buck.step.fs.MakeExecutableStep) MakeExecutableStep(com.facebook.buck.step.fs.MakeExecutableStep)

Aggregations

ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)1 SourcePath (com.facebook.buck.rules.SourcePath)1 Step (com.facebook.buck.step.Step)1 CopyStep (com.facebook.buck.step.fs.CopyStep)1 MakeCleanDirectoryStep (com.facebook.buck.step.fs.MakeCleanDirectoryStep)1 MakeExecutableStep (com.facebook.buck.step.fs.MakeExecutableStep)1 UnzipStep (com.facebook.buck.zip.UnzipStep)1 ImmutableList (com.google.common.collect.ImmutableList)1 Path (java.nio.file.Path)1