From: Jürg Billeter Date: Tue, 14 Apr 2009 17:39:55 +0000 (+0200) Subject: Add --verbose command-line option X-Git-Tag: 0.7.1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbe3624431a5e086668c26e763c569883f83ba08;p=thirdparty%2Fvala.git Add --verbose command-line option Currently just prints C compiler command-line before execution. Fixes bug 559890. --- diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index f1e1cb080..1e4ac9b60 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -63,6 +63,7 @@ class Vala.Compiler { [NoArrayLength] static string[] defines; static bool quiet_mode; + static bool verbose_mode; private CodeContext context; @@ -93,6 +94,7 @@ class Vala.Compiler { { "dump-tree", 0, 0, OptionArg.FILENAME, ref dump_tree, "Write code tree to FILE", "FILE" }, { "save-temps", 0, 0, OptionArg.NONE, ref save_temps, "Keep temporary files", null }, { "quiet", 'q', 0, OptionArg.NONE, ref quiet_mode, "Do not print messages to the console", null }, + { "verbose", 'v', 0, OptionArg.NONE, ref verbose_mode, "Print additional messages to the console", null }, { "target-glib", 0, 0, OptionArg.STRING, ref target_glib, "Target version of glib for code generation", "MAJOR.MINOR" }, { "", 0, 0, OptionArg.FILENAME_ARRAY, ref sources, null, "FILE..." }, { null } @@ -174,6 +176,7 @@ class Vala.Compiler { context.non_null_experimental = non_null_experimental; context.dbus_transformation = !disable_dbus_transformation; context.report.set_verbose_errors (!quiet_mode); + context.verbose_mode = verbose_mode; context.ccode_only = ccode_only; context.compile_only = compile_only; diff --git a/gobject/valaccodecompiler.vala b/gobject/valaccodecompiler.vala index c5696e67d..31e395a7a 100644 --- a/gobject/valaccodecompiler.vala +++ b/gobject/valaccodecompiler.vala @@ -113,6 +113,10 @@ public class Vala.CCodeCompiler { cmdline += " " + Shell.quote (cc_option); } + if (context.verbose_mode) { + stdout.printf ("%s\n", cmdline); + } + try { Process.spawn_command_line_sync (cmdline, null, null, out exit_status); if (exit_status != 0) { diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala index ef66dd283..460874f61 100644 --- a/vala/valacodecontext.vala +++ b/vala/valacodecontext.vala @@ -140,6 +140,8 @@ public class Vala.CodeContext { */ public int target_glib_minor { get; set; } + public bool verbose_mode { get; set; } + /** * Returns true if the target version of glib is greater than or * equal to the specified version.