From 32dae0bfd170c918d3b3207c5f22322bc7295645 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Wed, 7 Oct 2009 07:44:54 -0400 Subject: [PATCH] Fixes to proguard action --- project/build/LauncherProguard.scala | 4 ++-- project/build/ProguardProject.scala | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/project/build/LauncherProguard.scala b/project/build/LauncherProguard.scala index 4868e7465..af98730e0 100644 --- a/project/build/LauncherProguard.scala +++ b/project/build/LauncherProguard.scala @@ -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) = { diff --git a/project/build/ProguardProject.scala b/project/build/ProguardProject.scala index 5aa8565ba..93be136a5 100644 --- a/project/build/ProguardProject.scala +++ b/project/build/ProguardProject.scala @@ -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 {