Apache Ant Tasks - RetroGuard Documentation


Prev   Contents   Next

Apache Ant is a Java-based build tool. So that RetroGuard can be used with Ant, several Ant tasks have been supplied in the retroguard.jar:

COM.rl.ant.RetroGuardTask
COM.rl.ant.RGpatchTask
COM.rl.ant.RGconvTask

This section describes the Ant tasks; to understand the tools themselves, please refer to the appropriate sections of this document for RetroGuard, RGpatch, and RGconv.

RetroGuardTask

Description

Obfuscates a jar-archive of Java classes and other resource files.

Internal defaults are provided for all parameters (see below). Note that the list of classes, methods, fields, and attributes to be preserved from obfuscation should be listed as usual in a RetroGuard script file.

Parameters

Attribute Description Required
infile name of input jar, containing classes to be obfuscated No; defaults to 'in.jar'
outfile name of output, obfuscated jar No; defaults to 'out.jar'
rgsfile RetroGuard script file; a list of classes, methods, fields, and attributes to be preserved from obfuscation No; defaults to 'script.rgs' or, if that file is not present, uses an internal default script
logfile name of log file, showing Java identifier mappings No; defaults to 'retroguard.log'

RGpatchTask

Description

Extract obfuscated files from a Jar and repack a requested subset of them into a patch Jar.

Parameters

Attribute Description Required
infile name of jar containing all obfuscated classes Yes
outfile name of patch jar file to create Yes
rgsfile name of log file from the obfuscation of 'infile' Yes
listfile name of file containing list of classes for the patch Yes

RGconvTask

Description

Convert a list of unobfuscated class names to their obfuscated form.

Parameters

Attribute Description Required
rgsfile name of log file from the obfuscation process Yes
inlistfile name of file containing list of class-names to be converted Yes
outlistfile output file name containing list of obfuscated identifiers Yes

Example

<project name="Test RetroGuard Ant tasks" default="runAll" basedir="."> 

  <taskdef name="RetroGuardTask" classname="COM.rl.ant.RetroGuardTask"/> 
  <taskdef name="RGpatchTask" classname="COM.rl.ant.RGpatchTask"/> 
  <taskdef name="RGconvTask" classname="COM.rl.ant.RGconvTask"/> 

  <target name="runAll" depends="runRetroGuardTask,runRGPatchTask,runRGconvTask"> 
  </target> 

  <!-- Obfuscate 'in.jar' to 'out.jar' using internal default script, --> 
  <!-- and send mapping log to 'retroguard.log'. --> 
  <target name="runRetroGuardTask"> 
    <RetroGuardTask /> 
  </target> 

  <target name="runRGPatchTask" depends="runRetroGuardTask"> 
    <!-- Obfuscate a new version, using the name mappings from before. --> 
    <RetroGuardTask 
      infile="in2.jar" 
      outfile="out2.jar" 
      rgsfile="retroguard.log" 
      logfile="retroguard2.log" /> 
    <!-- Create 'patch.jar' from this, containing classes in 'patch.lst'. --> 
    <RGpatchTask 
      infile="out2.jar" 
      outfile="patch.jar" 
      rgsfile="retroguard2.log" 
      listfile="patch.lst" /> 
  </target> 

  <target name="runRGconvTask"> 
    <!-- Map the Java identifiers in 'preobf.lst' to 'postobf.lst' --> 
    <!-- using the name mappings from 'retroguard.log'. --> 
    <RGconvTask 
      rgsfile="retroguard.log" 
      inlistfile="preobf.lst" 
      outlistfile="postobf.lst" /> 
  </target> 
</project>

Prev   Contents   Next
 Copyright © 1998-2007 Retrologic Systems.
 All rights reserved.