diff options
author | Ilya Kirillov <darthorimar@users.noreply.github.com> | 2017-06-27 18:31:07 +0300 |
---|---|---|
committer | Ilya Kirillov <darthorimar@users.noreply.github.com> | 2017-06-28 14:12:51 +0300 |
commit | b639453a2483da1cba2a1b23f1dd955d05ff6ab8 (patch) | |
tree | 31ac9018db7a53762239195dad91b64b3415f5d0 | |
parent | df739f71154152c86a433f2180080b0de5c96a3c (diff) | |
download | cbt-b639453a2483da1cba2a1b23f1dd955d05ff6ab8.tar.gz cbt-b639453a2483da1cba2a1b23f1dd955d05ff6ab8.tar.bz2 cbt-b639453a2483da1cba2a1b23f1dd955d05ff6ab8.zip |
Library sources
-rw-r--r-- | stage2/plugins/ExportBuildInformation.scala | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/stage2/plugins/ExportBuildInformation.scala b/stage2/plugins/ExportBuildInformation.scala index be61609..597b7d8 100644 --- a/stage2/plugins/ExportBuildInformation.scala +++ b/stage2/plugins/ExportBuildInformation.scala @@ -33,8 +33,8 @@ object BuildInformation { parentBuild: Option[String], scalacOptions: Seq[String] ) - - case class Library( name: String, jars: Seq[File] ) + + case class Library( name: String, jars: Seq[LibraryJar] ) case class BinaryDependency( name: String ) @@ -42,6 +42,14 @@ object BuildInformation { case class ScalaCompiler( version: String, jars: Seq[File] ) + case class LibraryJar( jar: File, jarType: JarType.JarType ) + + object JarType extends Enumeration { + type JarType = Value + val Binary = Value("binary") + val Source = Value("source") + } + object Project { def apply(build: BaseBuild): Project = new BuildInformationExporter(build).exportBuildInformation @@ -161,15 +169,25 @@ object BuildInformation { .flatten .distinct - private def exportLibrary(mavenDependency: BoundMavenDependency) = { - val name = formatMavenDependency(mavenDependency.mavenDependency) - val jars = (mavenDependency +: mavenDependency.transitiveDependencies) - .map(_.asInstanceOf[BoundMavenDependency].jar) - Library(name, jars) + private def exportLibrary(dependency: BoundMavenDependency) = { + val name = formatMavenDependency(dependency.mavenDependency) + val jars = (dependency +: dependency.transitiveDependencies) + .map(_.asInstanceOf[BoundMavenDependency]) + val binaryJars = jars + .map(_.jar) + .map(LibraryJar(_, JarType.Binary)) + + implicit val logger: Logger = rootBuild.context.logger + implicit val transientCache: java.util.Map[AnyRef, AnyRef] = rootBuild.context.transientCache + implicit val classLoaderCache: ClassLoaderCache = rootBuild.context.classLoaderCache + val sourceJars = jars + .map { d => d.copy(mavenDependency = d.mavenDependency.copy(classifier = Classifier.sources)).jar } + .map(LibraryJar(_, JarType.Source)) + Library(name, binaryJars ++ sourceJars) } private def exportLibrary(file: File) = - Library("CBT:" + file.getName.stripSuffix(".jar"), Seq(file)) + Library("CBT:" + file.getName.stripSuffix(".jar"), Seq(LibraryJar(file, JarType.Binary))) private def collectParentBuilds(build: BaseBuild): Seq[BaseBuild] = build.context.parentBuild @@ -245,7 +263,7 @@ object BuildInformationSerializer { private def serialize(library: BuildInformation.Library): Node = <library name={library.name}> - {library.jars.map(j => <jar>{j}</jar>)} + {library.jars.map(j => <jar type={j.jarType.toString}>{j.jar}</jar>)} </library> private def serialize(compiler: BuildInformation.ScalaCompiler): Node = |