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

项目:buck-cutom    文件:CxxPreprocessables.java   
/**
 * Build the {@link SymlinkTree} rule using the original build params from a target node.
 * In particular, make sure to drop all dependencies from the original build rule params,
 * as these are modeled via {@link CxxHeader}.
 */
public static SymlinkTree createHeaderSymlinkTreeBuildRule(
    BuildTarget target,
    BuildRuleParams params,
    Path root,
    ImmutableMap<Path, SourcePath> links) {

  return new SymlinkTree(
      params.copyWithChanges(
          HEADER_SYMLINK_TREE_TYPE,
          target,
          // Symlink trees never need to depend on anything.
          ImmutableSortedSet.<BuildRule>of(),
          ImmutableSortedSet.<BuildRule>of()),
      root,
      links);
}
项目:buck-cutom    文件:CxxPreprocessables.java   
/**
 * Setup a build rule that updates whenever any header or header dependency changes.
 * This includes the hash of the header contents and all corresponding transitive
 * header dependencies.  This should be depended on by any compile rules generated
 * for this higher level rule to make sure we re-compile if any headers change.
 */
public static CxxHeader createHeaderBuildRule(
    BuildTarget target,
    BuildRuleParams params,
    ImmutableMap<Path, SourcePath> headers) {

  // TODO(agallagher): In the common case, C/C++ sources only actually use a small
  // subset of all the headers in their transitive include search space, so this setup
  // will cause a lot of false rebuilds.  Long-term, we should add some sort of dep-file
  // support to avoid this.
  BuildRuleParams headerParams = params.copyWithChanges(
      HEADERS_TYPE,
      target,
      /* declaredDeps */ ImmutableSortedSet.copyOf(
          SourcePaths.filterBuildRuleInputs(headers.values())),
      /* declaredDeps */ ImmutableSortedSet.<BuildRule>of());
  return new CxxHeader(headerParams, headers);
}
项目:buck-cutom    文件:CxxCompilableEnhancer.java   
/**
 * @return a set of {@link CxxCompile} rules preprocessing, compiling, and assembling the
 *    given input {@link CxxSource} sources.
 */
