From 0b2d5fffa3c92fd976c778f8e612d17257b52870 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Mon, 10 Jul 2017 21:07:31 +0300 Subject: Refactoring --- stage2/plugins/ExportBuildInformation.scala | 45 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/stage2/plugins/ExportBuildInformation.scala b/stage2/plugins/ExportBuildInformation.scala index c5c69ab..ebbfd2a 100644 --- a/stage2/plugins/ExportBuildInformation.scala +++ b/stage2/plugins/ExportBuildInformation.scala @@ -43,12 +43,13 @@ object BuildInformation { case class ScalaCompiler( version: String, jars: Seq[File] ) - case class LibraryJar( jar: File, jarType: JarType.JarType ) + case class LibraryJar( jar: File, jarType: JarType ) - object JarType extends Enumeration { - type JarType = Value - val Binary = Value("binary") - val Source = Value("source") + case class JarType( name: String ) + + object JarType { + object Binary extends JarType( "binary" ) + object Source extends JarType( "source" ) } object Project { @@ -80,13 +81,13 @@ object BuildInformation { .map(v => ScalaCompiler(v, resolveScalaCompiler(rootBuild, v))) Project( - rootModule.name, - rootModule.root, - rootModule, - modules, - libraries, - cbtLibraries, - scalaCompilers + name = rootModule.name, + root= rootModule.root, + rootModule = rootModule, + modules = modules, + libraries = libraries, + cbtLibraries = cbtLibraries, + scalaCompilers = scalaCompilers ) } @@ -222,7 +223,7 @@ object BuildInformation { if (source.isDirectory) source else - source.getParentFile //Let's asume that for now + source.getParentFile //Let's assume that for now private def formatMavenDependency(dependency: cbt.MavenDependency) = @@ -242,7 +243,7 @@ object BuildInformation { object BuildInformationSerializer { def serialize(project: BuildInformation.Project): Node = - + {project.modules.map(serialize)} @@ -258,21 +259,21 @@ object BuildInformationSerializer { private def serialize(module: BuildInformation.Module): Node = - + - {module.sourceDirs.map(d => {d})} + {module.sourceDirs.map(d => {d.getPath: String})} - {module.scalacOptions.map(o => )} + {module.scalacOptions.map(o => )} {module.binaryDependencies.map(serialize)} {module.moduleDependencies.map(serialize)} - {module.classpath.map(c => {c.toString})} + {module.classpath.map(c => {c.getPath: String})} - {module.parentBuild.map(p => {p}).getOrElse(NodeSeq.Empty)} + {module.parentBuild.map(p => {p: String}).getOrElse(NodeSeq.Empty)} private def serialize(binaryDependency: BuildInformation.BinaryDependency): Node = @@ -280,14 +281,14 @@ object BuildInformationSerializer { private def serialize(library: BuildInformation.Library): Node = - {library.jars.map(j => {j.jar})} + {library.jars.map(j => {j.jar.getPath: String})} private def serialize(compiler: BuildInformation.ScalaCompiler): Node = - {compiler.jars.map(j => {j})} + {compiler.jars.map(j => {j.getPath: String})} private def serialize(moduleDependency: BuildInformation.ModuleDependency): Node = - {moduleDependency.name} + {moduleDependency.name: String} } \ No newline at end of file -- cgit v1.2.3