/** Packages up the manifest with resource and assets from the rule and dependent resources. */
  public ResourceApk packWithDataAndResources(
      Artifact resourceApk,
      RuleContext ruleContext,
      NestedSet<ResourceContainer> resourceContainers,
      Artifact rTxt,
      Artifact symbolsTxt,
      List<String> configurationFilters,
      List<String> uncompressedExtensions,
      List<String> densities,
      String applicationId,
      String versionCode,
      String versionName,
      boolean incremental,
      Artifact proguardCfg) {
    try {
      LocalResourceContainer data =
          new LocalResourceContainer.Builder()
              .withAssets(
                  AndroidCommon.getAssetDir(ruleContext),
                  ruleContext.getPrerequisites(
                      // TODO(bazel-team): Remove the ResourceType construct.
                      ResourceType.ASSETS.getAttribute(), Mode.TARGET, FileProvider.class))
              .withResources(
                  ruleContext.getPrerequisites("resource_files", Mode.TARGET, FileProvider.class))
              .build();

      return createApk(
          resourceApk,
          ruleContext,
          resourceContainers,
          rTxt,
          symbolsTxt,
          configurationFilters,
          uncompressedExtensions,
          densities,
          applicationId,
          versionCode,
          versionName,
          incremental,
          data,
          proguardCfg);
    } catch (InvalidAssetPath e) {
      ruleContext.attributeError(ResourceType.ASSETS.getAttribute(), e.getMessage());
      throw new RuleConfigurationException();
    } catch (InvalidResourcePath e) {
      ruleContext.attributeError("resource_files", e.getMessage());
      throw new RuleConfigurationException();
    }
  }
  /** Packages up the manifest with assets from the rule and dependent resources. */
  public ResourceApk packWithAssets(
      Artifact resourceApk,
      RuleContext ruleContext,
      NestedSet<ResourceContainer> resourceContainers,
      Artifact rTxt,
      boolean incremental,
      Artifact proguardCfg) {
    try {
      LocalResourceContainer data =
          new LocalResourceContainer.Builder()
              .withAssets(
                  AndroidCommon.getAssetDir(ruleContext),
                  ruleContext.getPrerequisites(
                      // TODO(bazel-team): Remove the ResourceType construct.
                      ResourceType.ASSETS.getAttribute(), Mode.TARGET, FileProvider.class))
              .build();

      return createApk(
          resourceApk,
          ruleContext,
          resourceContainers,
          rTxt,
          null, /* configurationFilters */
          ImmutableList.<String>of(), /* uncompressedExtensions */
          ImmutableList.<String>of(), /* densities */
          ImmutableList.<String>of(), /* String applicationId */
          null, /* String versionCode */
          null, /* String versionName */
          null, /* Artifact symbolsTxt */
          incremental,
          data,
          proguardCfg);
    } catch (InvalidAssetPath e) {
      ruleContext.attributeError(ResourceType.ASSETS.getAttribute(), e.getMessage());
      throw new RuleConfigurationException();
    }
  }