[vala/wip/issue/872] compiler: Add "--list-sources" options to output a list of all sources



commit e6d82b7f03539b2c6c969a793ba67f68ad2aad8c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Nov 6 13:57:07 2019 +0100

    compiler: Add "--list-sources" options to output a list of all sources
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/872

 compiler/valacompiler.vala | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index c5105804a..54c3535a5 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -76,6 +76,7 @@ class Vala.Compiler {
        static bool disable_since_check;
        static bool disable_warnings;
        static bool keep_going;
+       static bool list_sources;
        static string cc_command;
        [CCode (array_length = false, array_null_terminated = true)]
        static string[] cc_options;
@@ -125,6 +126,7 @@ class Vala.Compiler {
                { "use-fast-vapi", 0, 0, OptionArg.STRING_ARRAY, ref fast_vapis, "Use --fast-vapi output 
during this compile", null },
                { "vapi-comments", 0, 0, OptionArg.NONE, ref vapi_comments, "Include comments in generated 
vapi", null },
                { "deps", 0, 0, OptionArg.STRING, ref dependencies, "Write make-style dependency information 
to this file", null },
+               { "list-sources", 0, 0, OptionArg.NONE, ref list_sources, "Output a list of all source and 
binding files which are used", null },
                { "symbols", 0, 0, OptionArg.FILENAME, ref symbols_filename, "Output symbols file", "FILE" },
                { "compile", 'c', 0, OptionArg.NONE, ref compile_only, "Compile but do not link", null },
                { "output", 'o', 0, OptionArg.FILENAME, ref output, "Place output in file FILE", "FILE" },
@@ -374,6 +376,18 @@ class Vala.Compiler {
                        return quit ();
                }
 
+               if (list_sources) {
+                       foreach (SourceFile file in context.get_source_files ()) {
+                               print ("%s\n", file.filename);
+                       }
+                       if (!ccode_only) {
+                               foreach (string filename in context.get_c_source_files ()) {
+                                       print ("%s\n", filename);
+                               }
+                       }
+                       return 0;
+               }
+
                var parser = new Parser ();
                parser.parse (context);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]