From 968c9716f9728ce8399a4733411f0d9bc43ac68b Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Fri, 27 Sep 2024 16:29:28 +0200 Subject: [PATCH 1/3] chore(common): improve configuration detection for hextobin This improves #12440. The previous change was a bit fragile if we updated commander versions. This change now implements a better solution that doesn't rely on dependencies and their locations for detecting if we need to run the `configure` action for hextobin. --- common/tools/hextobin/build.sh | 2 +- common/tools/hextobin/package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/tools/hextobin/build.sh b/common/tools/hextobin/build.sh index 9e73f8c4101..309260c1b12 100755 --- a/common/tools/hextobin/build.sh +++ b/common/tools/hextobin/build.sh @@ -11,7 +11,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" builder_describe "Build hextobin" clean configure build builder_describe_outputs \ - configure /common/tools/hextobin/node_modules/commander \ + configure /common/tools/hextobin/build/.configured \ build /common/tools/hextobin/build/index.js builder_parse "$@" diff --git a/common/tools/hextobin/package.json b/common/tools/hextobin/package.json index fb651481f7a..0b2ea05a31c 100644 --- a/common/tools/hextobin/package.json +++ b/common/tools/hextobin/package.json @@ -15,5 +15,8 @@ "main": "build/index.js", "bin": { "hextobin": "build/hextobin.js" + }, + "scripts": { + "postinstall": "mkdir -p build && touch build/.configured" } } From d552b44a9dd0ad676a07977874c27706a21fb09b Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Fri, 27 Sep 2024 22:32:33 +0200 Subject: [PATCH 2/3] chore(common): use node to touch file The previous attempt failed when building on Windows. Using node should work everywhere. --- common/tools/hextobin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tools/hextobin/package.json b/common/tools/hextobin/package.json index 0b2ea05a31c..2cb98f81cc4 100644 --- a/common/tools/hextobin/package.json +++ b/common/tools/hextobin/package.json @@ -17,6 +17,6 @@ "hextobin": "build/hextobin.js" }, "scripts": { - "postinstall": "mkdir -p build && touch build/.configured" + "postinstall": "node --eval \"const fs =require('fs'); const path = require('path'); var dir = 'build'; if (!fs.existsSync(dir)) { fs.mkdirSync(dir); } fs.writeFileSync(path.join(dir, '.configured'), '');\"" } } From 3056128c149b587a1c0172dee8670b0a55df4414 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Mon, 30 Sep 2024 14:51:24 +0200 Subject: [PATCH 3/3] chore(common): create flag file without node Addresses code review comments. --- .gitignore | 3 +++ common/tools/hextobin/build.sh | 2 +- common/tools/hextobin/package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 772784fdb8c..6c8fbfbec84 100644 --- a/.gitignore +++ b/.gitignore @@ -183,3 +183,6 @@ lcov.info /keyman*.buildinfo /keyman*.changes /keyman*.tar.?z + +# flag file for build script +.configured diff --git a/common/tools/hextobin/build.sh b/common/tools/hextobin/build.sh index 309260c1b12..073b008bf2e 100755 --- a/common/tools/hextobin/build.sh +++ b/common/tools/hextobin/build.sh @@ -11,7 +11,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" builder_describe "Build hextobin" clean configure build builder_describe_outputs \ - configure /common/tools/hextobin/build/.configured \ + configure /common/tools/hextobin/.configured \ build /common/tools/hextobin/build/index.js builder_parse "$@" diff --git a/common/tools/hextobin/package.json b/common/tools/hextobin/package.json index 2cb98f81cc4..708dace5028 100644 --- a/common/tools/hextobin/package.json +++ b/common/tools/hextobin/package.json @@ -17,6 +17,6 @@ "hextobin": "build/hextobin.js" }, "scripts": { - "postinstall": "node --eval \"const fs =require('fs'); const path = require('path'); var dir = 'build'; if (!fs.existsSync(dir)) { fs.mkdirSync(dir); } fs.writeFileSync(path.join(dir, '.configured'), '');\"" + "postinstall": "echo configured > .configured" } }