当前位置: 首页>>代码示例>>Java>>正文


Java BuildContext类代码示例

本文整理汇总了Java中com.facebook.buck.rules.BuildContext的典型用法代码示例。如果您正苦于以下问题:Java BuildContext类的具体用法?Java BuildContext怎么用?Java BuildContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BuildContext类属于com.facebook.buck.rules包,在下文中一共展示了BuildContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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();
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:25,代码来源:PythonBinary.java

示例2: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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();
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:24,代码来源:AppleResource.java

示例3: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:25,代码来源:NdkLibrary.java

示例4: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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();
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:24,代码来源:AndroidManifest.java

示例5: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:19,代码来源:ShBinary.java

示例6: runTests

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@Override
public ImmutableList<Step> runTests(
    BuildContext buildContext,
    ExecutionContext executionContext,
    boolean isDryRun,
    TestSelectorList testSelectorList) {
  if (isDryRun) {
    // Stop now if we are a dry-run: sh-tests have no concept of dry-run inside the test itself.
    return ImmutableList.of();
  }

  Step mkdirClean = new MakeCleanDirectoryStep(getPathToTestOutputDirectory());

  // Return a single command that runs an .sh file with no arguments.
  Step runTest = new RunShTestAndRecordResultStep(
      test.resolve(),
      getPathToTestOutputResult());

  return ImmutableList.of(mkdirClean, runTest);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:21,代码来源:ShTest.java

示例7: executeBuild

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
public ListenableFuture<List<BuildRuleSuccess>> executeBuild(
    Set<BuildRule> rulesToBuild)
    throws IOException, StepFailedException {
  buildContext = BuildContext.builder()
      .setActionGraph(actionGraph)
      .setStepRunner(stepRunner)
      .setProjectFilesystem(executionContext.getProjectFilesystem())
      .setArtifactCache(artifactCache)
      .setJavaPackageFinder(javaPackageFinder)
      .setEventBus(executionContext.getBuckEventBus())
      .setAndroidBootclasspathForAndroidPlatformTarget(
          executionContext.getAndroidPlatformTargetOptional())
      .setBuildDependencies(buildDependencies)
      .build();

  return Builder.getInstance().buildRules(buildEngine, rulesToBuild, buildContext);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:18,代码来源:Build.java

示例8: finalStepShouldBeJarringUpExtension

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@Test
public void finalStepShouldBeJarringUpExtension() throws IOException {
  BuildTarget target = BuildTargetFactory.newInstance("//example:extension");
  BuckExtension buildable = new BuckExtension(
      new FakeBuildRuleParamsBuilder(target).build(),
      ImmutableSortedSet.of(new TestSourcePath("ExampleExtension.java")),
      ImmutableSortedSet.<SourcePath>of());

  BuildContext buildContext = FakeBuildContext.NOOP_CONTEXT;
  FakeBuildableContext buildableContext = new FakeBuildableContext();

  List<Step> steps = buildable.getBuildSteps(buildContext, buildableContext);

  // Compiling and copying resources must occur before jarring.
  assertTrue(Iterables.getLast(steps) instanceof JarDirectoryStep);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:17,代码来源:BuckExtensionTest.java

示例9: testEmptySuggestBuildFunction

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@Test
public void testEmptySuggestBuildFunction() {
  BuildRuleResolver ruleResolver = new BuildRuleResolver();

  BuildTarget libraryOneTarget = BuildTargetFactory.newInstance("//:libone");
  JavaLibrary libraryOne = (JavaLibrary) JavaLibraryBuilder
      .createBuilder(libraryOneTarget)
      .addSrc(Paths.get("java/src/com/libone/bar.java"))
      .build();

  BuildContext context = createSuggestContext(ruleResolver,
      BuildDependencies.FIRST_ORDER_ONLY);

  ImmutableSetMultimap<JavaLibrary, Path> classpathEntries =
      libraryOne.getTransitiveClasspathEntries();

  assertEquals(
      Optional.<JavacInMemoryStep.SuggestBuildRules>absent(),
      ((DefaultJavaLibrary) libraryOne).createSuggestBuildFunction(
          context,
          classpathEntries,
          classpathEntries,
          createJarResolver(/* classToSymbols */ImmutableMap.<Path, String>of())));

  EasyMock.verify(context);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:27,代码来源:DefaultJavaLibraryTest.java

示例10: testGetInputsToCompareToOuts

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@Test
public void testGetInputsToCompareToOuts() {
  BuildRuleResolver ruleResolver = new BuildRuleResolver();
  BuildRule androidLibraryBuilderBar = getAndroidLibraryRuleBar(ruleResolver);
  BuildRule androidLibraryBuilderFoo = getAndroidLibraryRuleFoo(ruleResolver);
  BuildContext context = createMock(BuildContext.class);
  replay(context);

  MoreAsserts.assertIterablesEquals(
      "getInputsToCompareToOutput() should include manifest and src.",
      ImmutableList.of(
          Paths.get("java/src/com/foo/Foo.java"),
          Paths.get("java/src/com/foo/AndroidManifest.xml")),
      androidLibraryBuilderFoo.getInputs());

  MoreAsserts.assertIterablesEquals(
      "getInputsToCompareToOutput() should include only src.",
      ImmutableList.of(Paths.get("java/src/com/bar/Bar.java")),
      androidLibraryBuilderBar.getInputs());

  assertEquals(
      "foo's exported deps should include bar",
      ImmutableSet.of(androidLibraryBuilderBar),
      ((AndroidLibrary) (androidLibraryBuilderFoo)).getExportedDeps());
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:26,代码来源:AndroidLibraryTest.java

示例11: testBuildInternal

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@Test
public void testBuildInternal() throws IOException {
  AndroidManifest androidManifest = createSimpleAndroidManifestRule();

  // Mock out a BuildContext whose DependencyGraph will be traversed.
  BuildContext buildContext = EasyMock.createMock(BuildContext.class);
  EasyMock.replay(buildContext);

  List<Step> steps = androidManifest.getBuildSteps(buildContext, new FakeBuildableContext());
  Step generateManifestStep = steps.get(2);
  assertEquals(
      new GenerateManifestStep(
          Paths.get("java/com/example/AndroidManifestSkeleton.xml"),
          /* libraryManifestPaths */ ImmutableSet.<SourcePath>of(),
          BuckConstant.GEN_PATH.resolve("java/com/example/AndroidManifest__manifest__.xml")),
      generateManifestStep);

  EasyMock.verify(buildContext);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:20,代码来源:AndroidManifestTest.java

示例12: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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);
}
 
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:MavenUberJar.java

示例13: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@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;
        }
      });
}
 