public static ImmutableSortedSet<BuildRule> createCompileBuildRules(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    Path compiler,
    CxxPreprocessorInput preprocessorInput,
    ImmutableList<String> compilerFlags,
    Iterable<CxxSource> sources) {

  ImmutableSortedSet.Builder<BuildRule> rules = ImmutableSortedSet.naturalOrder();

  // Iterate over the input C/C++ sources that we need to preprocess, assemble, and compile,
  // and generate compile rules for them.
  for (CxxSource source : sources) {
    rules.add(createCompileBuildRule(
        params,
        resolver,
        compiler,
        preprocessorInput,
        compilerFlags,
        source));
  }

  return rules.build();
}
项目:buck-cutom    文件:JavaBinary.java   
public JavaBinary(
    BuildRuleParams params,
    @Nullable String mainClass,
    @Nullable SourcePath manifestFile,
    boolean mergeManifests,
    @Nullable Path metaInfDirectory,
    ImmutableSet<String> blacklist,
    DirectoryTraverser directoryTraverser) {
  super(params);
  this.mainClass = mainClass;
  this.manifestFile = manifestFile;
  this.mergeManifests = mergeManifests;
  this.metaInfDirectory = metaInfDirectory;
  this.blacklist = blacklist;

  this.directoryTraverser = Preconditions.checkNotNull(directoryTraverser);
}
项目:buck-cutom    文件:PythonBinaryDescriptionTest.java   
@Test
public void thatMainSourcePathPropagatesToDeps() {
  BuildRuleResolver resolver = new BuildRuleResolver();

  Genrule genrule = GenruleBuilder.createGenrule(BuildTargetFactory.newInstance("//:gen"))
      .setOut("blah.py")
      .build();
  BuildRuleParams params = BuildRuleParamsFactory.createTrivialBuildRuleParams(
      BuildTargetFactory.newInstance("//:bin"));
  PythonBinaryDescription desc = new PythonBinaryDescription(PEX_PATH);
  PythonBinaryDescription.Arg arg = desc.createUnpopulatedConstructorArg();
  arg.deps = Optional.of(ImmutableSortedSet.<BuildRule>of());
  arg.main = new BuildRuleSourcePath(genrule);
  BuildRule rule = desc.createBuildRule(params, resolver, arg);
  assertEquals(
      ImmutableSortedSet.<BuildRule>of(genrule),
      rule.getDeps());
}
项目:buck-cutom    文件:PythonLibraryDescription.java   
@Override
public <A extends Arg> PythonLibrary createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new PythonLibrary(
      params,
      PythonUtil.toModuleMap(
          params.getBuildTarget(),
          "srcs",
          params.getBuildTarget().getBasePath(),
          args.srcs.or(ImmutableSortedSet.<SourcePath>of())),
      PythonUtil.toModuleMap(
          params.getBuildTarget(),
          "resources",
          params.getBuildTarget().getBasePath(),
          args.resources.or(ImmutableSortedSet.<SourcePath>of())));
}
项目:buck-cutom    文件:GenruleDescription.java   
@Override
public <A extends Arg> Genrule createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  ImmutableList<SourcePath> srcs = args.srcs.get();
  ImmutableSortedSet<BuildRule> extraDeps = ImmutableSortedSet.<BuildRule>naturalOrder()
      .addAll(params.getExtraDeps())
      .addAll(SourcePaths.filterBuildRuleInputs(srcs))
      .build();

  return new Genrule(
      params.copyWithExtraDeps(extraDeps),
      srcs,
      args.cmd,
      args.bash,
      args.cmdExe,
      args.out,
      params.getPathAbsolutifier());
}
项目:buck-cutom    文件:JavaTestBuilder.java   
public JavaTest build(BuildRuleResolver resolver) {
  BuildRuleParams params = new FakeBuildRuleParamsBuilder(target)
      .setType(JavaTestDescription.TYPE)
      .setDeps(deps.build())
      .build();
  JavaTest test = new JavaTest(
      params,
      srcs.build(),
      resources.build(),
      labels.build(),
      contacts.build(),
      proguardConfig,
      /* additionalClasspathEntries */ ImmutableSet.<Path>of(),
      JavacOptions.DEFAULTS,
      vmArgs,
      sourcesUnderTest.build(),
      Optional.<Path>absent());
  resolver.addToIndex(test);
  return test;
}
项目:buck-cutom    文件:GenruleBuilder.java   
public Genrule build() {
  final ImmutableSortedSet<BuildRule> depRules = ImmutableSortedSet.copyOf(deps);
  args.deps = Optional.of(depRules);
  args.srcs = Optional.of(FluentIterable
      .from(srcs.build())
      .transform(SourcePaths.TO_SOURCE_PATH)
      .toList());

  BuildRuleParams params = new FakeBuildRuleParamsBuilder(target)
      .setDeps(depRules)
      .setType(GenruleDescription.TYPE)
      .setProjectFilesystem(
          new ProjectFilesystem(Paths.get(".")) {
            @Override
            public Function<Path, Path> getAbsolutifier() {
              return Optional.fromNullable(absolutifier)
                  .or(IdentityPathAbsolutifier.getIdentityAbsolutifier());
            }
          })
      .build();
  return description.createBuildRule(params, new BuildRuleResolver(), args);
}
项目:buck-cutom    文件:ArchivesTest.java   
@Test
public void testThatOriginalBuildParamsDepsDoNotPropagateToArchive() {

  // Create an `Archive` rule using build params with an existing dependency,
  // as if coming from a `TargetNode` which had declared deps.  These should *not*
  // propagate to the `Archive` rule, since it only cares about dependencies generating
  // it's immediate inputs.
  BuildRule dep = new FakeBuildRule(
      BuildRuleParamsFactory.createTrivialBuildRuleParams(
          BuildTargetFactory.newInstance("//:fake")));
  BuildTarget target = BuildTargetFactory.newInstance("//:archive");
  BuildRuleParams params =
      new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:dummy"))
          .setDeps(ImmutableSortedSet.of(dep))
          .build();
  Archive archive = Archives.createArchiveRule(
      target,
      params,
      DEFAULT_ARCHIVER,
      DEFAULT_OUTPUT,
      DEFAULT_INPUTS);

  // Verify that the archive rules dependencies are empty.
  assertEquals(archive.getDeps(), ImmutableSortedSet.<BuildRule>of());
}
项目:buck-cutom    文件:NdkLibrary.java   
protected NdkLibrary(
    BuildRuleParams params,
    Set<SourcePath> sources,
    List<String> flags,
    boolean isAsset,
    Optional<String> ndkVersion) {
  super(params);
  this.isAsset = isAsset;

  BuildTarget buildTarget = params.getBuildTarget();
  this.makefileDirectory = buildTarget.getBasePathWithSlash();
  this.lastPathComponent = "__lib" + buildTarget.getShortName();
  this.buildArtifactsDirectory = getBuildArtifactsDirectory(buildTarget, true /* isScratchDir */);
  this.genDirectory = getBuildArtifactsDirectory(buildTarget, false /* isScratchDir */);

  Preconditions.checkArgument(!sources.isEmpty(),
      "Must include at least one file (Android.mk?) in ndk_library rule");
  this.sources = ImmutableSortedSet.copyOf(sources);
  this.flags = ImmutableList.copyOf(flags);

  this.ndkVersion = Preconditions.checkNotNull(ndkVersion);
}
项目:buck-cutom    文件:ApkGenrule.java   
ApkGenrule(
    BuildRuleParams params,
    List<SourcePath> srcs,
    Optional<String> cmd,
    Optional<String> bash,
    Optional<String> cmdExe,
    Function<Path, Path> relativeToAbsolutePathFunction,
    InstallableApk apk) {
  super(params,
      srcs,
      cmd,
      bash,
      cmdExe,
      /* out */ params.getBuildTarget().getShortName() + ".apk",
      relativeToAbsolutePathFunction);

  this.apk = Preconditions.checkNotNull(apk);
  this.relativeToAbsolutePathFunction =
      Preconditions.checkNotNull(relativeToAbsolutePathFunction);
}
项目:buck-cutom    文件:AndroidLibraryGraphEnhancer.java   
public AndroidLibraryGraphEnhancer(
    BuildTarget buildTarget,
    BuildRuleParams buildRuleParams,
    JavacOptions javacOptions) {
  Preconditions.checkNotNull(buildTarget);
  this.dummyRDotJavaBuildTarget = BuildTarget.builder(buildTarget)
      .setFlavor(DUMMY_R_DOT_JAVA_FLAVOR)
      .build();
  this.originalBuildRuleParams = Preconditions.checkNotNull(buildRuleParams);
  // Override javacoptions because DummyRDotJava doesn't require annotation processing
  // params data and more importantly, because javacoptions' rule key is not available when
  // DummyRDotJava is built.
  Preconditions.checkNotNull(javacOptions);
  this.javacOptions = JavacOptions.builder(JavacOptions.DEFAULTS)
      .setJavaCompilerEnvironment(javacOptions.getJavaCompilerEnvironment())
      .build();
}
项目:buck-cutom    文件:AndroidBuildConfigJavaLibraryTest.java   
@Test
public void testAddToCollector() {
  BuildTarget buildTarget = BuildTargetFactory.newInstance("//foo:bar");
  BuildRuleParams params = new FakeBuildRuleParamsBuilder(buildTarget).build();
  AndroidBuildConfigJavaLibrary buildConfigJavaLibrary = AndroidBuildConfigDescription
      .createBuildRule(
        params,
        "com.example.buck",
        /* values */ BuildConfigFields.fromFieldDeclarations(
            Collections.singleton("String foo = \"bar\"")),
        /* valuesFile */ Optional.<SourcePath>absent(),
        /* useConstantExpressions */ false);

  AndroidPackageableCollector collector = new AndroidPackageableCollector(buildTarget);
  buildConfigJavaLibrary.addToCollector(collector);
  AndroidPackageableCollection collection = collector.build();
  assertEquals(
      ImmutableMap.of(
          "com.example.buck",
          BuildConfigFields.fromFields(ImmutableList.of(
              new BuildConfigFields.Field("String", "foo", "\"bar\"")))),
      collection.buildConfigs);
}
项目:buck-cutom    文件:PrebuiltNativeLibraryDescription.java   
@Override
public <A extends Args> PrebuiltNativeLibrary createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  ImmutableSortedSet<Path> librarySources;
  try {
    librarySources = ImmutableSortedSet.copyOf(
        params.getProjectFilesystem().getFilesUnderPath(args.nativeLibs));
  } catch (IOException e) {
    throw new HumanReadableException(e, "Error traversing directory %s.", args.nativeLibs);
  }

  return new PrebuiltNativeLibrary(
      params,
      args.nativeLibs,
      args.isAsset.or(false),
      librarySources
  );
}
项目:onos    文件:OnosJar.java   
public OnosJar(BuildRuleParams params,
               SourcePathResolver resolver,
               Set<? extends SourcePath> srcs,
               Set<? extends SourcePath> resources,
               Optional<Path> generatedSourceFolder,
               Optional<SourcePath> proguardConfig,
               ImmutableList<String> postprocessClassesCommands,
               ImmutableSortedSet<BuildRule> exportedDeps,
               ImmutableSortedSet<BuildRule> providedDeps,
               SourcePath abiJar, boolean trackClassUsage,
               ImmutableSet<Path> additionalClasspathEntries,
               CompileToJarStepFactory compileStepFactory,
               Optional<Path> resourcesRoot,
               Optional<SourcePath> manifestFile,
               Optional<String> mavenCoords,
               ImmutableSortedSet<BuildTarget> tests,
               ImmutableSet<Pattern> classesToRemoveFromJar,
               Optional<String> webContext,
               Optional<String> apiTitle,
               Optional<String> apiVersion,
               Optional<String> apiPackage,
               Optional<String> apiDescription,
               Optional<ImmutableSortedMap<String, SourcePath>> includedResources) {
    super(params, resolver, srcs, resources, generatedSourceFolder,
          proguardConfig, postprocessClassesCommands, exportedDeps,
          providedDeps, abiJar, trackClassUsage, additionalClasspathEntries,
          compileStepFactory, resourcesRoot, manifestFile, mavenCoords,
          tests, classesToRemoveFromJar);
    this.webContext = webContext;
    this.apiTitle = apiTitle;
    this.apiVersion = apiVersion;
    this.apiPackage = apiPackage;
    this.apiDescription = apiDescription;
    this.includedResources = includedResources;
    this.mavenDeps = computeMavenDeps();
}
项目:buck-cutom    文件:BuckExtension.java   
public BuckExtension(
    BuildRuleParams params,
    ImmutableSortedSet<? extends SourcePath> srcs,
    ImmutableSortedSet<? extends SourcePath> resources) {
  super(params);
  this.srcs = Preconditions.checkNotNull(srcs);
  this.resources = Preconditions.checkNotNull(resources);

  BuildTarget target = params.getBuildTarget();
  this.output = BuildTargets.getGenPath(target, "%s-buck.jar");
  this.abi = BuildTargets.getGenPath(target, "%s-buck.abi");
  this.working = BuildTargets.getBinPath(target, "__%s__");
}
项目:buck-cutom    文件:GenAidlDescription.java   
@Override
public <A extends Arg> GenAidl createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new GenAidl(
      params,
      args.aidl,
      args.importPath);
}
项目:buck-cutom    文件:AaptPackageResourcesTest.java   
/**
 * Tests an android_binary with zero dependent android_library rules that contains an assets
 * directory.
 */
