From 003ead112c31534e33c7f694e33bc0e2e1062156 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 12 Jul 2017 15:46:17 +0300 Subject: fixes --- stage2/plugins/ExportBuildInformation.scala | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/stage2/plugins/ExportBuildInformation.scala b/stage2/plugins/ExportBuildInformation.scala index 80cdef5..e9246c4 100644 --- a/stage2/plugins/ExportBuildInformation.scala +++ b/stage2/plugins/ExportBuildInformation.scala @@ -56,11 +56,6 @@ object BuildInformation { private case class ExportParameters( extraModulePaths: Seq[String], needCbtLibs: Boolean ) - def apply(build: BaseBuild, args: Seq[String]): Project = { - val parameters = ExportParameters(args) - new BuildInformationExporter(build, parameters).exportBuildInformation - } - private object ExportParameters { def apply(args: Seq[String]): ExportParameters = { val argumentParser = new ArgumentParser(args) @@ -75,6 +70,13 @@ object BuildInformation { } } + def apply(build: BaseBuild, args: Seq[String]): Project = { + val parameters = ExportParameters(args) + println(s"Params is $parameters") + new BuildInformationExporter(build, parameters).exportBuildInformation + } + + class BuildInformationExporter(rootBuild: BaseBuild, parameters: ExportParameters) { import parameters._ @@ -328,13 +330,13 @@ class ArgumentParser(arguments: Seq[String]) { .sliding(2) .map(_.toList) .foldLeft(Map.empty[String, Option[String]]) { - case (m, Seq(k, v)) if k.startsWith("--") && !v.startsWith("--") => m + (k -> Some(v)) - case (m, k::_) if k.startsWith("--") => m + (k -> None) + case (m, Seq(k, v)) if k.startsWith("--") && !v.startsWith("--") => m + (k.stripPrefix("--") -> Some(v)) + case (m, k::_) if k.startsWith("--") => m + (k.stripPrefix("--") -> None) case (m, _) => m } - + def value(key: String): Option[String] = - argumentsMap.get(key).flatten + argumentsMap.get(key.stripPrefix("--")).flatten def persists(key: String) = argumentsMap.isDefinedAt(key) -- cgit v1.2.3