@@ -72,6 +72,7 @@ public class R8 extends AbstractBaseTask {
7272    private  static  final  String  CONVENTION_MAPPING_FILE  = "mappingFile" ;
7373    private  static  final  String  CONVENTION_MINIFY_ENABLED  = "minifyEnabled" ;
7474    private  static  final  String  CONVENTION_OBFUSCATION_ENABLED  = "obfuscationEnabled" ;
75+     private  static  final  String  CONVENTION_COLLECTOR_ENABLED  = "collectorEnabled" ;
7576    private  static  final  String  CONVENTION_DEBUG_ENABLED  = "debugEnabled" ;
7677
7778    @ Nullable 
@@ -228,6 +229,19 @@ public boolean isObfuscationEnabled() {
228229        return  getOrConvention (obfuscationEnabled , CONVENTION_OBFUSCATION_ENABLED );
229230    }
230231
232+     @ Nullable 
233+     private  Boolean  collectorEnabled ;
234+ 
235+     @ IgnoreUnused 
236+     public  void  setCollectorEnabled (Boolean  collectorEnabled ) {
237+         this .collectorEnabled  = collectorEnabled ;
238+     }
239+ 
240+     @ Input 
241+     public  boolean  isCollectorEnabled () {
242+         return  getOrConvention (collectorEnabled , CONVENTION_COLLECTOR_ENABLED );
243+     }
244+ 
231245    @ Nullable 
232246    private  Boolean  debugEnabled ;
233247
@@ -336,9 +350,11 @@ private void composeConfigurationFile() {
336350        startSection (conf , "Appending from "  + baseCfgFile );
337351        conf .append (FileUtils .read (baseCfgFile ));
338352
339-         final  File  collectedConfig  = getProguardCollectTaskDep ().getOutCfgFile ();
340-         startSection (conf , "Appending from "  + collectedConfig );
341-         conf .append (FileUtils .read (collectedConfig ));
353+         if  (isCollectorEnabled ()) {
354+             final  File  collectedConfig  = getProguardCollectTaskDep ().getOutCfgFile ();
355+             startSection (conf , "Appending from "  + collectedConfig );
356+             conf .append (FileUtils .read (collectedConfig ));
357+         }
342358
343359        startSection (conf , "Shrinking & obfuscation flags" );
344360        if  (!isCustomisedBaseConfig ()) {
@@ -513,6 +529,7 @@ protected final void setupMoeTask(final @NotNull SourceSet sourceSet, final @Not
513529        addConvention (CONVENTION_LOG_FILE , () -> resolvePathInBuildDir (out , "R8.log" ));
514530        addConvention (CONVENTION_MINIFY_ENABLED , ext .proguard ::isMinifyEnabled );
515531        addConvention (CONVENTION_OBFUSCATION_ENABLED , ext .proguard ::isObfuscationEnabled );
532+         addConvention (CONVENTION_COLLECTOR_ENABLED , ext .proguard ::isProguardCollectorEnabled );
516533        addConvention (CONVENTION_DEBUG_ENABLED , () -> mode .equals (Mode .DEBUG ));
517534    }
518535}
0 commit comments