mirror of https://github.com/sbt/sbt.git
Updated 'proguard' task to work with 0.7
This commit is contained in:
parent
d49cfc6b03
commit
f759aa3edb
|
|
@ -13,13 +13,15 @@ trait ProguardLaunch extends ProguardProject
|
||||||
override def mapInJars(inJars: Seq[File]) =
|
override def mapInJars(inJars: Seq[File]) =
|
||||||
{
|
{
|
||||||
val inputJar = jarPath.asFile.getAbsolutePath
|
val inputJar = jarPath.asFile.getAbsolutePath
|
||||||
val (jlineJars, notJLine) = inJars.partition(isJLineJar)
|
val jlineJars = runClasspath.getFiles.filter(isJLineJar)
|
||||||
// pull out Ivy in order to exclude resources inside
|
// pull out Ivy in order to exclude resources inside
|
||||||
val (ivyJars, notIvy) = notJLine.partition(isIvyJar)
|
val (ivyJars, notIvy) = inJars.filter(jar => !isJLineJar(jar)).partition(isIvyJar)
|
||||||
val otherJars = notIvy.filter(jar => !isJarX(jar, "scala-compiler"))
|
val otherJars = notIvy.filter(jar => !isJarX(jar, "scala-compiler"))
|
||||||
|
|
||||||
log.debug("proguard configuration ivy jar location: " + ivyJars.mkString(", "))
|
log.debug("proguard configuration:")
|
||||||
|
log.debug("\tJLline jar location: " + jlineJars.mkString(", "))
|
||||||
|
log.debug("\tIvy jar location: " + ivyJars.mkString(", "))
|
||||||
|
log.debug("\tOther jars:\n\t" + otherJars.mkString("\n\t"))
|
||||||
val excludeIvyResourcesString = excludeString(excludeIvyResources)
|
val excludeIvyResourcesString = excludeString(excludeIvyResources)
|
||||||
((withJar(ivyJars.toSeq, "Ivy") + excludeIvyResourcesString) ::
|
((withJar(ivyJars.toSeq, "Ivy") + excludeIvyResourcesString) ::
|
||||||
(withJar(jlineJars, "JLine") + "(!META-INF/**)" ) ::
|
(withJar(jlineJars, "JLine") + "(!META-INF/**)" ) ::
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,16 @@ trait ProguardProject extends BasicScalaProject
|
||||||
private def writeProguardConfigurationTask =
|
private def writeProguardConfigurationTask =
|
||||||
task
|
task
|
||||||
{
|
{
|
||||||
val externalDependencies = (mainCompileConditional.analysis.allExternals).map(_.getAbsoluteFile).filter(_.getName.endsWith(".jar"))
|
val dependencies = mainDependencies.snapshot
|
||||||
log.debug("proguard configuration external dependencies: \n\t" + externalDependencies.mkString("\n\t"))
|
log.debug("proguard configuration, all dependencies:\n\t" + dependencies.all.mkString("\n\t"))
|
||||||
|
val externalJars = dependencies.external// mainDependencies.map(_.getAbsoluteFile).filter(_.getName.endsWith(".jar"))
|
||||||
|
log.debug("proguard configuration external dependencies: \n\t" + externalJars.mkString("\n\t"))
|
||||||
// partition jars from the external jar dependencies of this project by whether they are located in the project directory
|
// partition jars from the external jar dependencies of this project by whether they are located in the project directory
|
||||||
// if they are, they are specified with -injars, otherwise they are specified with -libraryjars
|
// if they are, they are specified with -injars, otherwise they are specified with -libraryjars
|
||||||
val (externalJars, libraryJars) = externalDependencies.toList.partition(jar => Path.relativize(rootProjectDirectory, jar).isDefined)
|
val libraryJars = dependencies.libraries ++ dependencies.scalaJars//toList.partition(jar => Path.relativize(rootProjectDirectory, jar).isDefined)
|
||||||
log.debug("proguard configuration library jars locations: " + libraryJars.mkString(", "))
|
log.debug("proguard configuration library jars locations:\n\t" + libraryJars.mkString("\n\t"))
|
||||||
|
|
||||||
val proguardConfiguration = template(externalJars, libraryJars, outputJar.asFile, basicOptions, getMainClass(false), keepClasses)
|
val proguardConfiguration = template(libraryJars, externalJars, outputJar.asFile, basicOptions, getMainClass(false), keepClasses)
|
||||||
log.debug("Proguard configuration written to " + proguardConfigurationPath)
|
log.debug("Proguard configuration written to " + proguardConfigurationPath)
|
||||||
FileUtilities.write(proguardConfigurationPath.asFile, proguardConfiguration, log)
|
FileUtilities.write(proguardConfigurationPath.asFile, proguardConfiguration, log)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue