Martin Dimitrov
Martin Dimitrov

Reputation: 4956

proguard as ant task

I actually have two related questions:

  1. Can predefined constants be expanded in the task declarations as <injar file="${build}/myjar.jar" />?
  2. How can I reuse the classpath definition in proguard? What I am trying to achieve is not to specify the whole set of required libraries. They are quite a lot and they are already included in ant's classpath with specific id.

Thanks a lot.

Martin

Upvotes: 3

Views: 4510

Answers (2)

Robert
Robert

Reputation: 42615

Of course you can use Ant variables. However from my point of view it is easier to write all command-line options into the body of the proguard task:

<taskdef resource="proguard/ant/task.properties" classpath="lib/proguard.jar" />
<proguard>
    -libraryjars "${java.home}/lib/rt.jar"
    -injars     "${jar.name}"
    -outjars    build/temp.jar
    -keep class test.Main { public static void main(java.lang.String[]); }
    -dontwarn
    -dontoptimize 
    -dontobfuscate
</proguard>

For converting a defined Class path to a string that can be included into the proguard definition you can use the Ant task PathConvert. The first example on the linked page should be what you need.

Update: How to get the quotes around the path entries has been answered here: How to properly quote a path in an ant task?

Upvotes: 4

ewan.chalmers
ewan.chalmers

Reputation: 16235

To answer your first question, yes. Expansion of variables like that in a build file is a feature of Ant. It will work with any tasks you use.

Upvotes: 1

Related Questions