Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 3d03353

Browse files
authored
Merge pull request #2495 from lissyx/electronjs7
Add ElectronJS v7.0
2 parents af5d18c + b152802 commit 3d03353

7 files changed

+86
-18
lines changed

native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch renamed to native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
From 203493e23f55f38c35e296e4a72334e1710ed85c Mon Sep 17 00:00:00 2001
1+
From 7ae52d43e069c6c089dbd431d170493fd18499c2 Mon Sep 17 00:00:00 2001
22
From: Alexandre Lissy <[email protected]>
33
Date: Thu, 25 Apr 2019 12:29:19 +0200
4-
Subject: [PATCH] Upgrade SWIG to support NodeJS v12 / V8 v7.6 runtime
4+
Subject: [PATCH] Upgrade SWIG to support NodeJS v12 / V8 v7.6, v8 v7.8 runtime
55

66
---
7-
Lib/javascript/v8/javascriptcode.swg | 26 ++++----
8-
Lib/javascript/v8/javascriptcomplex.swg | 10 ++--
9-
Lib/javascript/v8/javascripthelpers.swg | 24 ++++----
7+
Lib/javascript/v8/javascriptcode.swg | 30 +++++----
8+
Lib/javascript/v8/javascriptcomplex.swg | 10 +--
9+
Lib/javascript/v8/javascripthelpers.swg | 26 +++++---
1010
Lib/javascript/v8/javascriptinit.swg | 4 +-
11-
Lib/javascript/v8/javascriptprimtypes.swg | 28 ++++-----
12-
Lib/javascript/v8/javascriptrun.swg | 73 +++++++++++++++--------
11+
Lib/javascript/v8/javascriptprimtypes.swg | 28 ++++----
12+
Lib/javascript/v8/javascriptrun.swg | 78 ++++++++++++++++-------
1313
Lib/javascript/v8/javascriptruntime.swg | 4 ++
14-
Lib/javascript/v8/javascriptstrings.swg | 10 ++--
14+
Lib/javascript/v8/javascriptstrings.swg | 10 +--
1515
Lib/javascript/v8/javascripttypemaps.swg | 2 +-
1616
Tools/javascript/v8_shell.cxx | 18 +++---
17-
10 files changed, 118 insertions(+), 81 deletions(-)
17+
10 files changed, 129 insertions(+), 81 deletions(-)
1818

1919
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
20-
index c4aaf3db0..c6a813bbb 100644
20+
index c4aaf3db0..3fba197c0 100644
2121
--- a/Lib/javascript/v8/javascriptcode.swg
2222
+++ b/Lib/javascript/v8/javascriptcode.swg
2323
@@ -11,7 +11,7 @@
@@ -110,7 +110,19 @@ index c4aaf3db0..c6a813bbb 100644
110110
%}
111111

112112
/* -----------------------------------------------------------------------------
113-
@@ -444,7 +448,7 @@ fail:
113+
@@ -435,7 +439,11 @@ fail:
114+
* ----------------------------------------------------------------------------- */
115+
%fragment("jsv8_register_class", "templates")
116+
%{
117+
+#if (SWIG_V8_VERSION < 0x0708)
118+
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
119+
+#else
120+
+ $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
121+
+#endif
122+
%}
123+
124+
/* -----------------------------------------------------------------------------
125+
@@ -444,7 +452,7 @@ fail:
114126
* ----------------------------------------------------------------------------- */
115127
%fragment("jsv8_create_namespace", "templates")
116128
%{
@@ -163,7 +175,7 @@ index d3b4aaffa..533e54813 100644
163175
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
164176
double re, im;
165177
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
166-
index 80fbd7aa1..fa33e9762 100644
178+
index 80fbd7aa1..7b42e888e 100644
167179
--- a/Lib/javascript/v8/javascripthelpers.swg
168180
+++ b/Lib/javascript/v8/javascripthelpers.swg
169181
@@ -21,19 +21,19 @@ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
@@ -190,7 +202,7 @@ index 80fbd7aa1..fa33e9762 100644
190202
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
191203

192204
SWIGV8_ESCAPE(class_templ);
193-
@@ -42,33 +42,37 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
205+
@@ -42,33 +42,39 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
194206
/**
195207
* Registers a class method with given name for a given class template.
196208
*/
@@ -221,8 +233,10 @@ index 80fbd7aa1..fa33e9762 100644
221233
const SwigV8FunctionCallback& _func) {
222234
+#if (SWIG_V8_VERSION < 0x0705)
223235
obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
224-
+#else
236+
+#elif (SWIG_V8_VERSION < 0x0708)
225237
+ obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
238+
+#else
239+
+ obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
226240
+#endif
227241
}
228242

