use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class CopyNativeLibraries method addStepsForCopyingStrippedNativeLibrariesOrAssets.
private void addStepsForCopyingStrippedNativeLibrariesOrAssets(SourcePathResolver resolver, ProjectFilesystem filesystem, ImmutableSet<StrippedObjectDescription> strippedNativeLibrariesOrAssets, Path destinationRootDir, ImmutableList.Builder<Step> steps) {
for (StrippedObjectDescription strippedObject : strippedNativeLibrariesOrAssets) {
Optional<String> abiDirectoryComponent = getAbiDirectoryComponent(strippedObject.getTargetCpuType());
Preconditions.checkState(abiDirectoryComponent.isPresent());
Path destination = destinationRootDir.resolve(abiDirectoryComponent.get()).resolve(strippedObject.getStrippedObjectName());
steps.add(new MkdirStep(getProjectFilesystem(), destination.getParent()));
steps.add(CopyStep.forFile(filesystem, resolver.getAbsolutePath(strippedObject.getSourcePath()), destination));
}
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class BuiltinApplePackage method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
ImmutableList.Builder<Step> commands = ImmutableList.builder();
// Remove the output .ipa file if it exists already
commands.add(new RmStep(getProjectFilesystem(), pathToOutputFile));
// Create temp folder to store the files going to be zipped
commands.add(new MakeCleanDirectoryStep(getProjectFilesystem(), temp));
Path payloadDir = temp.resolve("Payload");
commands.add(new MkdirStep(getProjectFilesystem(), payloadDir));
// Recursively copy the .app directory into the Payload folder
Path bundleOutputPath = context.getSourcePathResolver().getRelativePath(Preconditions.checkNotNull(bundle.getSourcePathToOutput()));
appendAdditionalAppleWatchSteps(commands);
commands.add(CopyStep.forDirectory(getProjectFilesystem(), bundleOutputPath, payloadDir, CopyStep.DirectoryMode.DIRECTORY_AND_CONTENTS));
appendAdditionalSwiftSteps(context.getSourcePathResolver(), commands);
// do the zipping
commands.add(new MkdirStep(getProjectFilesystem(), pathToOutputFile.getParent()));
commands.add(new ZipStep(getProjectFilesystem(), pathToOutputFile, ImmutableSet.of(), false, ZipCompressionLevel.DEFAULT_COMPRESSION_LEVEL, temp));
buildableContext.recordArtifact(context.getSourcePathResolver().getRelativePath(getSourcePathToOutput()));
return commands.build();
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class BuiltinApplePackage method appendAdditionalAppleWatchSteps.
private void appendAdditionalAppleWatchSteps(ImmutableList.Builder<Step> commands) {
// 2. WatchKitSupport instead of WatchKitSupport2.
for (BuildRule rule : bundle.getDeps()) {
if (rule instanceof AppleBundle) {
AppleBundle appleBundle = (AppleBundle) rule;
if (appleBundle.getBinary().isPresent()) {
BuildRule binary = appleBundle.getBinary().get();
if (binary instanceof WriteFile && appleBundle.getPlatformName().startsWith("watch")) {
commands.add(new MkdirStep(getProjectFilesystem(), temp.resolve("Symbols")));
Path watchKitSupportDir = temp.resolve("WatchKitSupport2");
commands.add(new MkdirStep(getProjectFilesystem(), watchKitSupportDir));
commands.add(new WriteFileStep(getProjectFilesystem(), ByteSource.wrap(((WriteFile) binary).getFileContents()), watchKitSupportDir.resolve("WK"), true));
} else {
Optional<WriteFile> legacyWatchStub = getLegacyWatchStubFromDeps(appleBundle);
if (legacyWatchStub.isPresent()) {
Path watchKitSupportDir = temp.resolve("WatchKitSupport");
commands.add(new MkdirStep(getProjectFilesystem(), watchKitSupportDir));
commands.add(new WriteFileStep(getProjectFilesystem(), ByteSource.wrap(legacyWatchStub.get().getFileContents()), watchKitSupportDir.resolve("WK"), true));
}
}
}
}
}
}
use of com.facebook.buck.step.fs.MkdirStep in project buck by facebook.
the class MultiarchFile method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
buildableContext.recordArtifact(output);
ImmutableList.Builder<Step> steps = ImmutableList.builder();
steps.add(new MkdirStep(getProjectFilesystem(), output.getParent()));
lipoBinaries(context, steps);
copyLinkMaps(buildableContext, steps);
return steps.build();
}
use of com.facebook.buck.step.fs.MkdirStep 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();
}
Aggregations