[vala/staging] compiler: Add "--list-sources" options to output a list of all sources
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] compiler: Add "--list-sources" options to output a list of all sources
- Date: Wed, 6 Nov 2019 15:54:22 +0000 (UTC)
commit 3197d840f4793e90fc6fbced3de657556e010144
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 ++++++++++++++
doc/valac.1 | 3 +++
2 files changed, 17 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);
diff --git a/doc/valac.1 b/doc/valac.1
index f395517d9..ac26f4c06 100644
--- a/doc/valac.1
+++ b/doc/valac.1
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]