@@ -386,7 +400,7 @@ index f76be983b..24f5daf7c 100644
386400
if(!obj->IsNumber()) {
387401
return SWIG_TypeError;
388402
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
389-
index 2452f4040..99587943b 100644
403+
index 2452f4040..78e7ea018 100644
390404
--- a/Lib/javascript/v8/javascriptrun.swg
391405
+++ b/Lib/javascript/v8/javascriptrun.swg
392406
@@ -10,7 +10,11 @@
@@ -628,6 +642,19 @@ index 2452f4040..99587943b 100644
628642
#endif
629643
SWIGV8_HANDLESCOPE_ESC();
630644

645+
@@ -669,7 +694,12 @@ v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handl
646+
#else
647+
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
648+
#endif
649+
+
650+
+#if (SWIG_V8_VERSION < 0x0708)
651+
arr->Set(arr->Length(), obj);
652+
+#else
653+
+ arr->Set(SWIGV8_CURRENT_CONTEXT(), arr->Length(), obj);
654+
+#endif
655+
656+
SWIGV8_ESCAPE(arr);
657+
}
631658
diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg
632659
index c78e04efb..e7941d657 100644
633660
--- a/Lib/javascript/v8/javascriptruntime.swg

taskcluster/.shared.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ swig:
8686
# patch of _0001 would require the reverse patch of _0002 to be already
8787
# applied, and we don't want to. So just test that reversing _0002 in
8888
# dry-run.
89-
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
90-
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 ;
89+
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
90+
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 ;
9191
else
9292
echo "NO NODEJS v12 PATCH NEEDED";
9393
fi)'

taskcluster/darwin-opt-base.tyml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ payload:
103103
ln -s $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/ $TASKCLUSTER_TASK_DIR/DeepSpeech/tf/native_client &&
104104
cd $TASKCLUSTER_TASK_DIR &&
105105
$TASKCLUSTER_TASK_DIR/DeepSpeech/tf/tc-brew.sh &&
106+
$TASKCLUSTER_TASK_DIR/homebrew/bin/brew reinstall swig &&
106107
${swig.patch_nodejs.osx_v12} &&
107108
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.build} &&
108109
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.package}

taskcluster/tc-tests-utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ model_source_mmap="$(dirname "${model_source}")/${model_name_mmap}"
5757

5858
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}
5959
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}
60-
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}
60+
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}
6161

6262
strip() {
6363
echo "$(echo $1 | sed -e 's/^[[:space:]]+//' -e 's/[[:space:]]+$//')"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
build:
2+
template_file: test-darwin-opt-base.tyml
3+
dependencies:
4+
- "node-package-cpu"
5+
- "test-training_upstream-linux-amd64-py35m-opt"
6+
system_setup:
7+
>
8+
${nodejs.brew.setup} && ${nodejs.brew.prep_12} && ${nodejs.brew.env}
9+
args:
10+
tests_cmdline: "$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 7.0.1"
11+
metadata:
12+
name: "DeepSpeech OSX AMD64 CPU ElectronJS v7.0 tests"
13+
description: "Testing DeepSpeech for OSX/AMD64 on ElectronJS v7.0, CPU only, optimized version"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
build:
2+
template_file: test-linux-opt-base.tyml
3+
docker_image: "ubuntu:16.04"
4+
dependencies:
5+
- "node-package-cpu"
6+
- "test-training_upstream-linux-amd64-py35m-opt"
7+
system_setup:
8+
>
9+
${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}
10+
args:
11+
tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 7.0.1"
12+
metadata:
13+
name: "DeepSpeech Linux AMD64 CPU ElectronJS v7.0 tests"
14+
description: "Testing DeepSpeech for Linux/AMD64 on ElectronJS v7.0, CPU only, optimized version"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
build:
2+
template_file: test-win-opt-base.tyml
3+
dependencies:
4+
- "node-package-cpu"
5+
- "test-training_upstream-linux-amd64-py35m-opt"
6+
system_setup:
7+
>
8+
${system.sox_win} && ${nodejs.win.prep_12}
9+
args:
10+
tests_cmdline: "${system.homedir.win}/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 7.0.1"
11+
metadata:
12+
name: "DeepSpeech Windows AMD64 CPU ElectronJS v7.0 tests"
13+
description: "Testing DeepSpeech for Windows/AMD64 on ElectronJS v7.0, CPU only, optimized version"

0 commit comments

Comments
 (0)