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
29 // sort out import path!!!
34 Pango = imports.gi.Pango;
35 GLib = imports.gi.GLib;
37 GObject = imports.gi.GObject;
38 GtkSource = imports.gi.GtkSource;
39 WebKit = imports.gi.WebKit;
42 GtkClutter = imports.gi.GtkClutter;
44 GtkClutter.init(Seed.argv);
47 File = imports.File.File;
49 XObject = imports.XObject.XObject;
50 //XObject.debug = true;
52 imports.searchPath.push('/'); // allow global paths..
53 // error checking todo..
54 var files = File.list(Seed.argv[2]);
57 var gtkbuilder = false;
58 files.forEach(function(f) {
59 var fp = Seed.argv[2] + '/' + f;
60 if (!fp.match(/\.bjs$/)) {
63 var js = fp.replace(/\.bjs$/, '.js');
64 if (File.isFile(js)) {
65 // check file time.. = bjs is less than compiled file..
66 if (File.mtime(fp) < File.mtime(js)) {
67 print ("LOADING" + js);
68 olist.push(imports[js]);
74 var gtkbuilder = new imports.Builder.Provider.File.Gtk.Gtk({ path : fp });
75 gtkbuilder.loadItems(function() { });
76 print ("COMPILING" + js);
77 var fn = gtkbuilder.saveJS();
78 if (fn === false) { // skip files that do not contain anythng!
81 olist.push(imports[fn]);