2 //<Script type="text/javascript">
5 * takes a gtk project directory, and turns it into an application!
6 * by compling the files into JS files..
8 * Initially developed for runtime testing. (the vte runner)
10 * Might be the way to go for full runtime
14 * gtkrun.js /path/to/myproject
17 * a) load dependancies.. (eg. gi's..) - derived later?
20 * loop the files (find .bjs)
21 * - comple to js (if not exist // or force enabled..)
22 * b) load all the files
31 Pango = imports.gi.Pango;
32 GLib = imports.gi.GLib;
34 GObject = imports.gi.GObject;
35 GtkSource = imports.gi.GtkSource;
36 WebKit = imports.gi.WebKit;
39 File = imports.File.File;
41 XObject = imports.XObject.XObject;
42 //XObject.debug = true;
44 imports.searchPath.push('/'); // allow global paths..
45 // error checking todo..
46 var files = File.list(Seed.argv[2]);
49 var gtkbuilder = false;
50 files.forEach(function(f) {
51 var fp = Seed.argv[2] + '/' + f;
52 if (!fp.match(/\.bjs$/)) {
55 var js = fp.replace(/\.bjs$/, '.js');
56 if (File.isFile(js)) {
57 // check file time.. = bjs is less than compiled file..
58 if (File.mtime(fp) < File.mtime(js)) {
59 print ("LOADING" + js);
60 olist.push(imports[js]);
66 var gtkbuilder = new imports.Builder.Provider.File.Gtk.Gtk({ path : fp });
67 gtkbuilder.loadItems(function() { });
68 print ("COMPILING" + js);
69 var fn = gtkbuilder.saveJS();
70 if (fn === false) { // skip files that do not contain anythng!
73 olist.push(imports[fn]);