From b152802fd1f3d3d61e830a155ee91bb5c7cb7eb7 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Tue, 5 Nov 2019 09:10:53 +0100 Subject: [PATCH] Add ElectronJS v7.0 Fixes #2494 --- ...upport-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch} | 57 ++++++++++++++----- taskcluster/.shared.yml | 4 +- taskcluster/darwin-opt-base.tyml | 1 + taskcluster/tc-tests-utils.sh | 2 +- .../test-electronjs_v7.0-darwin-amd64-opt.yml | 13 +++++ .../test-electronjs_v7.0-linux-amd64-opt.yml | 14 +++++ .../test-electronjs_v7.0-win-amd64-opt.yml | 13 +++++ 7 files changed, 86 insertions(+), 18 deletions(-) rename native_client/{swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch => swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch} (94%) create mode 100644 taskcluster/test-electronjs_v7.0-darwin-amd64-opt.yml create mode 100644 taskcluster/test-electronjs_v7.0-linux-amd64-opt.yml create mode 100644 taskcluster/test-electronjs_v7.0-win-amd64-opt.yml diff --git a/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch b/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch similarity index 94% rename from native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch rename to native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch index c8bf6922..b37d3f62 100644 --- a/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch +++ b/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch @@ -1,23 +1,23 @@ -From 203493e23f55f38c35e296e4a72334e1710ed85c Mon Sep 17 00:00:00 2001 +From 7ae52d43e069c6c089dbd431d170493fd18499c2 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Thu, 25 Apr 2019 12:29:19 +0200 -Subject: [PATCH] Upgrade SWIG to support NodeJS v12 / V8 v7.6 runtime +Subject: [PATCH] Upgrade SWIG to support NodeJS v12 / V8 v7.6, v8 v7.8 runtime --- - Lib/javascript/v8/javascriptcode.swg | 26 ++++---- - Lib/javascript/v8/javascriptcomplex.swg | 10 ++-- - Lib/javascript/v8/javascripthelpers.swg | 24 ++++---- + Lib/javascript/v8/javascriptcode.swg | 30 +++++---- + Lib/javascript/v8/javascriptcomplex.swg | 10 +-- + Lib/javascript/v8/javascripthelpers.swg | 26 +++++--- Lib/javascript/v8/javascriptinit.swg | 4 +- - Lib/javascript/v8/javascriptprimtypes.swg | 28 ++++----- - Lib/javascript/v8/javascriptrun.swg | 73 +++++++++++++++-------- + Lib/javascript/v8/javascriptprimtypes.swg | 28 ++++---- + Lib/javascript/v8/javascriptrun.swg | 78 ++++++++++++++++------- Lib/javascript/v8/javascriptruntime.swg | 4 ++ - Lib/javascript/v8/javascriptstrings.swg | 10 ++-- + Lib/javascript/v8/javascriptstrings.swg | 10 +-- Lib/javascript/v8/javascripttypemaps.swg | 2 +- Tools/javascript/v8_shell.cxx | 18 +++--- - 10 files changed, 118 insertions(+), 81 deletions(-) + 10 files changed, 129 insertions(+), 81 deletions(-) diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg -index c4aaf3db0..c6a813bbb 100644 +index c4aaf3db0..3fba197c0 100644 --- a/Lib/javascript/v8/javascriptcode.swg +++ b/Lib/javascript/v8/javascriptcode.swg @@ -11,7 +11,7 @@ @@ -110,7 +110,19 @@ index c4aaf3db0..c6a813bbb 100644 %} /* ----------------------------------------------------------------------------- -@@ -444,7 +448,7 @@ fail: +@@ -435,7 +439,11 @@ fail: + * ----------------------------------------------------------------------------- */ + %fragment("jsv8_register_class", "templates") + %{ ++#if (SWIG_V8_VERSION < 0x0708) + $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); ++#else ++ $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); ++#endif + %} + + /* ----------------------------------------------------------------------------- +@@ -444,7 +452,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("jsv8_create_namespace", "templates") %{ @@ -163,7 +175,7 @@ index d3b4aaffa..533e54813 100644 if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); double re, im; diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg -index 80fbd7aa1..fa33e9762 100644 +index 80fbd7aa1..7b42e888e 100644 --- a/Lib/javascript/v8/javascripthelpers.swg +++ b/Lib/javascript/v8/javascripthelpers.swg @@ -21,19 +21,19 @@ typedef v8::PropertyCallbackInfo SwigV8PropertyCallbackInfoVoid; @@ -190,7 +202,7 @@ index 80fbd7aa1..fa33e9762 100644 cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr)); SWIGV8_ESCAPE(class_templ); -@@ -42,33 +42,37 @@ SWIGRUNTIME v8::Handle SWIGV8_CreateClassTemplate(const ch +@@ -42,33 +42,39 @@ SWIGRUNTIME v8::Handle SWIGV8_CreateClassTemplate(const ch /** * Registers a class method with given name for a given class template. */ @@ -221,8 +233,10 @@ index 80fbd7aa1..fa33e9762 100644 const SwigV8FunctionCallback& _func) { +#if (SWIG_V8_VERSION < 0x0705) obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction()); -+#else ++#elif (SWIG_V8_VERSION < 0x0708) + obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()); ++#else ++ obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()); +#endif } @@ -386,7 +400,7 @@ index f76be983b..24f5daf7c 100644 if(!obj->IsNumber()) { return SWIG_TypeError; diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg -index 2452f4040..99587943b 100644 +index 2452f4040..78e7ea018 100644 --- a/Lib/javascript/v8/javascriptrun.swg +++ b/Lib/javascript/v8/javascriptrun.swg @@ -10,7 +10,11 @@ @@ -628,6 +642,19 @@ index 2452f4040..99587943b 100644 #endif SWIGV8_HANDLESCOPE_ESC(); +@@ -669,7 +694,12 @@ v8::Handle SWIGV8_AppendOutput(v8::Local result, v8::Handl + #else + v8::Local arr = v8::Local::Cast(result); + #endif ++ ++#if (SWIG_V8_VERSION < 0x0708) + arr->Set(arr->Length(), obj); ++#else ++ arr->Set(SWIGV8_CURRENT_CONTEXT(), arr->Length(), obj); ++#endif + + SWIGV8_ESCAPE(arr); + } diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg index c78e04efb..e7941d657 100644 --- a/Lib/javascript/v8/javascriptruntime.swg diff --git a/taskcluster/.shared.yml b/taskcluster/.shared.yml index 7cd6774f..d09d1a6e 100644 --- a/taskcluster/.shared.yml +++ b/taskcluster/.shared.yml @@ -86,8 +86,8 @@ swig: # patch of _0001 would require the reverse patch of _0002 to be already # applied, and we don't want to. So just test that reversing _0002 in # dry-run. - osx_v12: '(if ! patch -R -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 -s -f --dry-run < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch ; then -patch -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch ; + osx_v12: '(if ! patch -R -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 -s -f --dry-run < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch ; then +patch -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch ; else echo "NO NODEJS v12 PATCH NEEDED"; fi)' diff --git a/taskcluster/darwin-opt-base.tyml b/taskcluster/darwin-opt-base.tyml index 8121970a..7d81b29f 100644 --- a/taskcluster/darwin-opt-base.tyml +++ b/taskcluster/darwin-opt-base.tyml @@ -103,6 +103,7 @@ payload: ln -s $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/ $TASKCLUSTER_TASK_DIR/DeepSpeech/tf/native_client && cd $TASKCLUSTER_TASK_DIR && $TASKCLUSTER_TASK_DIR/DeepSpeech/tf/tc-brew.sh && + $TASKCLUSTER_TASK_DIR/homebrew/bin/brew reinstall swig && ${swig.patch_nodejs.osx_v12} && $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.build} && $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.package} diff --git a/taskcluster/tc-tests-utils.sh b/taskcluster/tc-tests-utils.sh index 48caf45c..a306a94b 100755 --- a/taskcluster/tc-tests-utils.sh +++ b/taskcluster/tc-tests-utils.sh @@ -57,7 +57,7 @@ model_source_mmap="$(dirname "${model_source}")/${model_name_mmap}" SUPPORTED_PYTHON_VERSIONS=${SUPPORTED_PYTHON_VERSIONS:-2.7.16:ucs2 2.7.16:ucs4 3.4.10:ucs4 3.5.7:ucs4 3.6.8:ucs4 3.7.3:ucs4 3.8.0:ucs4} SUPPORTED_NODEJS_VERSIONS=${SUPPORTED_NODEJS_VERSIONS:-4.9.1 5.12.0 6.17.1 7.10.1 8.16.0 9.11.2 10.16.0 11.15.0 12.5.0} -SUPPORTED_ELECTRONJS_VERSIONS=${SUPPORTED_ELECTRONJS_VERSIONS:-1.6.18 1.7.16 1.8.8 2.0.18 3.0.16 3.1.11 4.0.3 4.1.5 4.2.5 5.0.6 6.0.11} +SUPPORTED_ELECTRONJS_VERSIONS=${SUPPORTED_ELECTRONJS_VERSIONS:-1.6.18 1.7.16 1.8.8 2.0.18 3.0.16 3.1.11 4.0.3 4.1.5 4.2.5 5.0.6 6.0.11 7.0.1} strip() { echo "$(echo $1 | sed -e 's/^[[:space:]]+//' -e 's/[[:space:]]+$//')" diff --git a/taskcluster/test-electronjs_v7.0-darwin-amd64-opt.yml b/taskcluster/test-electronjs_v7.0-darwin-amd64-opt.yml new file mode 100644 index 00000000..ab74503f --- /dev/null +++ b/taskcluster/test-electronjs_v7.0-darwin-amd64-opt.yml @@ -0,0 +1,13 @@ +build: + template_file: test-darwin-opt-base.tyml + dependencies: + - "node-package-cpu" + - "test-training_upstream-linux-amd64-py35m-opt" + system_setup: + > + ${nodejs.brew.setup} && ${nodejs.brew.prep_12} && ${nodejs.brew.env} + args: + tests_cmdline: "$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 7.0.1" + metadata: + name: "DeepSpeech OSX AMD64 CPU ElectronJS v7.0 tests" + description: "Testing DeepSpeech for OSX/AMD64 on ElectronJS v7.0, CPU only, optimized version" diff --git a/taskcluster/test-electronjs_v7.0-linux-amd64-opt.yml b/taskcluster/test-electronjs_v7.0-linux-amd64-opt.yml new file mode 100644 index 00000000..82108159 --- /dev/null +++ b/taskcluster/test-electronjs_v7.0-linux-amd64-opt.yml @@ -0,0 +1,14 @@ +build: + template_file: test-linux-opt-base.tyml + docker_image: "ubuntu:16.04" + dependencies: + - "node-package-cpu" + - "test-training_upstream-linux-amd64-py35m-opt" + system_setup: + > + ${nodejs.packages_xenial.prep_12} && ${nodejs.packages_xenial.apt_pinning} && apt-get -qq update && apt-get -qq -y install ${nodejs.packages_xenial.apt} ${electronjs.packages_xenial.apt} + args: + tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 7.0.1" + metadata: + name: "DeepSpeech Linux AMD64 CPU ElectronJS v7.0 tests" + description: "Testing DeepSpeech for Linux/AMD64 on ElectronJS v7.0, CPU only, optimized version" diff --git a/taskcluster/test-electronjs_v7.0-win-amd64-opt.yml b/taskcluster/test-electronjs_v7.0-win-amd64-opt.yml new file mode 100644 index 00000000..23dc8f8e --- /dev/null +++ b/taskcluster/test-electronjs_v7.0-win-amd64-opt.yml @@ -0,0 +1,13 @@ +build: + template_file: test-win-opt-base.tyml + dependencies: + - "node-package-cpu" + - "test-training_upstream-linux-amd64-py35m-opt" + system_setup: + > + ${system.sox_win} && ${nodejs.win.prep_12} + args: + tests_cmdline: "${system.homedir.win}/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 7.0.1" + metadata: + name: "DeepSpeech Windows AMD64 CPU ElectronJS v7.0 tests" + description: "Testing DeepSpeech for Windows/AMD64 on ElectronJS v7.0, CPU only, optimized version"