X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=src%2FMain.vala;h=df5d6f47bec49067dc0716459cf0485fdf26586a;hb=700f970c58ea880664ac6d459472b93dab1c41f4;hp=483d54d607a532cb3da7154958cc8dae693774fa;hpb=4e7f42a9d92695a4ef60aefc396593c57e7e6eea;p=app.Builder.js diff --git a/src/Main.vala b/src/Main.vala index 483d54d60..df5d6f47b 100644 --- a/src/Main.vala +++ b/src/Main.vala @@ -9,29 +9,115 @@ int main (string[] args) { - + new JsRender.Lang_Class(); var app = BuilderApplication.singleton( args); - if (BuilderApplication.opt_compile_project != null) { + + if (BuilderApplication.opt_debug || BuilderApplication.opt_compile_project == null) { + GLib.Log.set_handler(null, + GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING, + (dom, lvl, msg) => { + print("%s: %s\n", dom, msg); + }); + } + + + if (BuilderApplication.opt_list_projects) { + + //BuilderApplication.compileBjs(); + Project.Project.loadAll(); + print("Projects\n %s\n", Project.Project.listAllToString()); + GLib.Process.exit(Posix.EXIT_SUCCESS); + } + Project.Project.loadAll(); + + if (BuilderApplication.opt_list_projects) { + + //BuilderApplication.compileBjs(); + + print("Projects\n %s\n", Project.Project.listAllToString()); + GLib.Process.exit(Posix.EXIT_SUCCESS); + } + Project.Project cur_project = null; + if (BuilderApplication.opt_compile_project != null) { + + + cur_project = Project.Project.getProjectByHash( BuilderApplication.opt_compile_project); + + if (cur_project == null) { + GLib.error("invalid project %s, use --list-projects to show project ids",BuilderApplication.opt_compile_project); + } + cur_project.scanDirs(); + + + } + + if (BuilderApplication.opt_list_files) { + if (cur_project == null) { + GLib.error("missing project, use --project to select which project"); + } + print("Files for %s\n %s\n", cur_project.name, cur_project.listAllFilesToString()); + GLib.Process.exit(Posix.EXIT_SUCCESS); + } + + if (BuilderApplication.opt_bjs_compile != null) { + if (cur_project == null) { + GLib.error("missing project, use --project to select which project"); + } + var file = cur_project.getByName(BuilderApplication.opt_bjs_compile); + if (file == null) { + GLib.error("missing file %s in project %s", BuilderApplication.opt_bjs_compile, cur_project.name); + } + //BuilderApplication.compileBjs(); + file.loadItems(); + var str = file.toSourceCode(); + + + if (!BuilderApplication.opt_debug) { + print("%s", str); + GLib.Process.exit(Posix.EXIT_SUCCESS); + } + + // dump the node tree + file.tree.dumpProps(); + + + var str_ar = str.split("\n"); + for(var i =0;i { - print("%s: %s\n", dom.msg); - }); + GLib.debug("project = %s\n", BuilderApplication.opt_compile_project); Gtk.init (ref args); - - + GtkClutter.init (ref args); - new JsRender.Lang_Class(); + GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); - Project.Project.loadAll(); + + + + // respond to other arguments + /*var proj = Project.Project.getProject("Pman.Core"); if (proj == null) { print("could not load test project Pman.Core"); @@ -50,7 +136,7 @@ int main (string[] args) { w.windowstate.switchState(WindowState.State.FILES); Gtk.main(); - + app = null; return 0; }