@Override
  protected void amendBuilder(
      AbstractBuildRuleBuilder abstractBuilder, BuildRuleFactoryParams params)
      throws NoSuchBuildTargetException {
    PrebuiltNativeLibraryBuildRule.Builder builder =
        ((PrebuiltNativeLibraryBuildRule.Builder) abstractBuilder);

    // native_libs
    String nativeLibs = params.getRequiredStringAttribute("native_libs");
    String nativeLibsDir = params.resolveDirectoryPathRelativeToBuildFileDirectory(nativeLibs);
    builder.setNativeLibsDirectory(nativeLibsDir);
  }
  @Override
  protected void amendBuilder(
      AbstractBuildRuleBuilder abstractBuilder, BuildRuleFactoryParams params)
      throws NoSuchBuildTargetException {
    AndroidInstrumentationApk.Builder builder = (AndroidInstrumentationApk.Builder) abstractBuilder;
    BuildTarget target = params.target;

    // manifest
    String manifestAttribute = params.getRequiredStringAttribute("manifest");
    String manifestPath = params.resolveFilePathRelativeToBuildFileDirectory(manifestAttribute);
    builder.setManifest(manifestPath);

    // apk
    String apk = params.getRequiredStringAttribute("apk");
    ParseContext buildFileParseContext = ParseContext.forBaseName(target.getBaseName());
    BuildTarget buildTarget = params.buildTargetParser.parse(apk, buildFileParseContext);
    builder.setApk(buildTarget.getFullyQualifiedName());
  }
  @Override
  protected void amendBuilder(
      AbstractBuildRuleBuilder abstractBuilder, BuildRuleFactoryParams params) {
    AndroidManifestRule.Builder builder = ((AndroidManifestRule.Builder) abstractBuilder);

    // manifest file
    String manifestPath =
        params.resolveAndCreateFilePathRelativeToBuildFileDirectory(MANIFEST_FILENAME);
    builder.setManifestFile(manifestPath);

    // skeleton file
    String skeletonFile = params.getRequiredStringAttribute("skeleton");
    String skeletonPath = params.resolveFilePathRelativeToBuildFileDirectory(skeletonFile);
    builder.setSkeletonFile(skeletonPath);

    // no_dx
    for (String entry : params.getOptionalListAttribute("no_dx")) {
      builder.addBuildRuleToExcludeFromDex(entry);
    }
  }