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]) =
|
||||
{
|
||||
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
|
||||
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"))
|
||||
|
||||
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)
|
||||
((withJar(ivyJars.toSeq, "Ivy") + excludeIvyResourcesString) ::
|
||||
(withJar(jlineJars, "JLine") + "(!META-INF/**)" ) ::
|
||||
|
|
|
|||
|
|
@ -69,14 +69,16 @@ trait ProguardProject extends BasicScalaProject
|
|||
private def writeProguardConfigurationTask =
|
||||
task
|
||||
{
|
||||
val externalDependencies = (mainCompileConditional.analysis.allExternals).map(_.getAbsoluteFile).filter(_.getName.endsWith(".jar"))
|
||||
log.debug("proguard configuration external dependencies: \n\t" + externalDependencies.mkString("\n\t"))
|
||||
val dependencies = mainDependencies.snapshot
|
||||
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
|
||||
// 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)
|
||||
log.debug("proguard configuration library jars locations: " + libraryJars.mkString(", "))
|
||||
val libraryJars = dependencies.libraries ++ dependencies.scalaJars//toList.partition(jar => Path.relativize(rootProjectDirectory, jar).isDefined)
|
||||
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)
|
||||
FileUtilities.write(proguardConfigurationPath.asFile, proguardConfiguration, log)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue