diff --git a/hail/build.mill b/hail/build.mill index a56dddbf5296..c65a1efd3d69 100644 --- a/hail/build.mill +++ b/hail/build.mill @@ -72,7 +72,7 @@ object Deps { } } -trait HailScalaModule extends SbtModule with ScalafmtModule with ScalafixModule { outer => +trait HailScalaModule extends ScalafmtModule with ScalafixModule { outer => override def scalaVersion: T[String] = build.env.scalaVersion() override def javacOptions: T[Seq[String]] = Seq( @@ -105,7 +105,7 @@ trait HailScalaModule extends SbtModule with ScalafmtModule with ScalafixModule override def bspCompileClasspath: T[Agg[UnresolvedPath]] = super.bspCompileClasspath() ++ resources().map(p => UnresolvedPath.ResolvedPath(p.path)) - trait HailTests extends SbtTests with TestNg with ScalafmtModule with ScalafixModule { + trait HailTests extends ScalaTests with TestNg with ScalafmtModule with ScalafixModule { override def forkArgs: T[Seq[String]] = Seq("-Xss4m", "-Xmx4096M") override def ivyDeps: T[Agg[Dep]] = @@ -123,7 +123,7 @@ trait HailScalaModule extends SbtModule with ScalafmtModule with ScalafixModule } } -object `package` extends RootModule with HailScalaModule { outer => +object `package` extends RootModule with HailScalaModule with SbtModule { outer => object env extends Module { def scalaVersion: T[String] = Task.Input { @@ -175,6 +175,10 @@ object `package` extends RootModule with HailScalaModule { outer => buildInfo(), ) + override def generatedSources: T[Seq[PathRef]] = Task { + Seq(`ir-gen`.generate()) + } + override def unmanagedClasspath: T[Agg[PathRef]] = Agg(shadedazure.assembly()) @@ -246,6 +250,18 @@ object `package` extends RootModule with HailScalaModule { outer => PathRef(T.dest) } + object `ir-gen` extends HailScalaModule { + def ivyDeps = Agg( + ivy"com.lihaoyi::mainargs:0.6.2", + ivy"com.lihaoyi::os-lib:0.10.7", + ) + + def generate: T[PathRef] = Task { + runForkedTask(finalMainClass, Task.Anon { Args("--path", T.dest) })() + PathRef(T.dest) + } + } + object memory extends JavaModule { // with CrossValue { override def zincIncrementalCompilation: T[Boolean] = false @@ -263,7 +279,7 @@ object `package` extends RootModule with HailScalaModule { outer => } } - object test extends HailTests { + object test extends HailTests with SbtTests { override def resources: T[Seq[PathRef]] = outer.resources() ++ super.resources() override def assemblyRules: Seq[Rule] = outer.assemblyRules ++ Seq( diff --git a/hail/src/main/scala/is/hail/expr/ir/IR.scala b/hail/ir-gen/resources/IR.scala.template similarity index 100% rename from hail/src/main/scala/is/hail/expr/ir/IR.scala rename to hail/ir-gen/resources/IR.scala.template diff --git a/hail/ir-gen/src/Main.scala b/hail/ir-gen/src/Main.scala new file mode 100644 index 000000000000..8e48037149d9 --- /dev/null +++ b/hail/ir-gen/src/Main.scala @@ -0,0 +1,14 @@ +package ir_gen + +import mainargs.{main, ParserForMethods} +//import os.pwd + +object Main { + @main + def main(path: String) = { + println(s"Writing IR source files to $path, from ${os.resource / "IR.scala.template"}") + println(s"Pwd: ${os.pwd}") + } + + def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args) +}