Search code examples
androidscalasbtproguardsbt-android-plugin

What are the semantics of "proguardInJars" in SBT Android-Plugin?


In SBT Android Plugin, in proguardTask, there is a value proguardInJars.
In my simple test project it contains C:\Users\Administrator\.sbt\boot\scala-2.9.1\lib\scala-library.jar.

It is then combined with my own compiled classes into another value inJars.

However, it is combined by appending something to it. Here's the code from jberkel/android-plugin that does that:

val manifestr = List("!META-INF/MANIFEST.MF", "R.class", "R$*.class", "TR.class", "TR$.class", "library.properties")
val sep = JFile.pathSeparator
val inJars = ("\"" + classDirectory.absolutePath + "\"") +: proguardInJars.map("\"" + _ + "\""+manifestr.mkString("(", ",!**/", ")"))

I am wondering is anyone knows the semantics of that added stuff.
Also, if I were to break inJars into separate values, would I still need to append that manifest stuff to proguardInJars in order for proguardTask to run without problems?


Solution

  • The android plugin is preparing the injars command line argument for ProGuard at that point. ProGuard uses generalized classpaths to figure out which files from a jar to consider, and which not to, a form of file matchers within the jars.

    For example, .../scala-library.jar(!META-INF/MANIFEST.MF,!**/R.class,!**/R$*.class,!**/TR.class,!**/TR$.class,!**/library.properties) means that files R/TR.class or classfiles starting with R$/TR$ should not (!) be taken into consideration as an input.

    See here:

    http://proguard.sourceforge.net/index.html#manual/usage.html

    Click on class_path to show more details about the generalized classpath format that ProGuard uses.