Search in sources :

Example 1 with MoveStep

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

the class AppleBundle method appendDsymRenameStepToMatchBundleName.

private void appendDsymRenameStepToMatchBundleName(ImmutableList.Builder<Step> stepsBuilder, BuildableContext buildableContext, SourcePathResolver pathResolver) {
    Preconditions.checkArgument(hasBinary && appleDsym.isPresent());
    // rename dSYM bundle to match bundle name
    Path dsymPath = pathResolver.getRelativePath(appleDsym.get().getSourcePathToOutput());
    Path dsymSourcePath = bundleRoot.getParent().resolve(dsymPath.getFileName());
    Path dsymDestinationPath = bundleRoot.getParent().resolve(bundleRoot.getFileName() + "." + AppleBundleExtension.DSYM.toFileExtension());
    stepsBuilder.add(new RmStep(getProjectFilesystem(), dsymDestinationPath, RmStep.Mode.RECURSIVE));
    stepsBuilder.add(new MoveStep(getProjectFilesystem(), dsymSourcePath, dsymDestinationPath));
    String dwarfFilename = AppleDsym.getDwarfFilenameForDsymTarget(appleDsym.get().getBuildTarget());
    // rename DWARF file inside dSYM bundle to match bundle name
    Path dwarfFolder = dsymDestinationPath.resolve(AppleDsym.DSYM_DWARF_FILE_FOLDER);
    Path dwarfSourcePath = dwarfFolder.resolve(dwarfFilename);
    Path dwarfDestinationPath = dwarfFolder.resolve(MorePaths.getNameWithoutExtension(bundleRoot));
    stepsBuilder.add(new MoveStep(getProjectFilesystem(), dwarfSourcePath, dwarfDestinationPath));
    // record dSYM so we can fetch it from cache
    buildableContext.recordArtifact(dsymDestinationPath);
}
Also used : Path(java.nio.file.Path) PathSourcePath(com.facebook.buck.rules.PathSourcePath) SourcePath(com.facebook.buck.rules.SourcePath) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) RmStep(com.facebook.buck.step.fs.RmStep) NSString(com.dd.plist.NSString) MoveStep(com.facebook.buck.step.fs.MoveStep)

Example 2 with MoveStep

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

the class AppleDsym method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    buildableContext.recordArtifact(dsymOutputPath);
    Path unstrippedBinaryPath = context.getSourcePathResolver().getAbsolutePath(unstrippedBinarySourcePath);
    Path dwarfFileFolder = dsymOutputPath.resolve(DSYM_DWARF_FILE_FOLDER);
    return ImmutableList.of(new RmStep(getProjectFilesystem(), dsymOutputPath, RmStep.Mode.RECURSIVE), new DsymStep(getProjectFilesystem(), dsymutil.getEnvironment(context.getSourcePathResolver()), dsymutil.getCommandPrefix(context.getSourcePathResolver()), unstrippedBinaryPath, dsymOutputPath), new MoveStep(getProjectFilesystem(), dwarfFileFolder.resolve(unstrippedBinaryPath.getFileName()), dwarfFileFolder.resolve(getDwarfFilenameForDsymTarget(getBuildTarget()))));
}
Also used : ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) RmStep(com.facebook.buck.step.fs.RmStep) MoveStep(com.facebook.buck.step.fs.MoveStep)

Aggregations

ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)2 SourcePath (com.facebook.buck.rules.SourcePath)2 MoveStep (com.facebook.buck.step.fs.MoveStep)2 RmStep (com.facebook.buck.step.fs.RmStep)2 Path (java.nio.file.Path)2 NSString (com.dd.plist.NSString)1 PathSourcePath (com.facebook.buck.rules.PathSourcePath)1