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
13 * Usage: (call with wrapper to set up directories..)
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 - this is a bit of a mess..
30 GIRepository = imports.gi.GIRepository;
31 GLib = imports.gi.GLib;
33 // we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh
34 GIRepository.Repository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.2');
35 //print(JSON.stringify(GIRepository.IRepository.get_search_path()));
39 Pango = imports.gi.Pango;
42 GObject = imports.gi.GObject;
43 GtkSource = imports.gi.GtkSource;
44 WebKit = imports.gi.WebKit;
47 //Gdl = imports.gi.Gdl;
49 //GtkClutter = imports.gi.GtkClutter;
53 // GtkClutter.init(Seed.argv);
56 if (typeof(GtkClutter) != 'undefined') {
57 GtkClutter.init(Seed.argv);
59 >>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
61 File = imports.File.File;
63 XObject = imports.XObject.XObject;
64 //XObject.debug = true;
68 imports.searchPath.push('/'); // allow global paths..
69 // error checking todo..
70 var files = File.list(Seed.argv[2]);
73 var gtkbuilder = false;
74 files.forEach(function(f) {
75 var fp = Seed.argv[2] + '/' + f;
76 if (!fp.match(/\.bjs$/)) {
79 var js = fp.replace(/\.bjs$/, '.js');
80 if (File.isFile(js)) {
81 // check file time.. = bjs is less than compiled file..
82 if (File.mtime(fp) < File.mtime(js)) {
83 XObject.log("LOADING" + js);
84 olist.push(imports[js]);
90 var gtkbuilder = new imports.Builder.Provider.File.Gtk.Gtk({ path : fp });
91 gtkbuilder.loadItems(function() { });
92 XObject.log("COMPILING" + js);
93 var fn = gtkbuilder.saveJS();
94 if (fn === false) { // skip files that do not contain anythng!
97 olist.push(imports[fn]);