use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class StripLinkable method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
ImmutableList.Builder<Step> steps = ImmutableList.builder();
steps.add(new MkdirStep(getProjectFilesystem(), resultDir));
Path output = context.getSourcePathResolver().getRelativePath(getSourcePathToOutput());
steps.add(new StripStep(getProjectFilesystem().getRootPath(), stripTool.getEnvironment(context.getSourcePathResolver()), stripTool.getCommandPrefix(context.getSourcePathResolver()), ImmutableList.of("--strip-unneeded"), context.getSourcePathResolver().getAbsolutePath(sourcePathToStrip), output));
buildableContext.recordArtifact(output);
return steps.build();
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class DirectHeaderMap method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
LOG.debug("Generating post-build steps to write header map to %s", headerMapPath);
ImmutableMap.Builder<Path, Path> headerMapEntries = ImmutableMap.builder();
Path buckOut = getProjectFilesystem().resolve(getProjectFilesystem().getBuckPaths().getBuckOut());
for (Path key : getLinks().keySet()) {
Path path = buckOut.relativize(context.getSourcePathResolver().getAbsolutePath(getLinks().get(key)));
LOG.debug("header map %s -> %s", key, path);
headerMapEntries.put(key, path);
}
return ImmutableList.<Step>builder().add(getVerifyStep()).add(new MkdirStep(getProjectFilesystem(), headerMapPath.getParent())).add(new RmStep(getProjectFilesystem(), headerMapPath)).add(new HeaderMapStep(getProjectFilesystem(), headerMapPath, headerMapEntries.build())).build();
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class OcamlLink method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
for (Path artifact : getAllOutputs()) {
buildableContext.recordArtifact(artifact);
}
ImmutableList.Builder<Step> steps = ImmutableList.<Step>builder().add(new MkdirStep(getProjectFilesystem(), outputRelativePath.getParent())).add(OcamlLinkStep.create(getProjectFilesystem().getRootPath(), cxxCompilerEnvironment, cxxCompiler, ocamlCompiler.getCommandPrefix(context.getSourcePathResolver()), flags, stdlib, getProjectFilesystem().resolve(outputRelativePath), depInput, cDepInput, inputs.stream().map(context.getSourcePathResolver()::getAbsolutePath).collect(MoreCollectors.toImmutableList()), isLibrary, isBytecode, context.getSourcePathResolver()));
if (isLibrary && buildNativePlugin) {
ImmutableList.Builder<String> ocamlInputBuilder = ImmutableList.builder();
final String linkExt = OcamlCompilables.OCAML_CMXS;
for (String linkInput : Arg.stringify(depInput, context.getSourcePathResolver())) {
if (linkInput.endsWith(linkExt)) {
ocamlInputBuilder.add(linkInput);
}
}
ImmutableList<String> ocamlInput = ocamlInputBuilder.build();
steps.add(new OcamlNativePluginStep(getProjectFilesystem().getRootPath(), cxxCompilerEnvironment, cxxCompiler, ocamlCompiler.getCommandPrefix(context.getSourcePathResolver()), Arg.stringify(flags, context.getSourcePathResolver()), stdlib, getProjectFilesystem().resolve(outputNativePluginPath), cDepInput, inputs.stream().map(context.getSourcePathResolver()::getAbsolutePath).collect(MoreCollectors.toImmutableList()), ocamlInput));
}
return steps.build();
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class DirectHeaderMapTest method testBuildSteps.
@Test
public void testBuildSteps() throws IOException {
BuildContext buildContext = FakeBuildContext.withSourcePathResolver(pathResolver);
FakeBuildableContext buildableContext = new FakeBuildableContext();
ImmutableList<Step> expectedBuildSteps = ImmutableList.of(new MkdirStep(projectFilesystem, headerMapPath.getParent()), new RmStep(projectFilesystem, headerMapPath), new HeaderMapStep(projectFilesystem, headerMapPath, ImmutableMap.of(Paths.get("file"), projectFilesystem.resolve(projectFilesystem.getBuckPaths().getBuckOut()).relativize(file1), Paths.get("directory/then/file"), projectFilesystem.resolve(projectFilesystem.getBuckPaths().getBuckOut()).relativize(file2))));
ImmutableList<Step> actualBuildSteps = buildRule.getBuildSteps(buildContext, buildableContext);
assertEquals(expectedBuildSteps, actualBuildSteps.subList(1, actualBuildSteps.size()));
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class GenAidl method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
ImmutableList.Builder<Step> commands = ImmutableList.builder();
commands.add(new MakeCleanDirectoryStep(getProjectFilesystem(), genPath));
BuildTarget target = getBuildTarget();
Path outputDirectory = BuildTargets.getScratchPath(getProjectFilesystem(), target, "__%s.aidl");
commands.add(new MakeCleanDirectoryStep(getProjectFilesystem(), outputDirectory));
AidlStep command = new AidlStep(getProjectFilesystem(), target, context.getSourcePathResolver().getAbsolutePath(aidlFilePath), ImmutableSet.of(importPath), outputDirectory);
commands.add(command);
// Files must ultimately be written to GEN_DIR to be used as source paths.
Path genDirectory = getProjectFilesystem().getBuckPaths().getGenDir().resolve(importPath);
// Warn the user if the genDirectory is not under the output directory.
if (!importPath.startsWith(target.getBasePath().toString())) {
// TODO(shs96c): Make this fatal. Give people some time to clean up their rules.
context.getEventBus().post(ConsoleEvent.warning("%s, gen_aidl import path (%s) should be a child of %s", target, importPath, target.getBasePath()));
}
commands.add(new MkdirStep(getProjectFilesystem(), genDirectory));
commands.add(new JarDirectoryStep(getProjectFilesystem(), output, ImmutableSortedSet.of(outputDirectory), /* main class */
null, /* manifest */
null));
buildableContext.recordArtifact(output);
return commands.build();
}
Aggregations