Package com.yworks.yguard
Class ObfuscatorTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- com.yworks.common.ant.YGuardBaseTask
-
- com.yworks.yguard.ObfuscatorTask
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ObfuscatorTask extends YGuardBaseTask
The main obfuscation Ant Task
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObfuscatorTask.AdjustSectionUsed by ant to handle theadjustelement.static classObfuscatorTask.LineNumberScramblerThe type Line number scrambler.static classObfuscatorTask.LineNumberSqueezerThe type Line number squeezer.classObfuscatorTask.MapSectionUsed by ant to handle themapelement.static classObfuscatorTask.ModifiersUsed by ant to handle theclasses,methodsandfieldsattributes.static classObfuscatorTask.MyLineNumberTableMapperThe type My line number table mapper.classObfuscatorTask.PatchSectionUsed by ant to handle thepatchelement.static classObfuscatorTask.ReplaceContentPolicystatic classObfuscatorTask.ReplacePathPolicyprotected classObfuscatorTask.ResourceAdjusterThe type Resource adjuster.-
Nested classes/interfaces inherited from class com.yworks.common.ant.YGuardBaseTask
YGuardBaseTask.InOutPairSection
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<ObfuscatorTask.AdjustSection>adjustSectionsprotected EntryPointsSectionentryPointsprotected ExposeSectionexposeprotected ObfuscatorTask.MapSectionmapprotected ObfuscatorTask.PatchSectionpatch-
Fields inherited from class com.yworks.common.ant.YGuardBaseTask
attributesSections, mode, MODE_NESTED, MODE_STANDALONE, pairs, properties, resourceClassPath
-
-
Constructor Summary
Constructors Constructor Description ObfuscatorTask()Instantiates a new Obfuscator task.ObfuscatorTask(boolean mode)Instantiates a new Obfuscator task.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttributesSections(java.util.List<AttributesSection> attributesSections)Add attributes sections.voidaddConfiguredEntryPoints(EntryPointsSection eps)Used by ant to handle the nestedentrypointselement.voidaddConfiguredExpose(ExposeSection ex)Used by ant to handle the nestedexposeelement.voidaddConfiguredMap(ObfuscatorTask.MapSection map)Used by ant to handle the nestedmapelement.voidaddConfiguredPatch(ObfuscatorTask.PatchSection patch)Used by ant to handle the nestedpatchelement.voidaddExcludes(EntryPointsSection entryPoints)Add excludes.voidaddInheritanceEntries(java.util.Collection entries)Add inheritance entries.ObfuscatorTask.AdjustSectioncreateAdjust()Used by ant to handle the nestedadjustelement.EntryPointsSectioncreateEntryPoints()Create entry points entry points section.ExposeSectioncreateExpose()Used by ant to handle the nestedexposeelement.ExcludecreateKeep()Create keep exclude.ObfuscatorTask.MapSectioncreateMap()Used by ant to handle the nestedmapelement.ObfuscatorTask.PatchSectioncreatePatch()Used by ant to handle the nestedpatchelement.voidexecute()Used by ant to handle the start the obfuscation process.java.lang.StringgetAnnotationClass()Gets annotation class.static voidmain(java.lang.String[] args)Main.protected ObfuscatorTask.AdjustSectionnewAdjustSection()Instantiates an adjust section, subclasses may provide custom implementations.protected EntryPointsSectionnewEntryPointsSection(YGuardBaseTask bt)Instantiates an entry points section, subclasses may provide custom implementations.protected ExposeSectionnewExposeSection(ObfuscatorTask ot)Instantiates the expose section, subclasses may provide custom implementations.protected GuardDBnewGuardDB(java.io.File[] inFile)Instantiates the classfile database for obfuscation, subclasses may provide custom implementations.protected ObfuscatorTask.MapSectionnewMapSection()Instantiates the nestedmapelement, subclasses may provide custom implementations.protected ObfuscatorTask.PatchSectionnewPatchSection()Instantiates the nestedpatchelement, subclasses may provide custom implementations.protected ObfuscatorTask.ResourceAdjusternewResourceAdjuster(GuardDB db)Instantiates the type Resource adjuster, subclasses may provide custom implementations.voidsetAnnotationClass(java.lang.String annotationClass)Sets annotation class.voidsetConserveManifest(boolean c)Used by ant to handle theconservemanifestattribute.voidsetLogFile(java.io.File file)Used by ant to handle thelogfileattribute.voidsetMainClass(java.lang.String mainClass)Used by ant to handle themainclassattribute.voidsetNeedYShrinkModel(boolean b)Sets need y shrink model.voidsetReplaceClassNameStrings(boolean replaceClassNameStrings)Setter for property replaceClassNameStrings.voidsetScramble(boolean scramble)Sets scramble.voidsetShrink(boolean doShrink)Sets shrink.voidsetShrinkLog(java.io.File shrinkLog)Sets shrink log.voidsetUseExposeAsEntryPoints(boolean useExposeAsEntryPoints)Sets use expose as entry points.static java.lang.StringtoNativeClass(java.lang.String className)To native class string.static java.lang.String[]toNativeMethod(java.lang.String javaMethod)To native method string [ ].static java.lang.String[]toNativePattern(java.lang.String[] patterns)To native pattern string [ ].-
Methods inherited from class com.yworks.common.ant.YGuardBaseTask
addConfiguredInOutPair, addConfiguredInOutPairs, addConfiguredProperty, createAttribute, createExternalClasses, createInOutPair, newAttributesSection, newInOutPair, setResourceClassPath
-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Field Detail
-
expose
protected ExposeSection expose
-
adjustSections
protected java.util.List<ObfuscatorTask.AdjustSection> adjustSections
-
map
protected ObfuscatorTask.MapSection map
-
patch
protected ObfuscatorTask.PatchSection patch
-
entryPoints
protected EntryPointsSection entryPoints
-
-
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 nestedexposeelement.- 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
-
createKeep
public Exclude createKeep()
Description copied from class:YGuardBaseTaskCreate keep exclude.- Specified by:
createKeepin classYGuardBaseTask- Returns:
- the exclude
-
addAttributesSections
public void addAttributesSections(java.util.List<AttributesSection> attributesSections)
Description copied from class:YGuardBaseTaskAdd attributes sections.- Specified by:
addAttributesSectionsin classYGuardBaseTask- Parameters:
attributesSections- the attributes sections
-
createAdjust
public ObfuscatorTask.AdjustSection createAdjust()
Used by ant to handle the nestedadjustelement.- 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 nestedexposeelement.- 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 nestedentrypointselement.- Parameters:
eps- the eps
-
createMap
public ObfuscatorTask.MapSection createMap()
Used by ant to handle the nestedmapelement.- Returns:
- an instance of MapSection
-
newMapSection
protected ObfuscatorTask.MapSection newMapSection()
Instantiates the nestedmapelement, subclasses may provide custom implementations.- Returns:
- a new instance of MapSection
-
addConfiguredMap
public void addConfiguredMap(ObfuscatorTask.MapSection map)
Used by ant to handle the nestedmapelement.- Parameters:
map- the map
-
createPatch
public ObfuscatorTask.PatchSection createPatch()
Used by ant to handle the nestedpatchelement.- Returns:
- an instance of PatchSection
-
newPatchSection
protected ObfuscatorTask.PatchSection newPatchSection()
Instantiates the nestedpatchelement, subclasses may provide custom implementations.- Returns:
- a new instance of PatchSection
-
addConfiguredPatch
public void addConfiguredPatch(ObfuscatorTask.PatchSection patch)
Used by ant to handle the nestedpatchelement.- Parameters:
patch- the patch
-
setLogFile
public void setLogFile(java.io.File file)
Used by ant to handle thelogfileattribute.- Parameters:
file- the file
-
setConserveManifest
public void setConserveManifest(boolean c)
Used by ant to handle theconservemanifestattribute.- Parameters:
c- the c
-
setMainClass
public void setMainClass(java.lang.String mainClass)
Used by ant to handle themainclassattribute.- Parameters:
mainClass- the main class
-
execute
public void execute() throws org.apache.tools.ant.BuildExceptionUsed by ant to handle the start the obfuscation process.- Overrides:
executein classorg.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.IOExceptionAdd 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
-
-