WIP: getting a workflow together to allow code generation
This commit is contained in:
parent
20688d7cbc
commit
126dbcb4dc
|
@ -0,0 +1,9 @@
|
||||||
|
package com.astraldb.catalyst
|
||||||
|
|
||||||
|
object OptimizerTest
|
||||||
|
{
|
||||||
|
def main(args: Array[String]): Unit =
|
||||||
|
{
|
||||||
|
println("Hello world")
|
||||||
|
}
|
||||||
|
}
|
9
astral/catalyst/src/com/astraldb/catalyst/Generate.scala
Normal file
9
astral/catalyst/src/com/astraldb/catalyst/Generate.scala
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
package com.astraldb.catalyst
|
||||||
|
|
||||||
|
object Generate
|
||||||
|
{
|
||||||
|
def main(args: Array[String]): Unit =
|
||||||
|
{
|
||||||
|
println("Optimizer.sql")
|
||||||
|
}
|
||||||
|
}
|
46
build.sc
46
build.sc
|
@ -53,9 +53,53 @@ object astral extends Module
|
||||||
{
|
{
|
||||||
def scalaVersion = astral.scalaVersion
|
def scalaVersion = astral.scalaVersion
|
||||||
|
|
||||||
def mainClass = Some("com.astraldb.catalyst.Astral")
|
def mainClass = Some("com.astraldb.catalyst.Generate")
|
||||||
|
|
||||||
def moduleDeps = Seq(astral.compiler)
|
def moduleDeps = Seq(astral.compiler)
|
||||||
|
|
||||||
|
def classPath = T{ Seq[PathRef](compile().classes) ++ resources() }
|
||||||
|
|
||||||
|
def rendered = T {
|
||||||
|
val target = T.dest
|
||||||
|
val files = scala.collection.mutable.Buffer[String]()
|
||||||
|
os.proc(
|
||||||
|
"scala",
|
||||||
|
"-cp",
|
||||||
|
classPath().mkString(":"),
|
||||||
|
mainClass().get,
|
||||||
|
target
|
||||||
|
).call(
|
||||||
|
cwd = target,
|
||||||
|
stdout = os.ProcessOutput.Readlines(
|
||||||
|
line => files += line
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for(f <- files)
|
||||||
|
{
|
||||||
|
println(s"GOT : $f")
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return */
|
||||||
|
files.map {
|
||||||
|
file => PathRef(target / file)
|
||||||
|
}.toSeq
|
||||||
|
}
|
||||||
|
|
||||||
|
def render(args: String*) = T.command {
|
||||||
|
println(rendered())
|
||||||
|
}
|
||||||
|
|
||||||
|
object impl extends ScalaModule
|
||||||
|
{
|
||||||
|
def scalaVersion = "2.13.8"
|
||||||
|
|
||||||
|
def generatedSources = T{ astral.catalyst.rendered() }
|
||||||
|
|
||||||
|
def ivyDeps = Agg(
|
||||||
|
ivy"org.apache.spark::spark-sql::3.4.1",
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue