Java 类com.facebook.buck.rules.BuildableContext 实例源码

项目:buck-cutom    文件:PythonBinary.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {

  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  Path binPath = getBinPath();

  // Make sure the parent directory exists.
  steps.add(new MkdirStep(binPath.getParent()));

  // Generate and return the PEX build step.
  steps.add(new PexStep(
      pathToPex,
      binPath,
      PythonUtil.toModuleName(getBuildTarget(), main.toString()),
      PythonUtil.getPathMapFromSourcePaths(components.getModules()),
      PythonUtil.getPathMapFromSourcePaths(components.getResources())));

  // Record the executable package for caching.
  buildableContext.recordArtifact(getBinPath());

  return steps.build();
}
项目:buck-cutom    文件:AppleResource.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {

  ImmutableList.Builder<Step> steps = ImmutableList.builder();

  for (Path dir : dirs) {
    steps.add(
        CopyStep.forDirectory(
            dir,
            outputDirectory,
            CopyStep.DirectoryMode.DIRECTORY_AND_CONTENTS));
  }

  for (SourcePath file : files) {
    steps.add(CopyStep.forFile(file.resolve(), outputDirectory));
  }

  // TODO(grp): Support copying variant resources like Xcode.

  return steps.build();
}
项目:buck-cutom    文件:NdkLibrary.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {

  // .so files are written to the libs/ subdirectory of the output directory.
  // All of them should be recorded via the BuildableContext.
  Path binDirectory = buildArtifactsDirectory.resolve("libs");
  Step nkdBuildStep = new NdkBuildStep(makefileDirectory,
      buildArtifactsDirectory,
      binDirectory,
      flags);

  Step mkDirStep = new MakeCleanDirectoryStep(genDirectory);
  Step copyStep = CopyStep.forDirectory(
      binDirectory,
      genDirectory,
      CopyStep.DirectoryMode.CONTENTS_ONLY);

  buildableContext.recordArtifactsInDirectory(genDirectory);
  // Some tools need to inspect .so files whose symbols haven't been stripped, so cache these too.
  buildableContext.recordArtifactsInDirectory(buildArtifactsDirectory);
  return ImmutableList.of(nkdBuildStep, mkDirStep, copyStep);
}
项目:buck-cutom    文件:AndroidManifest.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {

  ImmutableList.Builder<Step> commands = ImmutableList.builder();

  // Clear out the old file, if it exists.
  commands.add(new RmStep(pathToOutputFile,
      /* shouldForceDeletion */ true,
      /* shouldRecurse */ false));

  // Make sure the directory for the output file exists.
  commands.add(new MkdirStep(pathToOutputFile.getParent()));

  commands.add(new GenerateManifestStep(
      skeletonFile.resolve(),
      manifestFiles,
      getPathToOutputFile()));

  buildableContext.recordArtifact(pathToOutputFile);
  return commands.build();
}
项目:buck-cutom    文件:ShBinary.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {

  MakeCleanDirectoryStep mkdir = new MakeCleanDirectoryStep(output.getParent());

  // Generate an .sh file that builds up an environment and invokes the user's script.
  // This generated .sh file will be returned by getExecutableCommand().
  GenerateShellScriptStep generateShellScript = new GenerateShellScriptStep(
      getBuildTarget().getBasePath(),
      main.resolve(),
      SourcePaths.toPaths(resources),
      output);

  buildableContext.recordArtifact(output);
  return ImmutableList.of(mkdir, generateShellScript);
}
项目:buck    文件:MavenUberJar.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  Path pathToOutput = context.getSourcePathResolver().getRelativePath(getSourcePathToOutput());
  MkdirStep mkOutputDirStep =
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), pathToOutput.getParent()));
  JarDirectoryStep mergeOutputsStep =
      new JarDirectoryStep(
          getProjectFilesystem(),
          JarParameters.builder()
              .setJarPath(pathToOutput)
              .setEntriesToJar(
                  toOutputPaths(context.getSourcePathResolver(), traversedDeps.packagedDeps))
              .setMergeManifests(true)
              .build());
  return ImmutableList.of(mkOutputDirStep, mergeOutputsStep);
}
项目:buck    文件:JarGenrule.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  buildableContext.recordArtifact(pathToOutput);

  // Ask the super class for its own steps that will produce the jar and then move the jar
  // to the expected output location.
  return ImmutableList.<Step>builder()
      .add(
          RmStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), pathToOutput)))
      .addAll(super.getBuildStepsWithoutRecordingOutput(context))
      .add(new MoveStep(getProjectFilesystem(), super.pathToOutFile, pathToOutput))
      .build();
}
项目:buck    文件:JarBuildStepsFactory.java   
public ImmutableList<Step> getPipelinedBuildStepsForAbiJar(
    BuildTarget buildTarget,
    BuildContext context,
    BuildableContext buildableContext,
    JavacPipelineState state) {
  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  ((JavacToJarStepFactory) configuredCompiler)
      .createPipelinedCompileToJarStep(
          context,
          buildTarget,
          state,
          getResourcesParameters(),
          postprocessClassesCommands,
          steps,
          buildableContext);
  return steps.build();
}
项目:buck    文件:OcamlMLCompile.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  for (Path artifact : args.getAllOutputs()) {
    buildableContext.recordArtifact(artifact);
  }
  return ImmutableList.of(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), args.output.getParent())),
      new OcamlMLCompileStep(
          getBuildTarget(),
          getProjectFilesystem().getRootPath(),
          context.getSourcePathResolver(),
          args));
}
项目:buck    文件:JarBuildStepsFactory.java   
public ImmutableList<Step> getPipelinedBuildStepsForLibraryJar(
    BuildContext context, BuildableContext buildableContext, JavacPipelineState state) {
  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  ((JavacToJarStepFactory) configuredCompiler)
      .createPipelinedCompileToJarStep(
          context,
          libraryTarget,
          state,
          getResourcesParameters(),
          postprocessClassesCommands,
          steps,
          buildableContext);

  JavaLibraryRules.addAccumulateClassNamesStep(
      libraryTarget,
      projectFilesystem,
      getSourcePathToOutput(libraryTarget),
      buildableContext,
      context,
      steps);

  return steps.build();
}
项目:buck    文件:CompareAbis.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  ProjectFilesystem filesystem = getProjectFilesystem();
  SourcePathResolver sourcePathResolver = context.getSourcePathResolver();

  Path classAbiPath = sourcePathResolver.getAbsolutePath(classAbi);
  Path sourceAbiPath = sourcePathResolver.getAbsolutePath(sourceAbi);
  buildableContext.recordArtifact(outputPath);
  return ImmutableList.of(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), outputPath.getParent())),
      DiffAbisStep.of(classAbiPath, sourceAbiPath, verificationMode),
      CopyStep.forFile(filesystem, classAbiPath, outputPath));
}
项目:buck    文件:CalculateClassAbi.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  ImmutableList<Step> result =
      ImmutableList.of(
          MkdirStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(),
                  getProjectFilesystem(),
                  outputPath.getParent())),
          RmStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), outputPath)),
          new CalculateClassAbiStep(
              getProjectFilesystem(),
              context.getSourcePathResolver().getAbsolutePath(binaryJar),
              outputPath,
              compatibilityMode));

  buildableContext.recordArtifact(outputPath);

  return result;
}
项目:buck    文件:HaskellHaddockLibRule.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  String name = getBuildTarget().getShortName();
  Path dir = getOutputDir();

  LOG.verbose(name);

  ImmutableList.Builder<Step> steps = ImmutableList.builder();

  steps.addAll(
      MakeCleanDirectoryStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), dir)));
  steps.add(
      new HaddockStep(
          getBuildTarget(), getProjectFilesystem().getRootPath(), context, Type.HTML));
  steps.add(
      new HaddockStep(
          getBuildTarget(), getProjectFilesystem().getRootPath(), context, Type.HOOGLE));

  buildableContext.recordArtifact(dir);
  return steps.build();
}
项目:buck    文件:CxxCompilationDatabase.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  steps.add(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(),
              getProjectFilesystem(),
              outputJsonFile.getParent())));
  steps.add(
      new GenerateCompilationCommandsJson(
          context.getSourcePathResolver(),
          context.getSourcePathResolver().getRelativePath(getSourcePathToOutput())));
  return steps.build();
}
项目:buck    文件:DirectHeaderMap.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  LOG.debug("Generating build steps to write header map to %s", headerMapPath);
  ImmutableMap.Builder<Path, Path> entriesBuilder = ImmutableMap.builder();
  for (Map.Entry<Path, SourcePath> entry : getLinks().entrySet()) {
    entriesBuilder.put(
        entry.getKey(), context.getSourcePathResolver().getAbsolutePath(entry.getValue()));
  }
  return ImmutableList.<Step>builder()
      .add(getVerifyStep())
      .add(
          MkdirStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(),
                  getProjectFilesystem(),
                  headerMapPath.getParent())))
      .add(
          RmStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), headerMapPath)))
      .add(new HeaderMapStep(getProjectFilesystem(), headerMapPath, entriesBuilder.build()))
      .build();
}
项目:buck    文件:CxxPrecompiledHeader.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  try {
    CxxHeaders.checkConflictingHeaders(preprocessorDelegate.getCxxIncludePaths().getIPaths());
  } catch (CxxHeaders.ConflictingHeadersException e) {
    throw e.getHumanReadableExceptionForBuildTarget(getBuildTarget());
  }

  Path scratchDir =
      BuildTargets.getScratchPath(getProjectFilesystem(), getBuildTarget(), "%s_tmp");

  return new ImmutableList.Builder<Step>()
      .add(
          MkdirStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), output.getParent())))
      .addAll(
          MakeCleanDirectoryStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), scratchDir)))
      .add(makeMainStep(context.getSourcePathResolver(), scratchDir))
      .build();
}
项目:buck    文件:PrebuiltDotnetLibrary.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  ImmutableList.Builder<Step> steps = ImmutableList.builder();

  steps.add(
      RmStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), output)));
  steps.add(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), output.getParent())));
  steps.add(
      CopyStep.forFile(
          getProjectFilesystem(),
          context.getSourcePathResolver().getAbsolutePath(assembly),
          output));

  return steps.build();
}
项目:buck    文件:CGoGenImport.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {

  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  steps.addAll(
      MakeCleanDirectoryStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), genDir)));
  steps.add(
      new CGoGenerateImportStep(
          getBuildTarget(),
          getProjectFilesystem().getRootPath(),
          cgo.getCommandPrefix(pathResolver),
          platform,
          packageName,
          pathResolver.getAbsolutePath(cgoBin),
          outputFile));

  buildableContext.recordArtifact(outputFile);
  return steps.build();
}
项目:buck    文件:CGoGenSource.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {

  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  steps.addAll(
      MakeCleanDirectoryStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), genDir)));
  steps.add(
      new CGoCompileStep(
          getBuildTarget(),
          getProjectFilesystem().getRootPath(),
          cgo.getEnvironment(context.getSourcePathResolver()),
          cgo.getCommandPrefix(context.getSourcePathResolver()),
          cgoCompilerFlags,
          cgoSrcs
              .stream()
              .map(context.getSourcePathResolver()::getAbsolutePath)
              .collect(ImmutableList.toImmutableList()),
          platform,
          genDir));

  buildableContext.recordArtifact(genDir);
  return steps.build();
}
项目:buck    文件:GoTestMain.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  buildableContext.recordArtifact(output);
  return ImmutableList.<Step>builder()
      .add(
          MkdirStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), output.getParent())))
      .add(
          new GoTestMainStep(
              getBuildTarget(),
              getProjectFilesystem().getRootPath(),
              testMainGen.getEnvironment(context.getSourcePathResolver()),
              testMainGen.getCommandPrefix(context.getSourcePathResolver()),
              coverageMode,
              coverVariables,
              testPackage,
              testSources
                  .stream()
                  .map(context.getSourcePathResolver()::getAbsolutePath)
                  .collect(ImmutableList.toImmutableList()),
              output))
      .build();
}
项目:buck    文件:StripLinkable.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {

  ImmutableList.Builder<Step> steps = ImmutableList.builder();

  steps.add(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), resultDir)));
  Path output = context.getSourcePathResolver().getRelativePath(getSourcePathToOutput());
  steps.add(
      new StripStep(
          getBuildTarget(),
          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();
}
项目:buck    文件:AppleBundle.java   
private void appendCopyDsymStep(
    ImmutableList.Builder<Step> stepsBuilder,
    BuildableContext buildableContext,
    BuildContext buildContext) {
  if (appleDsym.isPresent()) {
    stepsBuilder.add(
        CopyStep.forDirectory(
            getProjectFilesystem(),
            buildContext
                .getSourcePathResolver()
                .getRelativePath(appleDsym.get().getSourcePathToOutput()),
            bundleRoot.getParent(),
            CopyStep.DirectoryMode.DIRECTORY_AND_CONTENTS));
    appendDsymRenameStepToMatchBundleName(stepsBuilder, buildableContext, buildContext);
  }
}
项目:buck    文件:PrebuiltAppleFramework.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  // This file is copied rather than symlinked so that when it is included in an archive zip and
  // unpacked on another machine, it is an ordinary file in both scenarios.
  ImmutableList.Builder<Step> builder = ImmutableList.builder();
  builder.add(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), out.getParent())));
  builder.add(
      RmStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), out))
          .withRecursive(true));
  builder.add(
      CopyStep.forDirectory(
          getProjectFilesystem(),
          context.getSourcePathResolver().getAbsolutePath(frameworkPath),
          out,
          CopyStep.DirectoryMode.CONTENTS_ONLY));

  buildableContext.recordArtifact(out);
  return builder.build();
}
项目:buck    文件:MultiarchFile.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  buildableContext.recordArtifact(output);

  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  steps.add(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), output.getParent())));

  lipoBinaries(context, steps);
  copyLinkMaps(buildableContext, context, steps);

  return steps.build();
}
项目:buck    文件:AppleDsym.java   
@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(
      RmStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(), getProjectFilesystem(), dsymOutputPath))
          .withRecursive(true),
      new DsymStep(
          getBuildTarget(),
          getProjectFilesystem(),
          dsymutil.getEnvironment(context.getSourcePathResolver()),
          dsymutil.getCommandPrefix(context.getSourcePathResolver()),
          unstrippedBinaryPath,
          dsymOutputPath),
      new MoveStep(
          getProjectFilesystem(),
          dwarfFileFolder.resolve(unstrippedBinaryPath.getFileName()),
          dwarfFileFolder.resolve(getDwarfFilenameForDsymTarget(getBuildTarget()))));
}
项目:buck    文件:ResourcesFilter.java   
private void maybeAddPostFilterCmdStep(
    BuildContext context,
    BuildableContext buildableContext,
    ImmutableList.Builder<Step> steps,
    ImmutableBiMap<Path, Path> inResDirToOutResDirMap) {
  postFilterResourcesCmd.ifPresent(
      cmd -> {
        OutputStream filterResourcesDataOutputStream = null;
        try {
          Path filterResourcesDataPath = getFilterResourcesDataPath();
          getProjectFilesystem().createParentDirs(filterResourcesDataPath);
          filterResourcesDataOutputStream =
              getProjectFilesystem().newFileOutputStream(filterResourcesDataPath);
          writeFilterResourcesData(filterResourcesDataOutputStream, inResDirToOutResDirMap);
          buildableContext.recordArtifact(filterResourcesDataPath);
          addPostFilterCommandSteps(cmd, context.getSourcePathResolver(), steps);
        } catch (IOException e) {
          throw new RuntimeException("Could not generate/save filter resources data json", e);
        } finally {
          IOUtils.closeQuietly(filterResourcesDataOutputStream);
        }
      });
}
项目:buck    文件:JsLibrary.java   
private static ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext,
    BuildTargetSourcePath output,
    ProjectFilesystem filesystem,
    WorkerTool worker,
    BiFunction<SourcePathResolver, Path, String> jobArgs) {
  SourcePathResolver resolver = context.getSourcePathResolver();
  Path outputPath = resolver.getAbsolutePath(output);
  buildableContext.recordArtifact(resolver.getRelativePath(output));
  return ImmutableList.of(
      RmStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), filesystem, outputPath)),
      JsUtil.workerShellStep(
          worker, jobArgs.apply(resolver, outputPath), output.getTarget(), resolver, filesystem));
}
项目:buck    文件:JsDependenciesFile.java   
@Override
public ImmutableList<? extends Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  final SourcePathResolver sourcePathResolver = context.getSourcePathResolver();

  SourcePath outputFile = getSourcePathToOutput();
  String jobArgs = getJobArgs(sourcePathResolver, outputFile);

  buildableContext.recordArtifact(sourcePathResolver.getRelativePath(outputFile));

  return ImmutableList.<Step>builder()
      .add(
          MkdirStep.of(
              BuildCellRelativePath.fromCellRelativePath(
                  context.getBuildCellRootPath(),
                  getProjectFilesystem(),
                  sourcePathResolver.getRelativePath(outputFile).getParent())),
          JsUtil.workerShellStep(
              worker, jobArgs, getBuildTarget(), sourcePathResolver, getProjectFilesystem()))
      .build();
}
项目:buck    文件:AndroidBinaryNonExoInstaller.java   
@Override
public ImmutableList<? extends Step> getBuildSteps(
    BuildContext buildContext, BuildableContext buildableContext) {
  return ImmutableList.of(
      new AbstractExecutionStep("install_apk") {
        @Override
        public StepExecutionResult execute(ExecutionContext context)
            throws IOException, InterruptedException {
          trigger.verify(context);
          boolean result =
              context
                  .getAndroidDevicesHelper()
                  .get()
                  .installApk(buildContext.getSourcePathResolver(), apk, false, true, null);
          return result ? StepExecutionResults.SUCCESS : StepExecutionResults.ERROR;
        }
      });
}
项目:buck    文件:MergeAndroidResourceSources.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  steps.addAll(
      MakeCleanDirectoryStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), destinationDirectory)));
  steps.add(
      MergeAndroidResourceSourcesStep.builder()
          .setResPaths(
              originalDirectories
                  .stream()
                  .map(context.getSourcePathResolver()::getAbsolutePath)
                  .collect(ImmutableList.toImmutableList()))
          .setOutFolderPath(getProjectFilesystem().resolve(destinationDirectory))
          .setTmpFolderPath(getProjectFilesystem().resolve(tempDirectory))
          .build());
  buildableContext.recordArtifact(destinationDirectory);
  return steps.build();
}
项目:buck    文件:PreDexMerge.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {

  ImmutableList.Builder<Step> steps = ImmutableList.builder();
  steps.add(
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(), getProjectFilesystem(), getPrimaryDexRoot())));

  if (dexSplitMode.isShouldSplitDex()) {
    addStepsForSplitDex(steps, context, buildableContext);
  } else {
    addStepsForSingleDex(steps, buildableContext);
  }
  return steps.build();
}
项目:buck-cutom    文件:Archive.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {
  return ImmutableList.of(
      new MkdirStep(output.getParent()),
      new RmStep(output, /* shouldForceDeletion */ true),
      new ArchiveStep(archiver, output, inputs));
}
项目:buck-cutom    文件:CxxLink.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  buildableContext.recordArtifact(output);
  return ImmutableList.of(
      new MkdirStep(output.getParent()),
      new CxxLinkStep(
          linker,
          output,
          args));
}
项目:buck-cutom    文件:CxxHeader.java   
/**
 * @return an empty list, as no actions need to be performed.
 */
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {
  return ImmutableList.of();
}
项目:buck-cutom    文件:CxxCompile.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {
  buildableContext.recordArtifact(output);
  return ImmutableList.of(
      new MkdirStep(output.getParent()),
      new CxxCompileStep(compiler, flags, output, input.resolve(), includes, systemIncludes));
}
项目:buck-cutom    文件:DefaultJavaLibrary.java   
/**
 * Assuming the build has completed successfully, the ABI should have been computed, and it should
 * be stored for subsequent builds.
 */
