From 7b207a0b5e88805299e8bade337492975758baef Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Wed, 8 Aug 2007 20:31:37 +0000 Subject: [PATCH] provide --save-temps option keep generated C source and header files when 2007-08-08 Mathias Hasselmann * compiler/valacompiler.vala: provide --save-temps option * gobject/valaccodecompiler.vala: keep generated C source and header files when --save-temps, respectively --library options are used * vala/valacodecontext.vala: add save_temps, save_csources and save_cheaders property svn path=/trunk/; revision=452 --- ChangeLog | 8 ++++++++ compiler/valacompiler.vala | 3 +++ gobject/valaccodecompiler.vala | 6 ++++-- vala/valacodecontext.vala | 13 +++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d1cd4f..728dda2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,14 @@ 2007-08-08 Mathias Hasselmann + * compiler/valacompiler.vala: provide --save-temps option + * gobject/valaccodecompiler.vala: keep generated C source and header + files when --save-temps, respectively --library options are used + * vala/valacodecontext.vala: add save_temps, save_csources + and save_cheaders property + +2007-08-08 Mathias Hasselmann + * vapi/glib-2.0.vala: fix spelling of OptionFlags.FILENAME 2007-08-08 Jürg Billeter diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index b0e8ebc..44faa94 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -45,6 +45,7 @@ class Vala.Compiler { static string cc_command; [NoArrayLength] static string[] cc_options; + static bool save_temps; private CodeContext context; @@ -65,6 +66,7 @@ class Vala.Compiler { { "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable run-time checks", null }, { "cc", 0, 0, OptionArg.STRING, out cc_command, "Use COMMAND as C compiler command", "COMMAND" }, { "Xcc", 'X', 0, OptionArg.STRING_ARRAY, out cc_options, "Pass OPTION to the C compiler", "OPTION..." }, + { "save-temps", 0, 0, OptionArg.NONE, out save_temps, "Keep temporary files", null }, { "", 0, 0, OptionArg.FILENAME_ARRAY, out sources, null, "FILE..." }, { null } }; @@ -165,6 +167,7 @@ class Vala.Compiler { context.debug = debug; context.thread = thread; context.optlevel = optlevel; + context.save_temps = save_temps; /* default package */ if (!add_package (context, "glib-2.0")) { diff --git a/gobject/valaccodecompiler.vala b/gobject/valaccodecompiler.vala index e358427..f9ba505 100644 --- a/gobject/valaccodecompiler.vala +++ b/gobject/valaccodecompiler.vala @@ -107,8 +107,10 @@ public class Vala.CCodeCompiler { /* remove generated C source and header files */ foreach (SourceFile file in source_files) { if (!file.pkg) { - FileUtils.unlink (file.get_csource_filename ()); - FileUtils.unlink (file.get_cheader_filename ()); + if (!context.save_csources) + FileUtils.unlink (file.get_csource_filename ()); + if (!context.save_cheaders) + FileUtils.unlink (file.get_cheader_filename ()); } } } diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala index 453ad66..548b0e2 100644 --- a/vala/valacodecontext.vala +++ b/vala/valacodecontext.vala @@ -85,6 +85,19 @@ public class Vala.CodeContext { */ public Method module_init_method { get; set; } + /** + * Keep temporary files produced by the compiler. + */ + public bool save_temps { get; set; } + + public bool save_csources { + get { return save_temps; } + } + + public bool save_cheaders { + get { return save_csources || null != library; } + } + private Gee.List source_files = new ArrayList (); private Gee.List c_source_files = new ArrayList (); private Namespace! _root = new Namespace (null); -- 2.7.4