4 -- in theory this code can be used as a library... but this is the standard command line version...
7 valac --vapidir=/usr/share/vala/vapi
8 --vapidir=/usr/share/vala/vapi
9 --vapidir=/usr/share/vala-0.30/vapi
11 JSDOC/Lang.vala JSDOC/TextStream.vala JSDOC/TokenReader.vala JSDOC/Token.vala JSDOC/TokenStream.vala JSDOC/Packer.vala
12 JSDOC/Collapse.vala JSDOC/ScopeParser.vala JSDOC/Scope.vala JSDOC/Identifier.vala JSDOC/CompressWhite.vala
13 JSDOC/PackerRun.vala --pkg glib-2.0 --pkg gee-1.0 --pkg gio-2.0 --pkg posix -o /tmp/jspack --target-glib=2.32 -X -lm
20 // --------------- <<<<<<< <MAIN HERE....
23 class PackerRun : Application
25 public static string opt_target = "";
26 public static string opt_debug_target = "";
27 public static string opt_tmpdir = "";
29 [CCode (array_length = false, array_null_terminated = true)]
30 private static string[]? opt_files = null;
31 [CCode (array_length = false, array_null_terminated = true)]
32 private static string[]? opt_files_from = null;
33 public static bool opt_debug = false;
34 public static bool opt_keep_whitespace = false;
37 const OptionEntry[] options = {
39 { "jsfile", 'f', 0, OptionArg.FILENAME_ARRAY, ref opt_files ,"add a file to compile", null },
40 { "target", 't', 0, OptionArg.STRING, ref opt_target, "Target File to write (eg. roojs.js)", null },
41 { "debug-target", 'T', 0, OptionArg.STRING, ref opt_debug_target, "Target File to write debug code (eg. roojs-debug.js)", null },
42 { "tmpdir", 'm', 0, OptionArg.STRING, ref opt_tmpdir, "Temporary Directory to use", null },
44 { "index-files", 'i', 0, OptionArg.FILENAME_ARRAY, ref opt_files_from ,"files that contain listing of files to compile", null },
45 { "keep-whitespace", 'w', 0, OptionArg.NONE, ref opt_keep_whitespace, "Keep whitespace", null },
46 { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages", null },
47 // fixme -- keepwhite.. cleanup
51 public static int main(string[] args)
53 foreach(var a in args) {
54 print("ARG: %s\n", a);
57 var opt_context = new OptionContext ("JSDOC Packer");
60 opt_context.set_help_enabled (true);
61 opt_context.add_main_entries (options, null);
62 if (!opt_context.parse ( ref args)) {
63 print("options parse error");
64 GLib.Process.exit(Posix.EXIT_FAILURE);
70 } catch (OptionError e) {
71 stdout.printf ("error: %s\n", e.message);
72 stdout.printf ("Run '%s --help' to see a full list of available command line options.\n %s",
73 args[0], opt_context.get_help(true,null));
74 GLib.Process.exit(Posix.EXIT_FAILURE);
84 public PackerRun (string[] args)
88 application_id: "org.roojs.jsdoc.packerrun",
89 flags: ApplicationFlags.HANDLES_COMMAND_LINE
96 GLib.Log.set_handler(null,
97 GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING,
99 print("%s: %s\n", dom, msg);
103 // now run the Packer...
104 var p = new Packer(opt_target, opt_debug_target);
105 p.keepWhite = opt_keep_whitespace;
108 if (opt_files != null) {
110 foreach (string f in opt_files) {
111 GLib.debug("Adding File %s", f);
115 GLib.debug("No files added");