@VisibleForTesting
  static Builder createBuilder(
      BuckConfig config,
      AndroidDirectoryResolver androidDirectoryResolver,
      JavaCompilerEnvironment javacEnv) {

    Optional<String> ndkVersion = config.getNdkVersion();
    // If a NDK version isn't specified, we've got to reach into the runtime environment to find
    // out which one we will end up using.
    if (!ndkVersion.isPresent()) {
      ndkVersion = androidDirectoryResolver.getNdkVersion();
    }

    Builder builder = builder();

    JavacOptions androidBinaryOptions =
        JavacOptions.builder(JavacOptions.DEFAULTS).setJavaCompilerEnviornment(javacEnv).build();
    builder.register(
        new AndroidBinaryDescription(androidBinaryOptions, config.getProguardJarOverride()));
    builder.register(new AndroidInstrumentationApkDescription());
    builder.register(new AndroidLibraryDescription(javacEnv));
    builder.register(new AndroidManifestDescription());
    builder.register(new AndroidResourceDescription());
    builder.register(new ApkGenruleDescription());
    builder.register(new AppleAssetCatalogDescription());
    builder.register(new BuckExtensionDescription());
    builder.register(new BuildConfigDescription());
    builder.register(new CppBinaryDescription());
    builder.register(new CppLibraryDescription());
    builder.register(new ExportFileDescription());
    builder.register(new GenruleDescription());
    builder.register(new GenAidlDescription());
    builder.register(new GenParcelableDescription());
    builder.register(new KeystoreDescription());
    builder.register(new JavaBinaryDescription());
    builder.register(new JavaLibraryDescription(javacEnv));
    builder.register(new JavaTestDescription(javacEnv));
    builder.register(new IosBinaryDescription());
    builder.register(new IosLibraryDescription());
    builder.register(new IosResourceDescription());
    builder.register(new IosTestDescription());
    builder.register(new JavaBinaryDescription());
    builder.register(new MacosxBinaryDescription());
    builder.register(new MacosxFrameworkDescription());
    builder.register(new NdkLibraryDescription(ndkVersion));
    builder.register(new PrebuiltJarDescription());
    builder.register(new PrebuiltNativeLibraryDescription());
    builder.register(new ProjectConfigDescription());
    builder.register(new PythonBinaryDescription());
    builder.register(new PythonLibraryDescription());
    builder.register(new RobolectricTestDescription(javacEnv));
    builder.register(new ShBinaryDescription());
    builder.register(new ShTestDescription());
    builder.register(new XcodeNativeDescription());
    builder.register(new XcodeProjectConfigDescription());

    return builder;
  }
Exemple #2
0
  static JavacStep createJavacStepForDummyRDotJavaFiles(
      Set<? extends SourcePath> javaSourceFilePaths,
      Path outputDirectory,
      Optional<Path> pathToOutputAbiFile,
      JavacOptions javacOptions,
      BuildTarget buildTarget) {

    return JavacStepUtil.createJavacStep(
        outputDirectory,
        javaSourceFilePaths,
        ImmutableSet.<Path>of(),
        /* classpathEntries */ ImmutableSet.<Path>of(),
        JavacOptions.builder(JavacOptions.DEFAULTS)
            .setJavaCompilerEnviornment(javacOptions.getJavaCompilerEnvironment())
            .build(),
        pathToOutputAbiFile,
        Optional.<String>absent(),
        BuildDependencies.FIRST_ORDER_ONLY,
        Optional.<JavacInMemoryStep.SuggestBuildRules>absent(),
        /* pathToSrcsList */ Optional.<Path>absent(),
        buildTarget,
        /* workingDirectory */ Optional.<Path>absent());
  }
Exemple #3
0
 @Override
 public RuleKey.Builder appendDetailsToRuleKey(RuleKey.Builder builder) {
   return javacOptions.appendToRuleKey(builder);
 }