diff options
author | Paul Phillips <paulp@improving.org> | 2011-01-27 20:24:50 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-01-27 20:24:50 +0000 |
commit | 330febc72b402aac2460be2cbc212d5860ed205c (patch) | |
tree | d43f7039557f0e6261f49f243e52c69f61eac9f6 /project/build/Packer.scala | |
parent | 0d29472c7796ce6462e0893d7f401b56cbad1754 (diff) | |
download | scala-330febc72b402aac2460be2cbc212d5860ed205c.tar.gz scala-330febc72b402aac2460be2cbc212d5860ed205c.tar.bz2 scala-330febc72b402aac2460be2cbc212d5860ed205c.zip |
Securing some of the blessings of whitespace fo...
Securing some of the blessings of whitespace for the sbt build. No
review.
Diffstat (limited to 'project/build/Packer.scala')
-rw-r--r-- | project/build/Packer.scala | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/project/build/Packer.scala b/project/build/Packer.scala index 92df80299b..fde5a732a9 100644 --- a/project/build/Packer.scala +++ b/project/build/Packer.scala @@ -1,5 +1,5 @@ import sbt._ -import java.io.{File,FileInputStream} +import java.io.{File, FileInputStream} import java.util.jar.Manifest import AdditionalResources._ import FileUtilities._ @@ -13,17 +13,17 @@ object Packer { */ // We must exclude the manifest because we generate it automatically, and when we add multiples other jars, they could have // also a manifest files each, resulting in conflicts for the FileUtilities.jar(..) method - def jarPattern(path:PathFinder) = path.descendentsExcept(AllPassFilter, (".*" - ".") || HiddenFileFilter || new ExactFilter("MANIFEST.MF")).get + def jarPattern(path: PathFinder) = path.descendentsExcept(AllPassFilter, (".*" - ".") || HiddenFileFilter || new ExactFilter("MANIFEST.MF")).get - def createJar(j:Packaging,log:Logger):Option[String]=createJar(j.packagingConfig,log,jarPattern _,true) - def createJar(j:PackagingConfiguration,log:Logger):Option[String]=createJar(j,log,jarPattern _,true) + def createJar(j: Packaging, log: Logger): Option[String] = createJar(j.packagingConfig, log, jarPattern _, true) + def createJar(j: PackagingConfiguration, log: Logger): Option[String] = createJar(j, log, jarPattern _, true) /** * Create a jar from the packaging trait. Is able to add directly others jars to it */ - def createJar(j:PackagingConfiguration,log:Logger,filter:(PathFinder)=>Iterable[Path],addIncludedLibs:Boolean):Option[String] = { - def pack0(content:Iterable[Path])=jar(content.flatMap(filter(_)),j.jarDestination, j.manifest, false, log) + def createJar(j: PackagingConfiguration, log: Logger, filter:(PathFinder) => Iterable[Path], addIncludedLibs: Boolean): Option[String] = { + def pack0(content: Iterable[Path])= jar(content.flatMap(filter(_)), j.jarDestination, j.manifest, false, log) j.jarsToInclude match { case Nil => pack0(j.content) @@ -31,8 +31,8 @@ object Packer { withTemporaryDirectory(log) { tmp: File => val tmpPath = Path.fromFile(tmp) log.debug("List of jars to be added : " +list) - def unzip0(l:List[Path]):Option[String] = l match { - case x::xs => {unzip(x,tmpPath,log);unzip0(xs)} //TODO properly handle failing of unzip + def unzip0(l: List[Path]): Option[String] = l match { + case x :: xs => {unzip(x, tmpPath, log);unzip0(xs)} //TODO properly handle failing of unzip case Nil => None } unzip0(list) @@ -54,17 +54,17 @@ object Packer { trait Packer { self: BasicLayer => - def libraryToCopy:List[Path] = Nil + def libraryToCopy: List[Path] = Nil /** * The actual pack task. */ - def packF= { + def packF = { import Packer._ - def iterate(steps:List[Step]):Option[String]= steps match{ - case x::xs => x match{ - case c:Packaging => { - createJar(c,log) orElse iterate(xs) + def iterate(steps: List[Step]): Option[String] = steps match { + case x :: xs => x match { + case c: Packaging => { + createJar(c, log) orElse iterate(xs) } case _ => iterate(xs) } @@ -72,8 +72,8 @@ trait Packer { } def copy0 ={ - copyFile(manifestPath,packingDestination/"META-INF"/"MANIFEST.MF",log) orElse { - copy(libraryToCopy,packingDestination , true,true,log) match { + copyFile(manifestPath,packingDestination/"META-INF"/"MANIFEST.MF", log) orElse { + copy(libraryToCopy, packingDestination , true, true, log) match { case Right(_) => None case Left(e) => Some(e) } @@ -81,31 +81,31 @@ trait Packer { } iterate(allSteps.topologicalSort) orElse copy0 } - lazy val pack=task{packF}.dependsOn(finishLayer) + lazy val pack = task {packF}.dependsOn(finishLayer) } -class PackagingConfiguration(val jarDestination:Path, val content:Iterable[Path],val manifest:Manifest,val jarsToInclude:List[Path]){ - def this(jarDestination:Path,content:Iterable[Path])=this(jarDestination,content, new Manifest,Nil) - def this(jarDestination:Path,content:Iterable[Path],jarsToInclude:List[Path])=this(jarDestination,content,new Manifest, jarsToInclude) +class PackagingConfiguration(val jarDestination: Path, val content: Iterable[Path], val manifest: Manifest, val jarsToInclude: List[Path]){ + def this(jarDestination: Path, content: Iterable[Path])= this(jarDestination, content, new Manifest, Nil) + def this(jarDestination: Path, content: Iterable[Path], jarsToInclude: List[Path])= this(jarDestination, content, new Manifest, jarsToInclude) } -trait Packaging extends Step{ - def packagingConfig:PackagingConfiguration +trait Packaging extends Step { + def packagingConfig: PackagingConfiguration } trait WrapperPackaging extends Packaging { self : WrapperStep => def jarContent = { - def getContent(list:List[Step],acc:List[Path]):List[Path]= list match { + def getContent(list: List[Step], acc: List[Path]): List[Path] = list match { case Nil => acc - case x::xs => x match { - case w:WrapperStep => getContent(xs,getContent(w.dependencies.toList,acc)) - case c:CompilationStep => getContent(xs,(c.outputDirectory ##)::acc) + case x :: xs => x match { + case w: WrapperStep => getContent(xs, getContent(w.dependencies.toList, acc)) + case c: CompilationStep => getContent(xs, (c.outputDirectory ##) :: acc) } } - getContent(dependencies.toList,Nil) + getContent(dependencies.toList, Nil) } } @@ -114,9 +114,9 @@ trait WrapperPackaging extends Packaging { * compilation of the step has finished. It permits to have use libraries that are build using a plugin. (The plugin must * be a jar in order to be recognised by the compiler. */ -trait EarlyPackaging extends Packaging{ - self:CompilationStep => - //def earlyPackagingDestination:Path +trait EarlyPackaging extends Packaging { + self: CompilationStep => + //def earlyPackagingDestination: Path //def earlyJarDestination = earlyPackagingDestination / jarName - def earlyPackagingConfig:PackagingConfiguration + def earlyPackagingConfig: PackagingConfiguration } |