mirror of https://github.com/sbt/sbt.git
Fixes to proguard action
This commit is contained in:
parent
651a84ebaf
commit
32dae0bfd1
|
|
@ -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) =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue