Class ObfuscatorTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class ObfuscatorTask
    extends YGuardBaseTask
    The main obfuscation Ant Task
    • Constructor Detail

      • ObfuscatorTask

        public ObfuscatorTask()
        Instantiates a new Obfuscator task.
      • ObfuscatorTask

        public ObfuscatorTask​(boolean mode)
        Instantiates a new Obfuscator task.
        Parameters:
        mode - the mode
    • Method Detail

      • toNativePattern

        public static java.lang.String[] toNativePattern​(java.lang.String[] patterns)
        To native pattern string [ ].
        Parameters:
        patterns - the patterns
        Returns:
        the string [ ]
      • toNativeClass

        public static final java.lang.String toNativeClass​(java.lang.String className)
        To native class string.
        Parameters:
        className - the class name
        Returns:
        the string
      • toNativeMethod

        public static final java.lang.String[] toNativeMethod​(java.lang.String javaMethod)
        To native method string [ ].
        Parameters:
        javaMethod - the java method
        Returns:
        the string [ ]
      • setNeedYShrinkModel

        public void setNeedYShrinkModel​(boolean b)
        Sets need y shrink model.
        Parameters:
        b - the b
      • createExpose

        public ExposeSection createExpose()
        Used by ant to handle the nested expose element.
        Returns:
        an ExposeSection instance
      • newExposeSection

        protected ExposeSection newExposeSection​(ObfuscatorTask ot)
        Instantiates the expose section, subclasses may provide custom implementations.
        Returns:
        a new ExposeSection instance
      • addExcludes

        public void addExcludes​(EntryPointsSection entryPoints)
        Add excludes.
        Parameters:
        entryPoints - the entry points
      • createAdjust

        public ObfuscatorTask.AdjustSection createAdjust()
        Used by ant to handle the nested adjust element.
        Returns:
        an AdjustSection instance
      • newAdjustSection

        protected ObfuscatorTask.AdjustSection newAdjustSection()
        Instantiates an adjust section, subclasses may provide custom implementations.
        Returns:
        a new AdjustSection instance
      • addConfiguredExpose

        public void addConfiguredExpose​(ExposeSection ex)
        Used by ant to handle the nested expose element.
        Parameters:
        ex - the ex
      • createEntryPoints

        public EntryPointsSection createEntryPoints()
        Create entry points entry points section.
        Returns:
        the entry points section
      • newEntryPointsSection

        protected EntryPointsSection newEntryPointsSection​(YGuardBaseTask bt)
        Instantiates an entry points section, subclasses may provide custom implementations.
        Returns:
        the new entry points section
      • addConfiguredEntryPoints

        public void addConfiguredEntryPoints​(EntryPointsSection eps)
        Used by ant to handle the nested entrypoints element.
        Parameters:
        eps - the eps
      • createMap

        public ObfuscatorTask.MapSection createMap()
        Used by ant to handle the nested map element.
        Returns:
        an instance of MapSection
      • newMapSection

        protected ObfuscatorTask.MapSection newMapSection()
        Instantiates the nested map element, subclasses may provide custom implementations.
        Returns:
        a new instance of MapSection
      • addConfiguredMap

        public void addConfiguredMap​(ObfuscatorTask.MapSection map)
        Used by ant to handle the nested map element.
        Parameters:
        map - the map
      • createPatch

        public ObfuscatorTask.PatchSection createPatch()
        Used by ant to handle the nested patch element.
        Returns:
        an instance of PatchSection
      • newPatchSection

        protected ObfuscatorTask.PatchSection newPatchSection()
        Instantiates the nested patch element, subclasses may provide custom implementations.
        Returns:
        a new instance of PatchSection
      • addConfiguredPatch

        public void addConfiguredPatch​(ObfuscatorTask.PatchSection patch)
        Used by ant to handle the nested patch element.
        Parameters:
        patch - the patch
      • setLogFile

        public void setLogFile​(java.io.File file)
        Used by ant to handle the logfile attribute.
        Parameters:
        file - the file
      • setConserveManifest

        public void setConserveManifest​(boolean c)
        Used by ant to handle the conservemanifest attribute.
        Parameters:
        c - the c
      • setMainClass

        public void setMainClass​(java.lang.String mainClass)
        Used by ant to handle the mainclass attribute.
        Parameters:
        mainClass - the main class
      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Used by ant to handle the start the obfuscation process.
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException
      • newGuardDB

        protected GuardDB newGuardDB​(java.io.File[] inFile)
                              throws java.io.IOException
        Instantiates the classfile database for obfuscation, subclasses may provide custom implementations.
        Returns:
        the new classfile database instance
        Throws:
        java.io.IOException
      • newResourceAdjuster

        protected ObfuscatorTask.ResourceAdjuster newResourceAdjuster​(GuardDB db)
        Instantiates the type Resource adjuster, subclasses may provide custom implementations.
        Returns:
        the new type Resource adjuster instance
      • addInheritanceEntries

        public void addInheritanceEntries​(java.util.Collection entries)
                                   throws java.io.IOException
        Add inheritance entries.
        Parameters:
        entries - the entries
        Throws:
        java.io.IOException - the io exception
      • setShrink

        public void setShrink​(boolean doShrink)
        Sets shrink.
        Parameters:
        doShrink - the do shrink
      • setShrinkLog

        public void setShrinkLog​(java.io.File shrinkLog)
        Sets shrink log.
        Parameters:
        shrinkLog - the shrink log
      • setUseExposeAsEntryPoints

        public void setUseExposeAsEntryPoints​(boolean useExposeAsEntryPoints)
        Sets use expose as entry points.
        Parameters:
        useExposeAsEntryPoints - the use expose as entry points
      • setReplaceClassNameStrings

        public void setReplaceClassNameStrings​(boolean replaceClassNameStrings)
        Setter for property replaceClassNameStrings.
        Parameters:
        replaceClassNameStrings - New value of property replaceClassNameStrings.
      • setScramble

        public void setScramble​(boolean scramble)
        Sets scramble.
        Parameters:
        scramble - the scramble
      • main

        public static void main​(java.lang.String[] args)
        Main.
        Parameters:
        args - the args
      • getAnnotationClass

        public java.lang.String getAnnotationClass()
        Gets annotation class.
        Returns:
        the annotation class
      • setAnnotationClass

        public void setAnnotationClass​(java.lang.String annotationClass)
        Sets annotation class.
        Parameters:
        annotationClass - the annotation class