Merge pull request #2495 from lissyx/electronjs7

Add ElectronJS v7.0
This commit is contained in:
lissyx 2019-11-05 15:15:52 +01:00 committed by GitHub
commit 3d03353e64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 86 additions and 18 deletions

View File

@ -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 <lissyx@lissyx.dyndns.org>
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<void> 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<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
@@ -42,33 +42,39 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> 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<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handl
#else
v8::Local<v8::Array> arr = v8::Local<v8::Array>::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

View File

@ -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)'

View File

@ -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}

View File

@ -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:]]+$//')"

View File

@ -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"

View File

@ -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"

View File

@ -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"