private void addStepsToRecordAbiToDisk(ImmutableList.Builder<Step> commands,
    final Supplier<Sha1HashCode> abiKeySupplier,
    final BuildableContext buildableContext) {
  // Note that the parent directories for all of the files written by these steps should already
  // have been created by a previous step. Therefore, there is no reason to add a MkdirStep here.
  commands.add(new AbstractExecutionStep("recording ABI metadata") {
    @Override
    public int execute(ExecutionContext context) {
      Sha1HashCode abiKey = abiKeySupplier.get();
      buildableContext.addMetadata(ABI_KEY_ON_DISK_METADATA, abiKey.getHash());
      return 0;
    }
  });
}
项目:buck-cutom    文件:JavaLibraryRules.java   
static void addAccumulateClassNamesStep(JavaLibrary javaLibrary,
    BuildableContext buildableContext,
    ImmutableList.Builder<Step> steps) {
  Preconditions.checkNotNull(javaLibrary);

  Path pathToClassHashes = JavaLibraryRules.getPathToClassHashes(
      javaLibrary.getBuildTarget());
  steps.add(new MkdirStep(pathToClassHashes.getParent()));
  steps.add(new AccumulateClassNamesStep(
      Optional.fromNullable(javaLibrary.getPathToOutputFile()),
      pathToClassHashes));
  buildableContext.recordArtifact(pathToClassHashes);
}
项目:buck-cutom    文件:JavaSourceJar.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context, BuildableContext buildableContext) {
  JavaPackageFinder packageFinder = context.getJavaPackageFinder();

  ImmutableList.Builder<Step> steps = ImmutableList.builder();

  steps.add(new MkdirStep(output.getParent()));
  steps.add(new RmStep(output, /* force deletion */ true));
  steps.add(new MakeCleanDirectoryStep(temp));

  Set<Path> seenPackages = Sets.newHashSet();

  // We only want to consider raw source files, since the java package finder doesn't have the
  // smarts to read the "package" line from a source file.

  for (Path source : SourcePaths.filterInputsToCompareToOutput(sources)) {
    String packageFolder = packageFinder.findJavaPackageFolderForPath(source.toString());
    Path packageDir = temp.resolve(packageFolder);
    if (seenPackages.add(packageDir)) {
      steps.add(new MkdirStep(packageDir));
    }
    steps.add(CopyStep.forFile(source, packageDir.resolve(source.getFileName())));
  }
  steps.add(new ZipStep(
          output,
          ImmutableSet.<Path>of(),
          /* junk paths */ false,
          DEFAULT_COMPRESSION_LEVEL,
          temp));

  buildableContext.recordArtifact(output);

  return steps.build();
}
项目:buck-cutom    文件:PrebuiltJar.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    final BuildableContext buildableContext) {
  ImmutableList.Builder<Step> steps = ImmutableList.builder();

  // Create a step to compute the ABI key.
  steps.add(new CalculateAbiStep(buildableContext));

  JavaLibraryRules.addAccumulateClassNamesStep(this, buildableContext, steps);

  return steps.build();
}
项目:buck-cutom    文件:Keystore.java   
@Override
public ImmutableList<Step> getBuildSteps(
    BuildContext context,
    BuildableContext buildableContext) {
  // Nothing to build: this is like a glorified exported_deps() rule.
  return ImmutableList.of();
}