diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-11-06 13:57:07 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-11-06 16:52:23 +0100 |
commit | 3197d840f4793e90fc6fbced3de657556e010144 (patch) | |
tree | 876d852892c5380525ba7233eaf9e96a00c2930f /compiler | |
parent | d3e66db2f27d5907b872832785dc13c6aee01ebc (diff) | |
download | vala-3197d840f4793e90fc6fbced3de657556e010144.tar.gz |
compiler: Add "--list-sources" options to output a list of all sources
Fixes https://gitlab.gnome.org/GNOME/vala/issues/872
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/valacompiler.vala | 14 |
1 files changed, 14 insertions, 0 deletions
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); |