Search in sources :

Example 11 with MkdirStep

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

the class Archive method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    // Cache the archive we built.
    buildableContext.recordArtifact(output);
    SourcePathResolver resolver = context.getSourcePathResolver();
    // paths.
    for (SourcePath input : inputs) {
        Preconditions.checkState(resolver.getFilesystem(input).getRootPath().equals(getProjectFilesystem().getRootPath()));
    }
    ImmutableList.Builder<Step> builder = ImmutableList.builder();
    builder.add(new MkdirStep(getProjectFilesystem(), output.getParent()), new RmStep(getProjectFilesystem(), output), new ArchiveStep(getProjectFilesystem(), archiver.getEnvironment(resolver), archiver.getCommandPrefix(resolver), archiverFlags, archiver.getArchiveOptions(contents == Contents.THIN), output, inputs.stream().map(resolver::getRelativePath).collect(MoreCollectors.toImmutableList()), archiver));
    if (archiver.isRanLibStepRequired()) {
        builder.add(new RanlibStep(getProjectFilesystem(), ranlib.getEnvironment(resolver), ranlib.getCommandPrefix(resolver), ranlibFlags, output));
    }
    if (!archiver.getScrubbers().isEmpty()) {
        builder.add(new FileScrubberStep(getProjectFilesystem(), output, archiver.getScrubbers()));
    }
    return builder.build();
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) RmStep(com.facebook.buck.step.fs.RmStep) ImmutableList(com.google.common.collect.ImmutableList) MkdirStep(com.facebook.buck.step.fs.MkdirStep) RmStep(com.facebook.buck.step.fs.RmStep) Step(com.facebook.buck.step.Step) MkdirStep(com.facebook.buck.step.fs.MkdirStep) FileScrubberStep(com.facebook.buck.step.fs.FileScrubberStep) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) FileScrubberStep(com.facebook.buck.step.fs.FileScrubberStep)

Example 12 with MkdirStep

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

the class CxxCompilationDatabase method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    steps.add(new MkdirStep(getProjectFilesystem(), outputJsonFile.getParent()));
    steps.add(new GenerateCompilationCommandsJson(context.getSourcePathResolver(), context.getSourcePathResolver().getRelativePath(getSourcePathToOutput())));
    return steps.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) MkdirStep(com.facebook.buck.step.fs.MkdirStep) Step(com.facebook.buck.step.Step) MkdirStep(com.facebook.buck.step.fs.MkdirStep) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep)

Example 13 with MkdirStep

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

the class GwtBinary method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    // Create a clean directory where the .zip file will be written.
    Path workingDirectory = context.getSourcePathResolver().getRelativePath(getSourcePathToOutput()).getParent();
    ProjectFilesystem projectFilesystem = getProjectFilesystem();
    steps.add(new MakeCleanDirectoryStep(projectFilesystem, workingDirectory));
    // Write the deploy files into a separate directory so that the generated .zip is smaller.
    final Path deployDirectory = workingDirectory.resolve("deploy");
    steps.add(new MkdirStep(projectFilesystem, deployDirectory));
    Step javaStep = new ShellStep(projectFilesystem.getRootPath()) {

        @Override
        public String getShortName() {
            return "gwt-compile";
        }

        @Override
        protected ImmutableList<String> getShellCommandInternal(ExecutionContext executionContext) {
            ImmutableList.Builder<String> javaArgsBuilder = ImmutableList.builder();
            javaArgsBuilder.add(javaRuntimeLauncher.getCommand());
            javaArgsBuilder.add("-Dgwt.normalizeTimestamps=true");
            javaArgsBuilder.addAll(vmArgs);
            javaArgsBuilder.add("-classpath", Joiner.on(File.pathSeparator).join(Iterables.transform(getClasspathEntries(context.getSourcePathResolver()), getProjectFilesystem()::resolve)), GWT_COMPILER_CLASS, "-war", context.getSourcePathResolver().getAbsolutePath(getSourcePathToOutput()).toString(), "-style", style.name(), "-optimize", String.valueOf(optimize), "-localWorkers", String.valueOf(localWorkers), "-deploy", getProjectFilesystem().resolve(deployDirectory).toString());
            if (draftCompile) {
                javaArgsBuilder.add("-draftCompile");
            }
            if (strict) {
                javaArgsBuilder.add("-strict");
            }
            javaArgsBuilder.addAll(experimentalArgs);
            javaArgsBuilder.addAll(modules);
            final ImmutableList<String> javaArgs = javaArgsBuilder.build();
            return javaArgs;
        }
    };
    steps.add(javaStep);
    buildableContext.recordArtifact(context.getSourcePathResolver().getRelativePath(getSourcePathToOutput()));
    return steps.build();
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) ExecutionContext(com.facebook.buck.step.ExecutionContext) ImmutableList(com.google.common.collect.ImmutableList) MkdirStep(com.facebook.buck.step.fs.MkdirStep) ShellStep(com.facebook.buck.shell.ShellStep) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) Step(com.facebook.buck.step.Step) MkdirStep(com.facebook.buck.step.fs.MkdirStep) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) ShellStep(com.facebook.buck.shell.ShellStep) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem)

