public ImmutableList processProject()

in analyzer/src/main/java/com/android/tools/sizereduction/analyzer/suggesters/proguard/ProguardSuggester.java [126:175]


  public ImmutableList<Suggestion> processProject(GradleContext context, File projectDir) {
    if (context.getPluginType() != GradleContext.PluginType.APPLICATION) {
      // dynamic-features and root build.gradle files do not contain the proguard configuration
      // being used.
      return ImmutableList.of();
    }
    ImmutableMap<String, ProguardConfig> proguardConfigs = context.getProguardConfigs();
    ProguardConfig proguardConfig =
        proguardConfigs.getOrDefault(
            "release", proguardConfigs.getOrDefault(ProguardConfig.DEFAULT_CONFIG_NAME, null));
    if (proguardConfig == null || !proguardConfig.getHasProguardRules()) {
      return ImmutableList.of(
          Suggestion.create(
              IssueType.PROGUARD_NO_SHRINKING,
              Category.PROGUARD,
              Payload.getDefaultInstance(),
              NO_CODE_SHRINKING,
              /* estimatedBytesSaved= */ null,
              /* autoFix= */ null),
          Suggestion.create(
              IssueType.PROGUARD_NO_OBFUSCATION,
              Category.PROGUARD,
              Payload.getDefaultInstance(),
              NO_OBFUSCATION,
              /* estimatedBytesSaved= */ null,
              /* autoFix= */ null));
    }
    ImmutableList.Builder<Suggestion> suggestions = ImmutableList.<Suggestion>builder();
    if (!proguardConfig.getMinifyEnabled()) {
      suggestions.add(
          Suggestion.create(
              IssueType.PROGUARD_NO_SHRINKING,
              Category.PROGUARD,
              Payload.getDefaultInstance(),
              NO_CODE_SHRINKING,
              /* estimatedBytesSaved= */ null,
              /* autoFix= */ null));
    }
    if (!proguardConfig.getObfuscationEnabled()) {
      suggestions.add(
          Suggestion.create(
              IssueType.PROGUARD_NO_OBFUSCATION,
              Category.PROGUARD,
              Payload.getDefaultInstance(),
              NO_OBFUSCATION,
              /* estimatedBytesSaved= */ null,
              /* autoFix= */ null));
    }
    return suggestions.build();
  }