]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
compiler: Add "--list-sources" options to output a list of all sources
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 6 Nov 2019 12:57:07 +0000 (13:57 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 6 Nov 2019 15:52:23 +0000 (16:52 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/872

compiler/valacompiler.vala
doc/valac.1

index c5105804acedb8b757cb90dd7e92eb25232749d5..54c3535a5bd707107a2ebcde1c660fb305694fa4 100644 (file)
@@ -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);
 
index f395517d942403f02db78de654153a3fdcdc95a9..ac26f4c06c376072f4bef529d1fa45b7765bee99 100644 (file)
@@ -90,6 +90,9 @@ Include comments in generated vapi
 \fB\-\-deps\fR
 Write make\-style dependency information to this file
 .TP
+\fB\-\-list\-sources\fR
+Output a list of all source and binding files which are used
+.TP
 \fB\-\-symbols\fR=\fI\,FILE\/\fR
 Output symbols file
 .TP