From 7ffd5e46c87972040d31a00115fa457067336e24 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sun, 25 Jul 2021 22:19:33 -0600 Subject: [PATCH] notes on compileToScript() implementation --- src/kiss/CompilerTools.hx | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/kiss/CompilerTools.hx b/src/kiss/CompilerTools.hx index 7920af9..b6dae5c 100644 --- a/src/kiss/CompilerTools.hx +++ b/src/kiss/CompilerTools.hx @@ -10,16 +10,18 @@ enum CompileLang { typedef CompilationArgs = { lang:CompileLang, - outputFolder:String, // path to a folder where the script will be compiled - ?importHxFile:String, + outputFolder:String, // path to a file with haxe import statements in it - ?hxmlFile:String, + ?importHxFile:String, // path to a file with hxml args in it (SHOULD NOT specify target or main class) - ?langProjectFile:String, + ?hxmlFile:String, // path to a package.json or requirements.txt file - ?mainHxFile:String, + ?langProjectFile:String, // path to a haxe file defining the Main class + ?mainHxFile:String, + // paths to extra files to copy + ?extraFiles:Array } /** @@ -41,6 +43,25 @@ class CompilerTools { * @return A function that, when called, executes the script and returns the script output as a string. */ public static function compileToScript(exps:Array, args:CompilationArgs):() -> String { + // TODO if folder exists, delete it + // TODO create it again + // TODO copy all files in + // import.hx if given + // hxml file if given + // language-specific project file if given + // main .hx file if given, or default + // make sure it calls build() on the right file, and imports kiss.Prelude + // all extra files + // make the main.kiss file just a begin of array(exps) + + // TODO generate build.hxml + // -lib kiss + // target compiler arguments and -cmd argument according to lang + // run haxelib install all in folder + // install language-specific dependencies + // call haxe args.hxml build.hxml + // return lambda that calls new Process() that runs the target-specific file + return () -> ""; } }