@Test
public void testCreateAllAssetsDirectoryWithZeroAssetsDirectories() throws IOException {
  ResourcesFilter resourcesFilter = EasyMock.createMock(ResourcesFilter.class);
  EasyMock.replay(resourcesFilter);

  BuildRuleParams params = new FakeBuildRuleParamsBuilder(
      BuildTarget.builder("//java/src/com/facebook/base", "apk")
          .setFlavor("aapt_package")
          .build())
      .build();

  // One android_binary rule that depends on the two android_library rules.
  AaptPackageResources aaptPackageResources = new AaptPackageResources(
      params,
      /* manifest */ new TestSourcePath("java/src/com/facebook/base/AndroidManifest.xml"),
      resourcesFilter,
      ImmutableSet.<Path>of(),
      PackageType.DEBUG,
      /* cpuFilters */ ImmutableSet.<TargetCpuType>of());

  // Build up the parameters needed to invoke createAllAssetsDirectory().
  ImmutableList.Builder<Step> commands = ImmutableList.builder();

  // Invoke createAllAssetsDirectory(), the method under test.
  Optional<Path> allAssetsDirectory = aaptPackageResources.createAllAssetsDirectory(
      /* assetsDirectories */ ImmutableSet.<Path>of(),
      commands,
      new FakeProjectFilesystem());
  EasyMock.verify(resourcesFilter);

  // Verify that no assets/ directory is used.
  assertFalse("There should not be an assets/ directory to pass to aapt.",
      allAssetsDirectory.isPresent());
  assertTrue("There should not be any commands to build up an assets/ directory.",
      commands.build().isEmpty());
}
项目:buck-cutom    文件:CxxLibraryDescription.java   
@Override
public <A extends Arg> CxxLibrary createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {

  // Extract the C/C++ sources from the constructor arg.
  ImmutableList<CxxSource> srcs =
      CxxDescriptionEnhancer.parseCxxSources(
          params.getBuildTarget(),
          args.srcs.or(ImmutableList.<SourcePath>of()));

  // Extract the header map from the our constructor arg.
  ImmutableMap<Path, SourcePath> headers =
      CxxDescriptionEnhancer.parseHeaders(
          params.getBuildTarget(),
          args.headers.or((ImmutableList.<SourcePath>of())));

  return CxxDescriptionEnhancer.createCxxLibraryBuildRules(
      params,
      resolver,
      cxxBuckConfig,
      args.preprocessorFlags.or(ImmutableList.<String>of()),
      args.propagatedPpFlags.or(ImmutableList.<String>of()),
      headers,
      args.compilerFlags.or(ImmutableList.<String>of()),
      srcs);
}
项目:buck-cutom    文件:Archive.java   
public Archive(
    BuildRuleParams params,
    Path archiver,
    Path output,
    ImmutableList<Path> inputs) {
  super(params);
  this.archiver = Preconditions.checkNotNull(archiver);
  this.output = Preconditions.checkNotNull(output);
  this.inputs = Preconditions.checkNotNull(inputs);
}
项目:buck-cutom    文件:AuditOwnerCommandTest.java   
@Override
public <A extends FakeArg> BuildRule createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new FakeBuildRule(params);
}
项目:buck-cutom    文件:ShTestDescription.java   
@Override
public <A extends Arg> ShTest createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new ShTest(params, args.test, args.labels.get());
}
项目:buck-cutom    文件:ProjectGeneratorTest.java   
@Test(expected = HumanReadableException.class)
public void testLibraryPrivateHeaderWithHeaderMaps() throws IOException {
  BuildRuleParams params =
      new FakeBuildRuleParamsBuilder(BuildTarget.builder("//foo", "lib").build())
          .setType(AppleLibraryDescription.TYPE)
          .build();
  AppleNativeTargetDescriptionArg arg =
      appleLibraryDescription.createUnpopulatedConstructorArg();
  arg.configs = ImmutableMap.of(
      "Debug", ImmutableList.<Either<Path, ImmutableMap<String, String>>>of());
  arg.srcs = ImmutableList.of(
      AppleSource.ofSourceGroup(
          new Pair<>(
              "HeaderGroup2",
              ImmutableList.of(
                  AppleSource.ofSourcePathWithFlags(
                      new Pair<SourcePath, String>(new TestSourcePath("blech.h"), "private"))))));
  arg.frameworks = ImmutableSortedSet.of();
  arg.deps = Optional.absent();
  arg.gid = Optional.absent();
  arg.headerPathPrefix = Optional.absent();
  arg.useBuckHeaderMaps = Optional.of(true);
  BuildRule rule = appleLibraryDescription.createBuildRule(params, new BuildRuleResolver(), arg);

  ProjectGenerator projectGenerator = createProjectGeneratorForCombinedProject(
      ImmutableSet.of(rule),
      ImmutableSet.of(rule.getBuildTarget()));

  projectGenerator.createXcodeProjects();
}
项目:buck-cutom    文件:JavaBinaryDescription.java   
@Override
public <A extends Args> JavaBinary createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new JavaBinary(
      params,
      args.mainClass.orNull(),
      args.manifestFile.orNull(),
      args.mergeManifests.or(true),
      args.metaInfDirectory.orNull(),
      args.blacklist.or(ImmutableSortedSet.<String>of()),
      new DefaultDirectoryTraverser());
}
项目:buck-cutom    文件:CxxCompilableEnhancerTest.java   
@Test
public void createCompileBuildRulePropagatesBuilRuleSourcePathDeps() {
  BuildTarget target = BuildTargetFactory.newInstance("//foo:bar");
  BuildRuleParams params = BuildRuleParamsFactory.createTrivialBuildRuleParams(target);
  BuildRuleResolver resolver = new BuildRuleResolver();

  CxxPreprocessorInput cxxPreprocessorInput = new CxxPreprocessorInput(
      ImmutableSet.<BuildTarget>of(),
      ImmutableList.<String>of(),
      ImmutableList.<String>of(),
      ImmutableList.<Path>of(),
      ImmutableList.<Path>of());


  String name = "foo/bar.cpp";
  FakeBuildRule dep = createFakeBuildRule("//:test");
  SourcePath input = new BuildRuleSourcePath(dep);
  Path output = CxxCompilableEnhancer.getCompileOutputPath(target, name);
  CxxSource cxxSource = new CxxSource(name, input, output);

  CxxCompile cxxCompile = CxxCompilableEnhancer.createCompileBuildRule(
      params,
      resolver,
      CxxCompilables.DEFAULT_CXX_COMPILER,
      cxxPreprocessorInput,
      ImmutableList.<String>of(),
      cxxSource);

  assertEquals(ImmutableSortedSet.<BuildRule>of(dep), cxxCompile.getDeps());
}
项目:buck-cutom    文件:DefaultJavaLibraryTest.java   
private static BuildRule createDefaultJavaLibaryRuleWithAbiKey(
    @Nullable final String partialAbiHash,
    BuildTarget buildTarget,
    ImmutableSet<String> srcs,
    ImmutableSortedSet<BuildRule> deps,
    ImmutableSortedSet<BuildRule> exportedDeps) {
  ImmutableSortedSet<SourcePath> srcsAsPaths = FluentIterable.from(srcs)
      .transform(MorePaths.TO_PATH)
      .transform(SourcePaths.TO_SOURCE_PATH)
      .toSortedSet(Ordering.natural());

  BuildRuleParams buildRuleParams = new FakeBuildRuleParamsBuilder(buildTarget)
      .setDeps(ImmutableSortedSet.copyOf(deps))
      .setType(JavaLibraryDescription.TYPE)
      .build();

  return new DefaultJavaLibrary(
      buildRuleParams,
      srcsAsPaths,
      /* resources */ ImmutableSet.<SourcePath>of(),
      /* proguardConfig */ Optional.<Path>absent(),
      /* postprocessClassesCommands */ ImmutableList.<String>of(),
      exportedDeps,
      /* providedDeps */ ImmutableSortedSet.<BuildRule>of(),
      /* additionalClasspathEntries */ ImmutableSet.<Path>of(),
      JavacOptions.DEFAULTS,
      /* resourcesRoot */ Optional.<Path>absent()) {
    @Override
    public Sha1HashCode getAbiKey() {
      if (partialAbiHash == null) {
        return super.getAbiKey();
      } else {
        return createTotalAbiKey(new Sha1HashCode(partialAbiHash));
      }
    }
  };
}
项目:buck-cutom    文件:JavaThriftLibrary.java   
public JavaThriftLibrary(
    BuildRuleParams params,
    ImmutableSortedSet<SourcePath> srcs) {
  super(params);
  this.srcs = Preconditions.checkNotNull(srcs);
  this.genPath = BuildTargets.getGenPath(getBuildTarget(), "__thrift_%s__");
  this.srcJarOutputPath = genPath.resolve("gen-java" + JavacStep.SRC_ZIP);
}
项目:buck-cutom    文件:GwtModule.java   
GwtModule(
    BuildRuleParams params,
    ImmutableSortedSet<SourcePath> filesForGwtModule) {
  super(params);
  BuildTarget target = params.getBuildTarget();
  this.outputFile = BuildTargets.getGenPath(
      target,
      "__gwt_module_%s__/" + target.getShortName() + ".jar");
  this.filesForGwtModule = Preconditions.checkNotNull(filesForGwtModule);
}
项目:buck-cutom    文件:PrebuiltJarTest.java   
@Before
public void setUp() {
  BuildRuleParams buildRuleParams =
      new FakeBuildRuleParamsBuilder(BuildTarget.builder("//lib", "junit").build()).build();

  junitJarRule = new PrebuiltJar(buildRuleParams,
      new PathSourcePath(PATH_TO_JUNIT_JAR),
      Optional.<SourcePath>of(new TestSourcePath("lib/junit-4.11-sources.jar")),
      /* gwtJar */ Optional.<SourcePath>absent(),
      Optional.of("http://junit-team.github.io/junit/javadoc/latest/"));
}
项目:buck-cutom    文件:GenParcelableDescription.java   
@Override
public <A extends Arg> GenParcelable createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new GenParcelable(params, args.srcs);
}
项目:buck-cutom    文件:AndroidManifestTest.java   
private AndroidManifest createSimpleAndroidManifestRule() {
  // First, create the AndroidManifest object.
  BuildRuleParams buildRuleParams = BuildRuleParamsFactory.createTrivialBuildRuleParams(
      BuildTarget.builder("//java/com/example", "manifest").build());
  AndroidManifestDescription description = new AndroidManifestDescription();
  AndroidManifestDescription.Arg arg = description.createUnpopulatedConstructorArg();
  arg.skeleton = new TestSourcePath("java/com/example/AndroidManifestSkeleton.xml");
  arg.deps = Optional.<ImmutableSortedSet<BuildRule>>of(ImmutableSortedSet.<BuildRule>of());
  return description.createBuildRule(buildRuleParams, new BuildRuleResolver(), arg);
}
项目:buck-cutom    文件:ShTest.java   
protected ShTest(
    BuildRuleParams params,
    SourcePath test,
    Set<Label> labels) {
  super(params);
  this.test = Preconditions.checkNotNull(test);
  this.labels = ImmutableSet.copyOf(labels);
}
项目:buck-cutom    文件:CxxCompilableEnhancerTest.java   
@Test
public void createCompileBuildRulePropagatesCxxPreprocessorDeps() {
  BuildTarget target = BuildTargetFactory.newInstance("//foo:bar");
  BuildRuleParams params = BuildRuleParamsFactory.createTrivialBuildRuleParams(target);
  BuildRuleResolver resolver = new BuildRuleResolver();

  FakeBuildRule dep = resolver.addToIndex(createFakeBuildRule("//:dep1"));

  CxxPreprocessorInput cxxPreprocessorInput = new CxxPreprocessorInput(
      ImmutableSet.of(dep.getBuildTarget()),
      ImmutableList.<String>of(),
      ImmutableList.<String>of(),
      ImmutableList.<Path>of(),
      ImmutableList.<Path>of());

  String name = "foo/bar.cpp";
  SourcePath input = new PathSourcePath(target.getBasePath().resolve(name));
  Path output = CxxCompilableEnhancer.getCompileOutputPath(target, name);
  CxxSource cxxSource = new CxxSource(name, input, output);

  CxxCompile cxxCompile = CxxCompilableEnhancer.createCompileBuildRule(
      params,
      resolver,
      CxxCompilables.DEFAULT_CXX_COMPILER,
      cxxPreprocessorInput,
      ImmutableList.<String>of(),
      cxxSource);

  assertEquals(ImmutableSortedSet.<BuildRule>of(dep), cxxCompile.getDeps());
}
项目:buck-cutom    文件:AndroidBuildConfigTest.java   
private static AndroidBuildConfig createSimpleBuildConfigRule() {
  // First, create the BuildConfig object.
  BuildTarget buildTarget = BuildTarget.builder("//java/com/example", "build_config").build();
  BuildRuleParams params = new FakeBuildRuleParamsBuilder(buildTarget)
      .setType(AndroidBuildConfigDescription.TYPE)
      .build();
  return new AndroidBuildConfig(
      params,
      /* javaPackage */ "com.example",
      /* values */ BuildConfigFields.empty(),
      /* valuesFile */ Optional.<SourcePath>absent(),
      /* useConstantExpressions */ false);
}
项目:buck-cutom    文件:PythonBinary.java   
protected PythonBinary(
    BuildRuleParams params,
    Path pathToPex,
    Path main,
    PythonPackageComponents components) {
  super(params);
  this.pathToPex = Preconditions.checkNotNull(pathToPex);
  this.main = Preconditions.checkNotNull(main);
  this.components = Preconditions.checkNotNull(components);
}
项目:buck-cutom    文件:PythonLibrary.java   
protected PythonLibrary(
    BuildRuleParams params,
    ImmutableMap<Path, SourcePath> srcs,
    ImmutableMap<Path, SourcePath> resources) {
  super(params);
  this.srcs = Preconditions.checkNotNull(srcs);
  this.resources = Preconditions.checkNotNull(resources);
}
项目:buck-cutom    文件:AppleTestDescription.java   
@Override
public <A extends Arg> AppleTest createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new AppleTest(params, args);
}
项目:buck-cutom    文件:AppleBundle.java   
AppleBundle(
    BuildRuleParams params,
    AppleBundleDescription.Arg args) {
  super(params);
  this.extension = Preconditions.checkNotNull(args.extension);
  this.infoPlist = Preconditions.checkNotNull(args.infoPlist);
  this.binary = args.binary;
}
项目:buck-cutom    文件:AppleLibraryDescription.java   
@Override
public <A extends AppleNativeTargetDescriptionArg> AppleLibrary createBuildRule(
    BuildRuleParams params,
    BuildRuleResolver resolver,
    A args) {
  return new AppleLibrary(
      params,
      args,
      TargetSources.ofAppleSources(args.srcs),
      archiver,
      params.getBuildTarget().getFlavor().equals(DYNAMIC_LIBRARY));
}