first commit
This commit is contained in:
5
Tesses.CrossLisp.CompileTool/.gitignore
vendored
Normal file
5
Tesses.CrossLisp.CompileTool/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.DS_Store
|
||||
bin
|
||||
obj
|
||||
publish
|
||||
thumbs.db
|
||||
11
Tesses.CrossLisp.CompileTool/cross.json
Normal file
11
Tesses.CrossLisp.CompileTool/cross.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https:\/\/crosslang.tesseslanguage.com\/\/schema\/cross-json-schema.json",
|
||||
"info": {
|
||||
"type": "compile_tool"
|
||||
},
|
||||
"name": "Tesses.CrossLisp.CompileTool",
|
||||
"project_dependencies": [
|
||||
"..\/Tesses.CrossLisp.Runtime"
|
||||
],
|
||||
"version": "1.0.0.0-prod"
|
||||
}
|
||||
39
Tesses.CrossLisp.CompileTool/src/main.tcross
Normal file
39
Tesses.CrossLisp.CompileTool/src/main.tcross
Normal file
@@ -0,0 +1,39 @@
|
||||
func RunTool(cfg)
|
||||
{
|
||||
//cfg.Project is the project Subdirfilesystem
|
||||
//cfg.ProjectInfo is the info property parsed from the cross.json file in project root
|
||||
const crossConf = "/cross.json";
|
||||
|
||||
if(!cfg.Project.FileExists(crossConf)) return;
|
||||
var srcDir = "src";
|
||||
var configData = Json.Decode(FS.ReadAllText(FS.Local,crossConf));
|
||||
if(TypeOf(configData.source_directory) != "Undefined")
|
||||
srcDir = configData.source_directory;
|
||||
|
||||
|
||||
|
||||
func walk_for_source(sourceDir)
|
||||
{
|
||||
if(cfg.Project.DirectoryExists(sourceDir))
|
||||
each(var file : cfg.Project.EnumeratePaths(sourceDir))
|
||||
{
|
||||
if(cfg.Project.RegularFileExists(file) && file.GetExtension()==".lisp")
|
||||
{
|
||||
var src = {
|
||||
FileName = file.ToString(),
|
||||
Source = CrossLisp.toCrossLangText(CrossLisp.parseLisp(FS.ReadAllText(cfg.Project, file)))
|
||||
};
|
||||
cfg.GeneratedSource.Add(src);
|
||||
}
|
||||
else if(cfg.Project.DirectoryExists(file))
|
||||
{
|
||||
walk_for_source(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
walk_for_source(srcDir);
|
||||
|
||||
|
||||
//this runs with full access to vm so be careful when allowing these
|
||||
}
|
||||
Reference in New Issue
Block a user