Permalink
Browse files

trivial: rephrasing "import" path to "include" path. Thrift has inclu…

…de statements, and we've been using "import" which could be confusing
  • Loading branch information...
1 parent 8720687 commit 1617518cc7002e984c76c74e402516db1fb4f9d1 @chunyan chunyan committed Apr 11, 2013
@@ -32,7 +32,7 @@ class Compiler {
import Language._
val defaultDestFolder = "."
var destFolder: String = defaultDestFolder
- val importPaths = new mutable.ListBuffer[String]
+ val includePaths = new mutable.ListBuffer[String]
val thriftFiles = new mutable.ListBuffer[String]
val flags = new mutable.HashSet[ServiceOption]
val namespaceMappings = new mutable.HashMap[String, String]
@@ -62,7 +62,7 @@ class Compiler {
// compile
for (inputFile <- thriftFiles) {
- val importer = Importer(new File(".")) +: Importer(importPaths)
+ val importer = Importer(new File(".")) +: Importer(includePaths)
val parser = new ThriftParser(importer, strict)
val doc0 = parser.parseFile(inputFile).mapNamespaces(namespaceMappings.toMap)
@@ -52,8 +52,8 @@ object Main {
"write generated code to a folder (default: %s)".format(compiler.defaultDestFolder), { x: String =>
compiler.destFolder = x
})
- opt("i", "import-path", "<path>", "path(s) to search for imported thrift files (may be used multiple times)", { path: String =>
- compiler.importPaths ++= path.split(File.pathSeparator); ()
+ opt("i", "include-path", "<path>", "path(s) to search for included thrift files (may be used multiple times)", { path: String =>
+ compiler.includePaths ++= path.split(File.pathSeparator); ()
})
opt("n", "namespace-map", "<oldname>=<newname>", "map old namespace to new (may be used multiple times)", { mapping: String =>
mapping.split("=") match {
@@ -36,7 +36,7 @@ class ScroogeRunner {
val compiler = new Compiler()
compiler.destFolder = outputDir.getPath
thriftFiles.asScala.map { _.getPath }
- thriftIncludes.asScala.map { compiler.importPaths += _.getPath }
+ thriftIncludes.asScala.map { compiler.includePaths += _.getPath }
namespaceMappings.asScala.map { e => compiler.namespaceMappings.put(e._1, e._2)}
Main.parseOptions(compiler, flags.asScala.toSeq ++ thriftFiles.asScala.map { _.getPath })
compiler.run()

0 comments on commit 1617518

Please sign in to comment.