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');
33 print(JSON.stringify(GIRepository.IRepository.get_search_path()));
37 Pango = imports.gi.Pango;
38 GLib = imports.gi.GLib;
40 GObject = imports.gi.GObject;
41 GtkSource = imports.gi.GtkSource;
42 WebKit = imports.gi.WebKit;
45 GtkClutter = imports.gi.GtkClutter;
48 GtkClutter.init(Seed.argv);
51 File = imports.File.File;
53 XObject = imports.XObject.XObject;
54 //XObject.debug = true;
58 imports.searchPath.push('/'); // allow global paths..
59 // error checking todo..
60 var files = File.list(Seed.argv[2]);
63 var gtkbuilder = false;
64 files.forEach(function(f) {
65 var fp = Seed.argv[2] + '/' + f;
66 if (!fp.match(/\.bjs$/)) {
69 var js = fp.replace(/\.bjs$/, '.js');
70 if (File.isFile(js)) {
71 // check file time.. = bjs is less than compiled file..
72 if (File.mtime(fp) < File.mtime(js)) {
73 XObject.log("LOADING" + js);
74 olist.push(imports[js]);
80 var gtkbuilder = new imports.Builder.Provider.File.Gtk.Gtk({ path : fp });
81 gtkbuilder.loadItems(function() { });
82 XObject.log("COMPILING" + js);
83 var fn = gtkbuilder.saveJS();
84 if (fn === false) { // skip files that do not contain anythng!
87 olist.push(imports[fn]);