[vala/0.40] vapigen: Warn if the library argument doesn't match any package attribute
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] vapigen: Warn if the library argument doesn't match any package attribute
- Date: Sun, 28 Oct 2018 09:31:40 +0000 (UTC)
commit 4f6887a08972285f6a0743dfbbfc90acbd3dd1c0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Sep 9 18:12:03 2018 +0200
vapigen: Warn if the library argument doesn't match any package attribute
GIR files can contain a package key referring to the pkg-config name which
is the recommended and even required naming of a vapi.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/669
vapigen/valavapigen.vala | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index 616efdf29..a26ae41b5 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -170,6 +170,9 @@ class Vala.VAPIGen {
return quit ();
}
+ // candidates to match library against
+ string[] package_names = {};
+
// interface writer ignores external packages
foreach (SourceFile file in context.get_source_files ()) {
if (file.filename.has_suffix (".vapi")) {
@@ -187,10 +190,18 @@ class Vala.VAPIGen {
}
}
}
+ if (file.explicit && file.package_name != null) {
+ package_names += file.package_name;
+ }
}
}
}
+ var library_name = Path.get_basename (library);
+ if (package_names.length > 0 && !(library_name in package_names)) {
+ Report.warning (null, "Given library name `%s' does not match pkg-config name
`%s'".printf (library_name, string.join ("', `", package_names)));
+ }
+
var interface_writer = new CodeWriter (CodeWriterType.VAPIGEN);
var vapi_filename = "%s.vapi".printf (library);
if (directory != null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]