Sfoglia il codice sorgente

Ship invercargill-json.deps, register the test suite, stop installing it

The vapi shipped without a .deps file, which propagated to every
consumer: anything depending on invercargill-json hit 'The symbol Json
could not be found' inside invercargill-json's own vapi unless it also
listed json-glib-1.0 itself. The .deps (glib-2.0, gobject-2.0,
invercargill-1, json-glib-1.0) is now shipped and installed to
share/vala/vapi; a consumer compiling against a scratch prefix with
only the .deps chain was verified to build and run.

The test suite was installed as a binary (declared in provides) but
never registered with meson test(), so nothing ran it: it is now
registered, built only (install: false), and the manifest's
bin:invercargill-json-test-suite provides entry is removed to match
what the build actually installs. usm-scripts/test.sh plus the manifest
test exec run it via ninja; test.sh scrubs LD_LIBRARY_PATH because a
system-wide value (this saddle exports /opt/usm/lib) overrides the
build tree's RUNPATH and links tests against a stale installed copy.
goal-38 task agent 2 settimane fa
parent
commit
d7b34ecf56
5 ha cambiato i file con 45 aggiunte e 6 eliminazioni
  1. 13 4
      MANIFEST.usm
  2. 13 1
      src/meson.build
  3. 3 1
      src/tests/meson.build
  4. 12 0
      usm-scripts/test.sh
  5. 4 0
      vapi/invercargill-json.deps

+ 13 - 4
MANIFEST.usm

@@ -2,13 +2,21 @@
   "name": "invercargill-json",
   "version": "0.1",
   "summary": "Json support for Invercargill",
-  "licences": [ {"name": "LGPLv3", "category": "libre", "text": "LICENSE"} ],
-  "flags": ["ninjaStyleProgress"],
+  "licences": [
+    {
+      "name": "LGPLv3",
+      "category": "libre",
+      "text": "LICENSE"
+    }
+  ],
+  "flags": [
+    "ninjaStyleProgress"
+  ],
   "provides": {
     "lib:libinvercargill-json.so": "as-expected",
-    "bin:invercargill-json-test-suite": "as-expected",
     "inc:invercargill-json.h": "as-expected",
     "vapi:invercargill-json.vapi": "as-expected",
+    "vapi:invercargill-json.deps": "as-expected",
     "gir:invercargill_json-1.0.gir": "as-expected",
     "typelib:invercargill_json-1.0.typelib": "as-expected",
     "pc:invercargill-json.pc": "as-expected"
@@ -40,6 +48,7 @@
   "execs": {
     "build": "usm-scripts/build.sh",
     "install": "usm-scripts/install.sh",
-    "postInstall": "usm-scripts/post-install.sh"
+    "postInstall": "usm-scripts/post-install.sh",
+    "test": "usm-scripts/test.sh"
   }
 }

+ 13 - 1
src/meson.build

@@ -1,4 +1,16 @@
 project('invercargill-json', 'vala', 'c')
 subdir('lib')
 dependencies += invercargill_json_dep
-subdir('tests')
+subdir('tests')
+
+# --- Install surface for consumers -------------------------------------
+# A consumer compiles with `valac --pkg invercargill-json`; valac reads
+# invercargill-json.deps from share/vala/vapi and resolves every entry
+# there. The public vapi references GLib and Json types and builds on
+# invercargill-1, so that is the complete closure (invercargill-1.deps
+# chains glib-2.0/gobject-2.0; listed explicitly anyway since the
+# generated vapi names GLib directly).
+install_data(
+    '../vapi/invercargill-json.deps',
+    install_dir: get_option('datadir') / 'vala' / 'vapi',
+)

+ 3 - 1
src/tests/meson.build

@@ -6,4 +6,6 @@ sources += files('Integration/Json.vala')
 sources += files('Integration/FromElement.vala')
 sources += files('Integration/Jsonl.vala')
 
-executable('invercargill-json-test-suite', sources, dependencies: dependencies, install: true)
+invercargill_json_test_suite = executable('invercargill-json-test-suite', sources, dependencies: dependencies, install: false)
+
+test('invercargill-json', invercargill_json_test_suite)

+ 12 - 0
usm-scripts/test.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+# Runs the test suite inside an already-built tree. ninja's test target
+# exits 0 even when no tests are defined, so this stays uniform across
+# the family. $1 is the build directory (set by usm).
+#
+# LD_LIBRARY_PATH is scrubbed: a system-wide path here (e.g. /opt/usm/lib)
+# takes precedence over the build tree's RUNPATH and silently links the
+# tests against a stale installed copy of the library instead of the one
+# just built — failures then reflect the old lib, not this source.
+LD_LIBRARY_PATH= ninja -C "$1" test

+ 4 - 0
vapi/invercargill-json.deps

@@ -0,0 +1,4 @@
+glib-2.0
+gobject-2.0
+invercargill-1
+json-glib-1.0