Example 14 with MkdirStep

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

the class PrebuiltDotnetLibrary method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    steps.add(new RmStep(getProjectFilesystem(), output));
    steps.add(new MkdirStep(getProjectFilesystem(), output.getParent()));
    steps.add(CopyStep.forFile(getProjectFilesystem(), getResolver().getAbsolutePath(assembly), output));
    return steps.build();
}
Also used : RmStep(com.facebook.buck.step.fs.RmStep) ImmutableList(com.google.common.collect.ImmutableList) MkdirStep(com.facebook.buck.step.fs.MkdirStep) RmStep(com.facebook.buck.step.fs.RmStep) Step(com.facebook.buck.step.Step) CopyStep(com.facebook.buck.step.fs.CopyStep) MkdirStep(com.facebook.buck.step.fs.MkdirStep)

Example 15 with MkdirStep

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

the class WriteFile method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    buildableContext.recordArtifact(output);
    ProjectFilesystem projectFilesystem = getProjectFilesystem();
    return ImmutableList.of(new MkdirStep(projectFilesystem, output.getParent()), new WriteFileStep(projectFilesystem, ByteSource.wrap(fileContents), output, executable));
}
Also used : MkdirStep(com.facebook.buck.step.fs.MkdirStep) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) WriteFileStep(com.facebook.buck.step.fs.WriteFileStep)

Aggregations

MkdirStep (com.facebook.buck.step.fs.MkdirStep)61 Path (java.nio.file.Path)44 SourcePath (com.facebook.buck.rules.SourcePath)43 Step (com.facebook.buck.step.Step)41 ImmutableList (com.google.common.collect.ImmutableList)38 ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)34 MakeCleanDirectoryStep (com.facebook.buck.step.fs.MakeCleanDirectoryStep)27 RmStep (com.facebook.buck.step.fs.RmStep)20 CopyStep (com.facebook.buck.step.fs.CopyStep)14 ExecutionContext (com.facebook.buck.step.ExecutionContext)13 AbstractExecutionStep (com.facebook.buck.step.AbstractExecutionStep)12 WriteFileStep (com.facebook.buck.step.fs.WriteFileStep)10 ImmutableMap (com.google.common.collect.ImmutableMap)10 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)8 IOException (java.io.IOException)7 ImmutableSet (com.google.common.collect.ImmutableSet)6 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)6 BuildTarget (com.facebook.buck.model.BuildTarget)5 AbstractBuildRule (com.facebook.buck.rules.AbstractBuildRule)5 PathSourcePath (com.facebook.buck.rules.PathSourcePath)5