[vala/staging] Perform runtime version check of libvala
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] Perform runtime version check of libvala
- Date: Fri, 6 Nov 2020 19:21:30 +0000 (UTC)
commit dbe3e730690176d96078abf0ca1e9756c8d903b2
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Jul 8 11:42:02 2020 +0200
Perform runtime version check of libvala
Fixes https://gitlab.gnome.org/GNOME/vala/issues/88
codegen/valaccodebasemodule.vala | 4 ++++
compiler/valacompiler.vala | 5 +++++
valadoc/valadoc.vala | 5 +++++
vapigen/valavapigen.vala | 6 ++++++
4 files changed, 20 insertions(+)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ad292a777..9a801e369 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -373,6 +373,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public static int ccode_attribute_cache_index = CodeNode.get_attribute_cache_index ();
protected CCodeBaseModule () {
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ Report.error (null, "Integrity check failed (libvala %s doesn't match ccodegen
%s)".printf (Vala.get_build_version (), Vala.BUILD_VERSION));
+ }
+
predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
predefined_marshal_set.add ("VOID:VOID");
predefined_marshal_set.add ("VOID:BOOLEAN");
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index e5a6a21d1..4cc7b2967 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -622,6 +622,11 @@ class Vala.Compiler {
// initialize locale
Intl.setlocale (LocaleCategory.ALL, "");
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ stderr.printf ("Integrity check failed (libvala %s doesn't match valac %s)\n",
Vala.get_build_version (), Vala.BUILD_VERSION);
+ return 1;
+ }
+
if (Path.get_basename (args[0]) == "vala" || Path.get_basename (args[0]) == "vala" +
Config.PACKAGE_SUFFIX) {
return run_source (args);
}
diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala
index 175bbdd9d..68d8b8fa4 100644
--- a/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala
@@ -398,6 +398,11 @@ public class ValaDoc : Object {
static int main (string[] args) {
Intl.setlocale (LocaleCategory.ALL, "");
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ stderr.printf ("Integrity check failed (libvala %s doesn't match valadoc %s)\n",
Vala.get_build_version (), Vala.BUILD_VERSION);
+ return 1;
+ }
+
try {
var opt_context = new OptionContext ("- Vala Documentation Tool");
opt_context.set_help_enabled (true);
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index 7eb4fc044..7bd37be85 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -211,6 +211,12 @@ class Vala.VAPIGen {
static int main (string[] args) {
Intl.setlocale (LocaleCategory.ALL, "");
+
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ stderr.printf ("Integrity check failed (libvala %s doesn't match vapigen %s)\n",
Vala.get_build_version (), Vala.BUILD_VERSION);
+ return 1;
+ }
+
try {
var opt_context = new OptionContext ("- Vala API Generator");
opt_context.set_help_enabled (true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]