Search in sources :

Example 56 with MakeCleanDirectoryStep

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

the class TrimUberRDotJava method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    Path output = context.getSourcePathResolver().getRelativePath(getSourcePathToOutput());
    buildableContext.recordArtifact(output);
    return ImmutableList.of(new MakeCleanDirectoryStep(getProjectFilesystem(), output.getParent()), new PerformTrimStep(context.getSourcePathResolver().getAbsolutePath(getSourcePathToOutput())), new ZipScrubberStep(getProjectFilesystem(), output));
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) ZipScrubberStep(com.facebook.buck.zip.ZipScrubberStep)

Example 57 with MakeCleanDirectoryStep

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

the class HaskellPackageRule method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    // Setup the scratch dir.
    Path scratchDir = BuildTargets.getScratchPath(getProjectFilesystem(), getBuildTarget(), "%s");
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), scratchDir));
    // Setup the package DB directory.
    final Path packageDb = getPackageDb();
    steps.add(new RmStep(getProjectFilesystem(), packageDb, RmStep.Mode.RECURSIVE));
    buildableContext.recordArtifact(packageDb);
    // Create the registration file.
    Path registrationFile = scratchDir.resolve("registration-file");
    steps.add(getWriteRegistrationFileStep(context.getSourcePathResolver(), registrationFile, packageDb));
    // Build the the package DB.
    steps.add(new GhcPkgStep(context.getSourcePathResolver(), ImmutableList.of("init", packageDb.toString()), ImmutableMap.of()));
    steps.add(new GhcPkgStep(context.getSourcePathResolver(), ImmutableList.of("-v0", "register", "--package-conf=" + packageDb, "--no-expand-pkgroot", registrationFile.toString()), ImmutableMap.of("GHC_PACKAGE_PATH", depPackages.values().stream().map(input -> context.getSourcePathResolver().getAbsolutePath(input.getPackageDb()).toString()).collect(Collectors.joining(":")))));
    return steps.build();
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) RmStep(com.facebook.buck.step.fs.RmStep) ImmutableList(com.google.common.collect.ImmutableList) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) RmStep(com.facebook.buck.step.fs.RmStep) Step(com.facebook.buck.step.Step) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) ShellStep(com.facebook.buck.shell.ShellStep) WriteFileStep(com.facebook.buck.step.fs.WriteFileStep)

Example 58 with MakeCleanDirectoryStep

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

the class GwtModule method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    Path workingDirectory = outputFile.getParent();
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), workingDirectory));
    // A CopyResourcesStep is needed so that a file that is at java/com/example/resource.txt in the
    // repository will be added as com/example/resource.txt in the resulting JAR (assuming that
    // "/java/" is listed under src_roots in .buckconfig).
    Path tempJarFolder = workingDirectory.resolve("tmp");
    steps.add(new CopyResourcesStep(getProjectFilesystem(), context.getSourcePathResolver(), ruleFinder, getBuildTarget(), filesForGwtModule, tempJarFolder, context.getJavaPackageFinder()));
    steps.add(new JarDirectoryStep(getProjectFilesystem(), outputFile, /* entriesToJar */
    ImmutableSortedSet.of(tempJarFolder), /* mainClass */
    null, /* manifestFile */
    null));
    buildableContext.recordArtifact(outputFile);
    return steps.build();
}
Also used : ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ImmutableList(com.google.common.collect.ImmutableList) JarDirectoryStep(com.facebook.buck.jvm.java.JarDirectoryStep) CopyResourcesStep(com.facebook.buck.jvm.java.CopyResourcesStep) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) Step(com.facebook.buck.step.Step) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) JarDirectoryStep(com.facebook.buck.jvm.java.JarDirectoryStep) CopyResourcesStep(com.facebook.buck.jvm.java.CopyResourcesStep)

Example 59 with MakeCleanDirectoryStep

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

the class ElfSharedLibraryInterface method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    Path output = getOutputDir().resolve(getSharedAbiLibraryName());
    buildableContext.recordArtifact(output);
    return ImmutableList.of(new MakeCleanDirectoryStep(getProjectFilesystem(), getOutputDir()), ElfExtractSectionsStep.of(getProjectFilesystem(), objcopy.getCommandPrefix(context.getSourcePathResolver()), context.getSourcePathResolver().getAbsolutePath(input), output, SECTIONS), ElfClearProgramHeadersStep.of(getProjectFilesystem(), output), ElfSymbolTableScrubberStep.of(getProjectFilesystem(), output, /* section */
    ".dynsym", /* allowMissing */
    false), ElfSymbolTableScrubberStep.of(getProjectFilesystem(), output, /* section */
    ".symtab", /* allowMissing */
    true), ElfDynamicSectionScrubberStep.of(getProjectFilesystem(), output));
}
Also used : ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep)

Example 60 with MakeCleanDirectoryStep

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

the class OcamlBuild method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    Path baseArtifactDir = ocamlContext.getNativeOutput().getParent();
    buildableContext.recordArtifact(baseArtifactDir);
    if (!bytecodeOnly) {
        buildableContext.recordArtifact(baseArtifactDir.resolve(OcamlBuildContext.OCAML_COMPILED_DIR));
    }
    buildableContext.recordArtifact(baseArtifactDir.resolve(OcamlBuildContext.OCAML_COMPILED_BYTECODE_DIR));
    return ImmutableList.of(new MakeCleanDirectoryStep(getProjectFilesystem(), ocamlContext.getNativeOutput().getParent()), new OcamlBuildStep(context.getSourcePathResolver(), getProjectFilesystem(), ocamlContext, cCompiler.getEnvironment(context.getSourcePathResolver()), cCompiler.getCommandPrefix(context.getSourcePathResolver()), cxxCompiler.getEnvironment(context.getSourcePathResolver()), cxxCompiler.getCommandPrefix(context.getSourcePathResolver()), bytecodeOnly));
}
Also used : ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep)

Aggregations

MakeCleanDirectoryStep (com.facebook.buck.step.fs.MakeCleanDirectoryStep)69 Path (java.nio.file.Path)57 SourcePath (com.facebook.buck.rules.SourcePath)53 Step (com.facebook.buck.step.Step)51 ImmutableList (com.google.common.collect.ImmutableList)47 ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)42 MkdirStep (com.facebook.buck.step.fs.MkdirStep)25 ExecutionContext (com.facebook.buck.step.ExecutionContext)18 CopyStep (com.facebook.buck.step.fs.CopyStep)13 RmStep (com.facebook.buck.step.fs.RmStep)11 ImmutableMap (com.google.common.collect.ImmutableMap)11 BuildTarget (com.facebook.buck.model.BuildTarget)10 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)9 BuildContext (com.facebook.buck.rules.BuildContext)9 BuildRuleParams (com.facebook.buck.rules.BuildRuleParams)9 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)9 StepExecutionResult (com.facebook.buck.step.StepExecutionResult)9 AbstractBuildRule (com.facebook.buck.rules.AbstractBuildRule)8 ShellStep (com.facebook.buck.shell.ShellStep)8 AbstractExecutionStep (com.facebook.buck.step.AbstractExecutionStep)8