notes on compileToScript() implementation

This commit is contained in:
2021-07-25 22:19:33 -06:00
parent dea92a13b4
commit dcaf0a1a7f

View File

@@ -10,16 +10,18 @@ enum CompileLang {
typedef CompilationArgs = { typedef CompilationArgs = {
lang:CompileLang, lang:CompileLang,
outputFolder:String,
// path to a folder where the script will be compiled // path to a folder where the script will be compiled
?importHxFile:String, outputFolder:String,
// path to a file with haxe import statements in it // 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) // 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 // path to a package.json or requirements.txt file
?mainHxFile:String, ?langProjectFile:String,
// path to a haxe file defining the Main class // path to a haxe file defining the Main class
?mainHxFile:String,
// paths to extra files to copy
?extraFiles:Array<String>
} }
/** /**
@@ -41,6 +43,25 @@ class CompilerTools {
* @return A function that, when called, executes the script and returns the script output as a string. * @return A function that, when called, executes the script and returns the script output as a string.
*/ */
public static function compileToScript(exps:Array<ReaderExp>, args:CompilationArgs):() -> String { public static function compileToScript(exps:Array<ReaderExp>, 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 () -> ""; return () -> "";
} }
} }