summarylogtreecommitdiffstats
path: root/workbench-demo-compatibility.patch
blob: 0be85632cd114d2fba736020a3a1882c85b3bb85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 4de731faa4149164ed4a26780c0dbb1dddd681ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Sat, 23 Nov 2024 13:18:41 +0100
Subject: [PATCH] Don't check demo compatibility with Flatpak runtime

---
 build-aux/library.js | 25 -------------------------
 src/cli/main.js      | 42 ------------------------------------------
 2 files changed, 67 deletions(-)

diff --git a/build-aux/library.js b/build-aux/library.js
index ec18b35..df33f0e 100755
--- a/build-aux/library.js
+++ b/build-aux/library.js
@@ -63,10 +63,6 @@ const demos = [];
     const demo = JSON.parse(str);
     demo.name = file_info.get_name();
 
-    if (!isDemoCompatible(demo)) {
-      continue;
-    }
-
     const languages = [];
     if (demo_dir.get_child("main.js").query_exists(null)) {
       languages.push("javascript");
@@ -226,25 +222,4 @@ async function copyDirectory(source, destination) {
   }
 }
 
-const key_file = new GLib.KeyFile();
-key_file.load_from_file("/.flatpak-info", GLib.KeyFileFlags.NONE);
-// runtime/org.gnome.Sdk/x86_64/master
-const [, , , runtime_version] = key_file
-  .get_string("Application", "runtime")
-  .split("/");
-
-function isDemoCompatible(demo) {
-  const demo_runtime_version = demo["runtime-version"];
-
-  if (demo_runtime_version === "master") {
-    return runtime_version === "master";
-  } else if (runtime_version === "master") {
-    return true;
-  } else if (!demo_runtime_version) {
-    return true;
-  }
-
-  return +runtime_version >= +demo_runtime_version;
-}
-
 loop.run();
diff --git a/src/cli/main.js b/src/cli/main.js
index 8655f9b..d799551 100644
--- a/src/cli/main.js
+++ b/src/cli/main.js
@@ -134,14 +134,6 @@ async function ci({ filenames }) {
 
     print(`\n📂${demo_dir.get_path()}`);
 
-    const [compatible, required_runtime_version] = isDemoCompatible(demo_dir);
-    if (!compatible) {
-      print(
-        `  ⚠️ skipped - requires runtime version ${required_runtime_version}`,
-      );
-      continue;
-    }
-
     const lsp_clients = createLSPClients({ root_uri: demo_dir.get_uri() });
     await Promise.all(
       Object.entries(lsp_clients).map(([, lspc]) => {
@@ -641,37 +633,3 @@ function serializeDiagnostics({ diagnostics }) {
       .join("\n") + "\n"
   );
 }
-
-const key_file = new GLib.KeyFile();
-key_file.load_from_file("/.flatpak-info", GLib.KeyFileFlags.NONE);
-// runtime/org.gnome.Sdk/x86_64/master
-const [, , , runtime_version] = key_file
-  .get_string("Application", "runtime")
-  .split("/");
-
-function isDemoCompatible(file) {
-  let str;
-  try {
-    str = new TextDecoder().decode(
-      file.get_child("main.json").load_contents(null)[1],
-    );
-  } catch (err) {
-    console.warn(err);
-    return true;
-  }
-
-  const demo = JSON.parse(str);
-  demo.name = file.get_basename();
-
-  const demo_runtime_version = demo["runtime-version"];
-
-  if (demo_runtime_version === "master") {
-    return [runtime_version === "master", demo_runtime_version];
-  } else if (runtime_version === "master") {
-    return [true, demo_runtime_version];
-  } else if (!demo_runtime_version) {
-    return [true, demo_runtime_version];
-  }
-
-  return [+runtime_version >= +demo_runtime_version, demo_runtime_version];
-}
-- 
2.47.0