WIP: getting a workflow together to allow code generation

This commit is contained in:
Oliver Kennedy 2023-07-07 18:41:25 -04:00
parent 20688d7cbc
commit 126dbcb4dc
Signed by: okennedy
GPG key ID: 3E5F9B3ABD3FDB60
3 changed files with 63 additions and 1 deletions

View file

@ -0,0 +1,9 @@
package com.astraldb.catalyst
object OptimizerTest
{
def main(args: Array[String]): Unit =
{
println("Hello world")
}
}

View file

@ -0,0 +1,9 @@
package com.astraldb.catalyst
object Generate
{
def main(args: Array[String]): Unit =
{
println("Optimizer.sql")
}
}

View file

@ -53,9 +53,53 @@ object astral extends Module
{
def scalaVersion = astral.scalaVersion
def mainClass = Some("com.astraldb.catalyst.Astral")
def mainClass = Some("com.astraldb.catalyst.Generate")
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",
)
}
}
}