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 * seed 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!!!
30 GIRepository = imports.gi.GIRepository;
31 GIRepository.IRepository.prepend_search_path('/home/alan/.Builder/girepository-1.1');
36 Pango = imports.gi.Pango;
37 GLib = imports.gi.GLib;
39 GObject = imports.gi.GObject;
40 GtkSource = imports.gi.GtkSource;
41 WebKit = imports.gi.WebKit;
44 GtkClutter = imports.gi.GtkClutter;
47 GtkClutter.init(Seed.argv);
50 File = imports.File.File;
52 XObject = imports.XObject.XObject;
53 //XObject.debug = true;
57 imports.searchPath.push('/'); // allow global paths..
58 // error checking todo..
59 var files = File.list(Seed.argv[2]);
62 var gtkbuilder = false;
63 files.forEach(function(f) {
64 var fp = Seed.argv[2] + '/' + f;
65 if (!fp.match(/\.bjs$/)) {
68 var js = fp.replace(/\.bjs$/, '.js');
69 if (File.isFile(js)) {
70 // check file time.. = bjs is less than compiled file..
71 if (File.mtime(fp) < File.mtime(js)) {
72 XObject.log("LOADING" + js);
73 olist.push(imports[js]);
79 var gtkbuilder = new imports.Builder.Provider.File.Gtk.Gtk({ path : fp });
80 gtkbuilder.loadItems(function() { });
81 XObject.log("COMPILING" + js);
82 var fn = gtkbuilder.saveJS();
83 if (fn === false) { // skip files that do not contain anythng!
86 olist.push(imports[fn]);