开发者ID:facebook,项目名称:buck,代码行数:19,代码来源:AndroidBinaryNonExoInstaller.java

示例14: createsMiscDir

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
@Test
public void createsMiscDir() {
  setUpWithRewriteMiscDir();

  JsBundleGenrule genrule = setup.genrule();
  BuildContext context = FakeBuildContext.withSourcePathResolver(sourcePathResolver());
  FakeBuildableContext buildableContext = new FakeBuildableContext();
  ImmutableList<Step> buildSteps =
      ImmutableList.copyOf(genrule.getBuildSteps(context, buildableContext));

  MkdirStep expectedStep =
      MkdirStep.of(
          BuildCellRelativePath.fromCellRelativePath(
              context.getBuildCellRootPath(),
              genrule.getProjectFilesystem(),
              context.getSourcePathResolver().getRelativePath(genrule.getSourcePathToMisc())));
  assertThat(buildSteps, hasItem(expectedStep));

  int mkMiscDirIdx = buildSteps.indexOf(expectedStep);
  assertThat(
      buildSteps.subList(mkMiscDirIdx, buildSteps.size()), not(hasItem(any(RmStep.class))));
}
 
开发者ID:facebook,项目名称:buck,代码行数:23,代码来源:JsBundleGenruleDescriptionTest.java

示例15: getBuildSteps

import com.facebook.buck.rules.BuildContext; //导入依赖的package包/类
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));
}
 
开发者ID:facebook,项目名称:buck,代码行数:18,代码来源:JsLibrary.java


注:本文中的com.facebook.buck.rules.BuildContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。