Home | History | Annotate | Download | only in ant
      1 /*
      2  * ProGuard -- shrinking, optimization, obfuscation, and preverification
      3  *             of Java bytecode.
      4  *
      5  * Copyright (c) 2002-2013 Eric Lafortune (eric (at) graphics.cornell.edu)
      6  *
      7  * This program is free software; you can redistribute it and/or modify it
      8  * under the terms of the GNU General Public License as published by the Free
      9  * Software Foundation; either version 2 of the License, or (at your option)
     10  * any later version.
     11  *
     12  * This program is distributed in the hope that it will be useful, but WITHOUT
     13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
     15  * more details.
     16  *
     17  * You should have received a copy of the GNU General Public License along
     18  * with this program; if not, write to the Free Software Foundation, Inc.,
     19  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
     20  */
     21 package proguard.ant;
     22 
     23 import proguard.KeepClassSpecification;
     24 
     25 import java.util.List;
     26 
     27 /**
     28  * This DataType represents a class specification in Ant.
     29  *
     30  * @author Eric Lafortune
     31  */
     32 public class KeepSpecificationElement extends ClassSpecificationElement
     33 {
     34     private boolean allowShrinking;
     35     private boolean allowOptimization;
     36     private boolean allowObfuscation;
     37 
     38 
     39     /**
     40      * Adds the contents of this class specification element to the given list.
     41      * @param keepSpecifications the class specifications to be extended.
     42      * @param markClasses        specifies whether to mark the classes.
     43      * @param markConditionally  specifies whether to mark the classes
     44      *                           and class members conditionally.
     45      */
     46     public void appendTo(List    keepSpecifications,
     47                          boolean markClasses,
     48                          boolean markConditionally)
     49     {
     50         // Get the referenced file set, or else this one.
     51         KeepSpecificationElement keepSpecificationElement = isReference() ?
     52             (KeepSpecificationElement)getCheckedRef(this.getClass(),
     53                                                     this.getClass().getName()) :
     54             this;
     55 
     56         KeepClassSpecification keepClassSpecification =
     57             new KeepClassSpecification(markClasses,
     58                                        markConditionally,
     59                                        allowShrinking,
     60                                        allowOptimization,
     61                                        allowObfuscation,
     62                                        createClassSpecification(keepSpecificationElement));
     63 
     64         // Add it to the list.
     65         keepSpecifications.add(keepClassSpecification);
     66     }
     67 
     68 
     69     // Ant task attributes.
     70 
     71     public void setAllowshrinking(boolean allowShrinking)
     72     {
     73         this.allowShrinking = allowShrinking;
     74     }
     75 
     76 
     77     public void setAllowoptimization(boolean allowOptimization)
     78     {
     79         this.allowOptimization = allowOptimization;
     80     }
     81 
     82 
     83     public void setAllowobfuscation(boolean allowObfuscation)
     84     {
     85         this.allowObfuscation = allowObfuscation;
     86     }
     87 }
     88