Fixes to proguard action

This commit is contained in:
Mark Harrah 2009-10-07 07:44:54 -04:00
parent 651a84ebaf
commit 32dae0bfd1
2 changed files with 8 additions and 4 deletions

View File

@ -23,10 +23,10 @@ trait ProguardLaunch extends ProguardProject
(withJar(ivyJars.toSeq, "Ivy") + "(!META-INF/**,!fr/**,!**/antlib.xml,!**/*.png)") ::
(withJar(jlineJars, "JLine") + "(!META-INF/**)" ) ::
otherJars.map( _.getAbsolutePath + "(!META-INF/**,!*.properties)").toList
otherJars.map(jar => mkpath(jar) + "(!META-INF/**,!*.properties)").toList
}
private def withJar[T](files: Seq[File], name: String) = files.firstOption.getOrElse(error(name + " not present (try running update)")).getAbsolutePath
private def withJar[T](files: Seq[File], name: String) = mkpath(files.firstOption.getOrElse(error(name + " not present (try running update)")))
private def isJLineJar(file: File) = isJarX(file, "jline")
private def isJarX(file: File, x: String) =
{

View File

@ -34,6 +34,9 @@ trait ProguardProject extends BasicScalaProject
"-ignorewarnings")
def keepClasses: Seq[String] = Nil
def mapInJars(inJars: Seq[File]): Seq[String] = inJars.map(f => "-injars " + mkpath(f))
def mapLibraryJars(libraryJars: Seq[File]): Seq[String] = libraryJars.map(f => "-libraryjars " + mkpath(f))
def template(inJars: Seq[File], libraryJars: Seq[File], outJar: File, options: Seq[String], mainClass: Option[String], keepClasses: Seq[String]) =
{
val keepMain =
@ -44,14 +47,15 @@ trait ProguardProject extends BasicScalaProject
val lines =
options ++
keepClasses.map("-keep public class " + _ + " {\n public * ;\n}") ++
inJars.map(f => "-injars " + mkpath(f)) ++
mapInJars(inJars) ++
Seq("-injars " + mkpath(rawJarPath.asFile),
"-outjars " + mkpath(outJar)) ++
libraryJars.map(f => "-libraryjars " + mkpath(f)) ++
mapLibraryJars(libraryJars) ++
mainClass.map(main => keepMain.stripMargin.format(main)).toList
lines.mkString("\n")
}
def mkpath(f: File) = '\"' + f.getAbsolutePath + '\"'
private def proguardTask =
task
{