blob: ff3d41c8b725b72ed20fb482fc419a2972d6bbf7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/* NEST (New Scala Test)
* Copyright 2007-2012 LAMP/EPFL
* @author Paul Phillips
*/
package scala.tools.cmd
package gen
import scala.language.postfixOps
class Codegen(args: List[String]) extends {
val parsed = CodegenSpec(args: _*)
} with CodegenSpec with Instance { }
object Codegen {
def echo(msg: String) = Console println msg
def main(args0: Array[String]): Unit = {
val runner = new Codegen(args0.toList)
import runner._
if (args0.isEmpty)
return println (CodegenSpec.helpMsg)
val out = outDir getOrElse { return println("--out is required.") }
val all = genall || (!anyvals && !products)
echo("Generating sources into " + out)
if (anyvals || all) {
val av = new AnyVals { }
av.make() foreach { case (name, code ) =>
val file = out / (name + ".scala") toFile;
echo("Writing: " + file)
file writeAll code
}
}
}
}
|