From 485518dfbc31730d60190050c121f8693af24378 Mon Sep 17 00:00:00 2001 From: hydai Date: Fri, 4 Dec 2020 19:46:30 +0000 Subject: [PATCH] [GYP] Storage library should only be built when the fallback-to-build happens --- binding.gyp | 14 ++++++++++++++ package.json | 4 ++-- scripts/build_storage_lib.sh | 5 +++++ preinstall.sh => scripts/preinstall.sh | 5 ----- release.sh => scripts/release.sh | 0 5 files changed, 21 insertions(+), 7 deletions(-) create mode 100755 scripts/build_storage_lib.sh rename preinstall.sh => scripts/preinstall.sh (81%) rename release.sh => scripts/release.sh (100%) diff --git a/binding.gyp b/binding.gyp index fd420a0..9bfc703 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,7 +1,21 @@ { "targets": [ + { + "target_name": "action_before_build", + "type": "none", + "hard_dependency": 1, + "actions": [ + { + "action_name": "build rust-native-storage library", + "inputs": [ "scripts/build_storage_lib.sh" ], + "outputs": [ "" ], + "action": ["scripts/build_storage_lib.sh"] + } + ] + }, { "target_name": "<(module_name)", + "dependencies": [ "action_before_build" ], "cflags_cc": [ "-std=c++17" ], "cflags!": [ "-fno-exceptions", "-fno-rtti" ], "cflags_cc!": [ "-fno-exceptions", "-fno-rtti" ], diff --git a/package.json b/package.json index 93fe7d9..dbde03f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ssvm-extensions", - "version": "0.0.4", + "version": "0.0.5", "description": "Second State WebAssembly VM for Node.js Addon with all extensions", "keywords": [ "wasm", @@ -33,7 +33,7 @@ "ssvmup": "^0.1.17" }, "scripts": { - "preinstall": "./preinstall.sh", + "preinstall": "./scripts/preinstall.sh", "test": "cd ssvm-napi/test && ./test.sh", "install": "node-pre-gyp install --fallback-to-build" } diff --git a/scripts/build_storage_lib.sh b/scripts/build_storage_lib.sh new file mode 100755 index 0000000..dd360c2 --- /dev/null +++ b/scripts/build_storage_lib.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Build SSVM-Storage dependencies +cd ./rust_native_storage_library/ +make target/debug/librust_native_storage_library.so +cd ../ diff --git a/preinstall.sh b/scripts/preinstall.sh similarity index 81% rename from preinstall.sh rename to scripts/preinstall.sh index 909a2fc..a536326 100755 --- a/preinstall.sh +++ b/scripts/preinstall.sh @@ -1,9 +1,4 @@ #!/usr/bin/env bash -# Build SSVM-Storage dependencies -cd ./rust_native_storage_library/ -make target/debug/librust_native_storage_library.so -cd ../ - # Check TensorFlow version c++ ./utils/checker/tensorflow_version_checker.cc -ltensorflow -o ./tf_ver ./tf_ver diff --git a/release.sh b/scripts/release.sh similarity index 100% rename from release.sh rename to scripts/release.sh