diff options
author | Ilya Kirillov <darthorimar@users.noreply.github.com> | 2017-07-12 15:46:17 +0300 |
---|---|---|
committer | Ilya Kirillov <darthorimar@users.noreply.github.com> | 2017-07-17 19:34:16 +0300 |
commit | 003ead112c31534e33c7f694e33bc0e2e1062156 (patch) | |
tree | 82e7c3de3a89953b9002aec45553a062a82374fe | |
parent | 5e916bcd6e5e1454360893a56e495b8e54e5955d (diff) | |
download | cbt-003ead112c31534e33c7f694e33bc0e2e1062156.tar.gz cbt-003ead112c31534e33c7f694e33bc0e2e1062156.tar.bz2 cbt-003ead112c31534e33c7f694e33bc0e2e1062156.zip |
fixes
-rw-r--r-- | stage2/plugins/ExportBuildInformation.scala | 20 |
1 files 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) |