Merge pull request #2731 from lissyx/swig-build

Build SWIG locally
This commit is contained in:
lissyx 2020-02-12 16:17:19 +01:00 committed by GitHub
commit a334c333de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 231 additions and 1623 deletions

View File

@ -14,7 +14,7 @@ It is required to use our fork of TensorFlow since it includes fixes for common
If you'd like to build the language bindings or the decoder package, you'll also need:
* `SWIG >= 3.0.12 <http://www.swig.org/>`_
* `SWIG >= 3.0.12 <http://www.swig.org/>`_. If you intend to build NodeJS / ElectronJS bindings you will need a patched version of SWIG. Please refer to the matching section below.
* `node-pre-gyp <https://github.com/mapbox/node-pre-gyp>`_ (for Node.JS bindings only)
Dependencies
@ -105,37 +105,12 @@ Included are a set of generated Python bindings. After following the above build
The API mirrors the C++ API and is demonstrated in `client.py <python/client.py>`_. Refer to `deepspeech.h <deepspeech.h>`_ for documentation.
Install Node.JS bindings
^^^^^^^^^^^^^^^^^^^^^^^^
Install NodeJS / ElectronJS bindings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unfortunately, JavaScript support on SWIG is a bit behind, and while there are
pending patches proposed to upstream, it is not yet merged.
You would need to patch SWIG, either from your distribution's setup, or do a
local-patched build of SWIG.
If you patch from a v3.0 SWIG, you will need to apply those:
.. code-block::
native_client/swig_node_v7x-v8x-v9x_0001.patch
native_client/swig_node_v7x-v8x-v9x_0002.patch
native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch
If you patch from a v4.0 SWIG, you can just apply this:
.. code-block::
native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch
On a Debian/Ubuntu system, you would need:
.. code-block::
for patch_file in native_client/swig_node_v7x-v8x-v9x_0001.patch native_client/swig_node_v7x-v8x-v9x_0002.patch native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-v8-v7.8-r.patch;
do
patch -d /usr/share/swig3.0/ -p2 < $patch_file
done;
Unfortunately, JavaScript support on SWIG is a bit behind, and while there are pending patches proposed to upstream, it is not yet merged.
You should be able to build from `our fork <https://github.com/lissyx/swig/tree/taskcluster>`_, and you can find pre-built binaries on `TaskCluster <https://community-tc.services.mozilla.com/tasks/index/project.deepspeech.swig>`_ (please look for swig fork sha1).
Extract the `ds-swig.tar.gz` to some place in your `$HOME`, then update `$PATH` accordingly. You might need to symlink `ds-swig` as `swig`, and you will have to `export SWIG_LIB=<path/to/swig/share>` so that it contains path to `share/swig/<VERSION>/`.
After following the above build and installation instructions, the Node.JS bindings can be built:

View File

@ -1,203 +0,0 @@
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index 7b8a5ec237..80fbd7aa1a 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -93,7 +93,7 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8
#else
v8::Local<v8::String> sproperty;
if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
- sproperty->WriteUtf8(buffer, 256);
+ SWIGV8_WRITE_UTF8(sproperty, buffer, 256);
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
}
else {
diff --git a/Lib/javascript/v8/javascriptprimtypes.swg b/Lib/javascript/v8/javascriptprimtypes.swg
index c0055c48ee..f76be983b1 100644
--- a/Lib/javascript/v8/javascriptprimtypes.swg
+++ b/Lib/javascript/v8/javascriptprimtypes.swg
@@ -22,7 +22,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
return SWIG_ERROR;
}
- if (val) *val = obj->BooleanValue();
+ if (val) *val = SWIGV8_BOOLEAN_VALUE(obj);
return SWIG_OK;
}
}
@@ -44,7 +44,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
if (!valRef->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = valRef->IntegerValue();
+ if(val) *val = SWIGV8_INTEGER_VALUE(valRef);
return SWIG_OK;
}
@@ -68,7 +68,7 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
if (!obj->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = (long) obj->IntegerValue();
+ if(val) *val = (long) SWIGV8_INTEGER_VALUE(obj);
return SWIG_OK;
}
@@ -95,7 +95,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
return SWIG_TypeError;
}
- long longVal = (long) obj->NumberValue();
+ long longVal = (long) SWIGV8_NUMBER_VALUE(obj);
if(longVal < 0) {
return SWIG_OverflowError;
@@ -133,7 +133,7 @@ int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
if (!obj->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = (long long) obj->IntegerValue();
+ if(val) *val = (long long) SWIGV8_INTEGER_VALUE(obj);
return SWIG_OK;
}
@@ -168,7 +168,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
return SWIG_TypeError;
}
- long long longVal = (long long) obj->NumberValue();
+ long long longVal = (long long) SWIGV8_NUMBER_VALUE(obj);
if(longVal < 0) {
return SWIG_OverflowError;
@@ -198,7 +198,7 @@ int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
if(!obj->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = obj->NumberValue();
+ if(val) *val = SWIGV8_NUMBER_VALUE(obj);
return SWIG_OK;
}
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 84bd4cc67e..2452f4040d 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -91,6 +91,32 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
#endif
+#ifdef NODE_VERSION
+#if NODE_VERSION_AT_LEAST(10, 12, 0)
+#define SWIG_NODE_AT_LEAST_1012
+#endif
+#endif
+
+//Necessary to check Node.js version because V8 API changes are backported in Node.js
+#if (defined(NODE_VERSION) && !defined(SWIG_NODE_AT_LEAST_1012)) || \
+ (!defined(NODE_VERSION) && (V8_MAJOR_VERSION-0) < 7)
+#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject()
+#define SWIGV8_TO_STRING(handle) (handle)->ToString()
+#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue()
+#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue()
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
+#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
+#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
+#else
+#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
+#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
+#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
+#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
+#endif
+
/* ---------------------------------------------------------------------------
* Error handling
*
@@ -258,7 +284,7 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
@@ -352,7 +378,7 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
}
@@ -479,7 +505,7 @@ SWIGRUNTIMEINLINE
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return false;
#if (V8_MAJOR_VERSION-0) < 5
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
@@ -489,7 +515,7 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
return false;
#endif
- return (flag->IsBoolean() && flag->BooleanValue());
+ return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag));
}
SWIGRUNTIME
@@ -499,7 +525,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
SwigV8PackedData *sobj;
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg
index 0e40593263..c78e04efbb 100644
--- a/Lib/javascript/v8/javascriptruntime.swg
+++ b/Lib/javascript/v8/javascriptruntime.swg
@@ -44,6 +44,8 @@
#ifdef BUILDING_NODE_EXTENSION
%insert("runtime") %{
#include <node.h>
+//Older version of node.h does not include this
+#include <node_version.h>
%}
#endif
diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg
index 65ba20e5a9..e767a6d662 100644
--- a/Lib/javascript/v8/javascriptstrings.swg
+++ b/Lib/javascript/v8/javascriptstrings.swg
@@ -7,11 +7,11 @@ SWIGINTERN int
SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
{
if(valRef->IsString()) {
- v8::Handle<v8::String> js_str = valRef->ToString();
+ v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
- size_t len = js_str->Utf8Length() + 1;
+ size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
char* cstr = new char[len];
- js_str->WriteUtf8(cstr, len);
+ SWIGV8_WRITE_UTF8(js_str, cstr, len);
if(alloc) *alloc = SWIG_NEWOBJ;
if(psize) *psize = len;
@@ -20,7 +20,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
return SWIG_OK;
} else {
if(valRef->IsObject()) {
- v8::Handle<v8::Object> obj = valRef->ToObject();
+ v8::Handle<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
// try if the object is a wrapped char[]
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {

View File

@ -1,732 +0,0 @@
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, v8 v7.8 runtime
---
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 | 78 ++++++++++++++++-------
Lib/javascript/v8/javascriptruntime.swg | 4 ++
Lib/javascript/v8/javascriptstrings.swg | 10 +--
Lib/javascript/v8/javascripttypemaps.swg | 2 +-
Tools/javascript/v8_shell.cxx | 18 +++---
10 files changed, 129 insertions(+), 81 deletions(-)
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index c4aaf3db0..3fba197c0 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -11,7 +11,7 @@
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> self = args.Holder();
+ v8::Local<v8::Object> self = args.Holder();
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
@@ -53,7 +53,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
OverloadErrorHandler errorHandler;
- v8::Handle<v8::Value> self;
+ v8::Local<v8::Value> self;
// switch all cases by means of series of if-returns.
$jsdispatchcases
@@ -78,7 +78,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> self = args.Holder();
+ v8::Local<v8::Object> self = args.Holder();
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
@@ -226,7 +226,7 @@ static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8Pr
#endif
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
$jslocals
$jscode
SWIGV8_RETURN_INFO(jsresult, info);
@@ -271,7 +271,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
@@ -296,7 +296,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
OverloadErrorHandler errorHandler;
$jscode
@@ -320,7 +320,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler
{
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
$jslocals
$jscode
SWIGV8_RETURN(jsresult);
@@ -374,7 +374,7 @@ fail:
%fragment("jsv8_define_class_template", "templates")
%{
/* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */
- v8::Handle<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
+ v8::Local<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class);
$jsmangledname_clientData.dtor = $jsdtor;
if (SWIGTYPE_$jsmangledtype->clientdata == 0) {
@@ -420,11 +420,15 @@ fail:
%fragment("jsv8_create_class_instance", "templates")
%{
/* Class: $jsname ($jsmangledname) */
- v8::Handle<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
+ v8::Local<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
$jsmangledname_class_0->SetCallHandler($jsctor);
$jsmangledname_class_0->Inherit($jsmangledname_class);
+#if (SWIG_V8_VERSION < 0x0705)
$jsmangledname_class_0->SetHiddenPrototype(true);
- v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+#else
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+#endif
%}
/* -----------------------------------------------------------------------------
@@ -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")
%{
- v8::Handle<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
+ v8::Local<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
%}
/* -----------------------------------------------------------------------------
diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
index d3b4aaffa..533e54813 100644
--- a/Lib/javascript/v8/javascriptcomplex.swg
+++ b/Lib/javascript/v8/javascriptcomplex.swg
@@ -12,7 +12,7 @@
%fragment(SWIG_From_frag(Type),"header",
fragment=SWIG_From_frag(double))
{
-SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIGINTERNINLINE v8::Local<v8::Value>
SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
{
SWIGV8_HANDLESCOPE_ESC();
@@ -32,12 +32,12 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
fragment=SWIG_AsVal_frag(double))
{
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
+SWIG_AsVal_dec(Type) (v8::Local<v8::Value> o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
+ v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(o);
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
@@ -74,12 +74,12 @@ SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
%fragment(SWIG_AsVal_frag(Type),"header",
fragment=SWIG_AsVal_frag(float)) {
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
+SWIG_AsVal_dec(Type) (v8::Local<v8::Value> o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
+ v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(o);
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..7b42e888e 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -21,19 +21,19 @@ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
/**
* Creates a class template for a class with specified initialization function.
*/
-SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
+SWIGRUNTIME v8::Local<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
SWIGV8_HANDLESCOPE_ESC();
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
- v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
inst_templ->SetInternalFieldCount(1);
- v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
- v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
SWIGV8_ESCAPE(class_templ);
@@ -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.
*/
-SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Local<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8FunctionCallback _func) {
- v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
}
/**
* Registers a class property with given name for a given class template.
*/
-SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Local<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
- v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
}
/**
* Registers a class method with given name for a given object.
*/
-SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Local<v8::Object> obj, const char* symbol,
const SwigV8FunctionCallback& _func) {
+#if (SWIG_V8_VERSION < 0x0705)
obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+#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
}
/**
* Registers a class method with given name for a given object.
*/
-SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Local<v8::Object> obj, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
#if (V8_MAJOR_VERSION-0) < 5
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
index 8faf2dd8e..450aa9c6d 100644
--- a/Lib/javascript/v8/javascriptinit.swg
+++ b/Lib/javascript/v8/javascriptinit.swg
@@ -70,14 +70,14 @@ extern "C"
#if (NODE_MODULE_VERSION < 0x000C)
void SWIGV8_INIT (v8::Handle<v8::Object> exports)
#else
-void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/)
+void SWIGV8_INIT (v8::Local<v8::Object> exports, v8::Local<v8::Object> /*module*/)
#endif
{
SWIG_InitializeModule(static_cast<void *>(&exports));
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> exports_obj = exports;
+ v8::Local<v8::Object> exports_obj = exports;
%}
diff --git a/Lib/javascript/v8/javascriptprimtypes.swg b/Lib/javascript/v8/javascriptprimtypes.swg
index f76be983b..24f5daf7c 100644
--- a/Lib/javascript/v8/javascriptprimtypes.swg
+++ b/Lib/javascript/v8/javascriptprimtypes.swg
@@ -6,7 +6,7 @@
%fragment(SWIG_From_frag(bool),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value>
+v8::Local<v8::Value>
SWIG_From_dec(bool)(bool value)
{
return SWIGV8_BOOLEAN_NEW(value);
@@ -16,7 +16,7 @@ SWIG_From_dec(bool)(bool value)
%fragment(SWIG_AsVal_frag(bool),"header",
fragment=SWIG_AsVal_frag(long)) {
SWIGINTERN
-int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
+int SWIG_AsVal_dec(bool)(v8::Local<v8::Value> obj, bool *val)
{
if(!obj->IsBoolean()) {
return SWIG_ERROR;
@@ -31,7 +31,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
%fragment(SWIG_From_frag(int),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
+v8::Local<v8::Value> SWIG_From_dec(int)(int value)
{
return SWIGV8_INT32_NEW(value);
}
@@ -39,7 +39,7 @@ v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
%fragment(SWIG_AsVal_frag(int),"header") {
SWIGINTERN
-int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
+int SWIG_AsVal_dec(int)(v8::Local<v8::Value> valRef, int* val)
{
if (!valRef->IsNumber()) {
return SWIG_TypeError;
@@ -54,7 +54,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
%fragment(SWIG_From_frag(long),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
+v8::Local<v8::Value> SWIG_From_dec(long)(long value)
{
return SWIGV8_NUMBER_NEW(value);
}
@@ -63,7 +63,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
%fragment(SWIG_AsVal_frag(long),"header",
fragment="SWIG_CanCastAsInteger") {
SWIGINTERN
-int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
+int SWIG_AsVal_dec(long)(v8::Local<v8::Value> obj, long* val)
{
if (!obj->IsNumber()) {
return SWIG_TypeError;
@@ -79,7 +79,7 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
%fragment(SWIG_From_frag(unsigned long),"header",
fragment=SWIG_From_frag(long)) {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
+v8::Local<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
{
return (value > LONG_MAX) ?
SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
@@ -89,7 +89,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
%fragment(SWIG_AsVal_frag(unsigned long),"header",
fragment="SWIG_CanCastAsInteger") {
SWIGINTERN
-int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
+int SWIG_AsVal_dec(unsigned long)(v8::Local<v8::Value> obj, unsigned long *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -115,7 +115,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
+v8::Local<v8::Value> SWIG_From_dec(long long)(long long value)
{
return SWIGV8_NUMBER_NEW(value);
}
@@ -128,7 +128,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN
-int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
+int SWIG_AsVal_dec(long long)(v8::Local<v8::Value> obj, long long* val)
{
if (!obj->IsNumber()) {
return SWIG_TypeError;
@@ -148,7 +148,7 @@ int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
+v8::Local<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
{
return (value > LONG_MAX) ?
SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
@@ -162,7 +162,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN
-int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long long *val)
+int SWIG_AsVal_dec(unsigned long long)(v8::Local<v8::Value> obj, unsigned long long *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -185,7 +185,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
%fragment(SWIG_From_frag(double),"header") {
SWIGINTERN
-v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
+v8::Local<v8::Value> SWIG_From_dec(double) (double val)
{
return SWIGV8_NUMBER_NEW(val);
}
@@ -193,7 +193,7 @@ v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
%fragment(SWIG_AsVal_frag(double),"header") {
SWIGINTERN
-int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
+int SWIG_AsVal_dec(double)(v8::Local<v8::Value> obj, double *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 2452f4040..78e7ea018 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -10,7 +10,11 @@
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
#else
+#if (SWIG_V8_VERSION < 0x0706)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
+#else
+#define SWIGV8_STRING_NEW2(cstr, len) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len)).ToLocalChecked()
+#endif
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
@@ -47,12 +51,18 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
#define SWIGV8_STRING_NEW(str) v8::String::New(str)
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
+#else
+#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
+#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
+#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
+#define SWIGV8_STRING_NEW(str) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)).ToLocalChecked()
+#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)).ToLocalChecked()
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
@@ -107,7 +117,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
@@ -115,6 +125,14 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
+#else
+#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
+#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
+#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(v8::Isolate::GetCurrent())
+#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
+#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
#endif
/* ---------------------------------------------------------------------------
@@ -163,7 +181,7 @@ public:
SWIGV8_THROW_EXCEPTION(err);
}
}
- v8::Handle<v8::Value> err;
+ v8::Local<v8::Value> err;
};
/* ---------------------------------------------------------------------------
@@ -228,13 +246,13 @@ public:
SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
-SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Local<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE();
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
+ v8::Local<v8::Value> cdataRef = objRef->GetInternalField(0);
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
#else
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
@@ -280,11 +298,11 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Prox
delete proxy;
}
-SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
+SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Local<v8::Value> valRef, void **ptr) {
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
@@ -304,7 +322,7 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
return SWIG_OK;
}
-SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Local<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
cdata->swigCObject = ptr;
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
@@ -361,13 +379,15 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
cdata->handle.MarkIndependent();
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
cdata->handle.MarkIndependent();
+// Looks like future versions do not require that anymore:
+// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
#endif
}
-SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Local<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE();
/* special case: JavaScript null => C NULL pointer */
@@ -378,14 +398,14 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
}
-SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME v8::Local<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE_ESC();
- v8::Handle<v8::FunctionTemplate> class_templ;
+ v8::Local<v8::FunctionTemplate> class_templ;
if (ptr == NULL) {
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
@@ -412,8 +432,11 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
}
#endif
-// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+#if (SWIG_V8_VERSION < 0x0705)
v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+#else
+ v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+#endif
SWIGV8_SetPrivateData(result, ptr, info, flags);
SWIGV8_ESCAPE(result);
@@ -433,7 +456,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
void *arg1 = (void *) 0 ;
void *arg2 = (void *) 0 ;
bool result;
@@ -463,7 +486,7 @@ fail:
SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
void *arg1 = (void *) 0 ;
long result;
int res1;
@@ -502,10 +525,10 @@ public:
};
SWIGRUNTIMEINLINE
-int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
+int SwigV8Packed_Check(v8::Local<v8::Value> valRef) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return false;
#if (V8_MAJOR_VERSION-0) < 5
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
@@ -519,13 +542,13 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
}
SWIGRUNTIME
-swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
+swig_type_info *SwigV8Packed_UnpackData(v8::Local<v8::Value> valRef, void *ptr, size_t size) {
if (SwigV8Packed_Check(valRef)) {
SWIGV8_HANDLESCOPE();
SwigV8PackedData *sobj;
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
@@ -542,7 +565,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
}
SWIGRUNTIME
-int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
+int SWIGV8_ConvertPacked(v8::Local<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
if (!to) return SWIG_ERROR;
if (ty) {
@@ -590,7 +613,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8
}
SWIGRUNTIME
-v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
+v8::Local<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
SWIGV8_HANDLESCOPE_ESC();
SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
@@ -636,8 +659,10 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
cdata->handle.MarkIndependent();
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
cdata->handle.MarkIndependent();
+// Looks like future versions do not require that anymore:
+// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
#endif
SWIGV8_ESCAPE(obj);
@@ -657,7 +682,7 @@ SWIGRUNTIME
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
#else
-v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
+v8::Local<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Local<v8::Value> obj) {
#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
+++ b/Lib/javascript/v8/javascriptruntime.swg
@@ -56,6 +56,10 @@
%insert(runtime) %{
#include <v8.h>
+#if defined(V8_MAJOR_VERSION) && defined(V8_MINOR_VERSION)
+#define SWIG_V8_VERSION (V8_MAJOR_VERSION * 256 + V8_MINOR_VERSION)
+#endif
+
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg
index e767a6d66..61a937fa5 100644
--- a/Lib/javascript/v8/javascriptstrings.swg
+++ b/Lib/javascript/v8/javascriptstrings.swg
@@ -4,10 +4,10 @@
* ------------------------------------------------------------ */
%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") {
SWIGINTERN int
-SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
+SWIG_AsCharPtrAndSize(v8::Local<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
{
if(valRef->IsString()) {
- v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
+ v8::Local<v8::String> js_str = SWIGV8_TO_STRING(valRef);
size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
char* cstr = new char[len];
@@ -20,7 +20,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
return SWIG_OK;
} else {
if(valRef->IsObject()) {
- v8::Handle<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
// try if the object is a wrapped char[]
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
@@ -41,7 +41,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
}
%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
-SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIGINTERNINLINE v8::Local<v8::Value>
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
if (carray) {
@@ -49,7 +49,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
// TODO: handle extra long strings
return SWIGV8_UNDEFINED();
} else {
- v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
+ v8::Local<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
return js_str;
}
} else {
diff --git a/Lib/javascript/v8/javascripttypemaps.swg b/Lib/javascript/v8/javascripttypemaps.swg
index 4601698e0..fbe7849cd 100644
--- a/Lib/javascript/v8/javascripttypemaps.swg
+++ b/Lib/javascript/v8/javascripttypemaps.swg
@@ -25,7 +25,7 @@
/* Javascript types */
-#define SWIG_Object v8::Handle<v8::Value>
+#define SWIG_Object v8::Local<v8::Value>
#define VOID_Object SWIGV8_UNDEFINED()
/* Overload of the output/constant/exception/dirout handling */
--
2.20.1

View File

@ -1,325 +0,0 @@
From f08d7a63a92a3ba89d97bdfcc206e1e1c4804c0f Mon Sep 17 00:00:00 2001
From: Patrick Schneider <patrick.schneider@meetnow.eu>
Date: Thu, 13 Apr 2017 15:02:53 +0200
Subject: [PATCH 1/2] Add Node 7.x aka V8 5.2+ support
* Use WeakCallbackInfo instead of WeakCallbackData
* Use GetPrivate instead of GetHiddenValue
* Adopted new signature for SetWeak to support destructor calling
* SetAccessor deprecation fixed
* Proper version checks where applicable
---
Lib/javascript/v8/javascriptcode.swg | 27 +++++++++++++++++-----
Lib/javascript/v8/javascripthelpers.swg | 29 +++++++++++++++++++++---
Lib/javascript/v8/javascriptinit.swg | 16 +++++++++++--
Lib/javascript/v8/javascriptrun.swg | 40 ++++++++++++++++++++++++++++-----
4 files changed, 95 insertions(+), 17 deletions(-)
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index fb7d55c2ad..b8c5089816 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -133,10 +133,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
+#else
+ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
@@ -147,7 +150,9 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
}
delete proxy;
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
object.Clear();
+#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
object.Dispose();
@@ -155,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
object.Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
object->Dispose(isolate);
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
object->Dispose();
#endif
}
@@ -177,10 +182,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
+#else
+static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
@@ -197,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
object.Clear();
#endif
}
@@ -211,7 +219,11 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
* ----------------------------------------------------------------------------- */
%fragment("js_getter", "templates")
%{
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+#else
+static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
+#endif
SWIGV8_HANDLESCOPE();
v8::Handle<v8::Value> jsresult;
@@ -233,8 +245,11 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("js_setter", "templates")
%{
-static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value,
- const SwigV8PropertyCallbackInfoVoid &info) {
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
+#else
+static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
+#endif
SWIGV8_HANDLESCOPE();
$jslocals
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index 091467df4d..74610793af 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -6,11 +6,16 @@ typedef v8::InvocationCallback SwigV8FunctionCallback;
typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
typedef v8::FunctionCallback SwigV8FunctionCallback;
typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
+#else
+typedef v8::FunctionCallback SwigV8FunctionCallback;
+typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback;
+typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback;
+typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
#endif
/**
@@ -65,18 +70,36 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char
*/
SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+#else
+ obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+#endif
}
-SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
- const SwigV8PropertyCallbackInfoVoid& info)
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
+#else
+SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
+#endif
{
char buffer[256];
char msg[512];
int res;
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
property->WriteUtf8(buffer, 256);
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+#else
+ v8::Local<v8::String> sproperty;
+ if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
+ sproperty->WriteUtf8(buffer, 256);
+ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+ }
+ else {
+ res = -1;
+ }
+#endif
if(res<0) {
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
index 34befa7ce7..86008d927f 100644
--- a/Lib/javascript/v8/javascriptinit.swg
+++ b/Lib/javascript/v8/javascriptinit.swg
@@ -7,15 +7,27 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module);
assert(!mod.IsEmpty());
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod);
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
+ global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod);
+#endif
}
SWIGRUNTIME swig_module_info *
SWIG_V8_GetModule(void *) {
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"));
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
+ v8::Local<v8::Value> moduleinfo;
+ if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo))
+ return 0;
+#endif
- if (moduleinfo.IsEmpty())
+ if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined())
{
// It's not yet loaded
return 0;
@@ -23,7 +35,7 @@ SWIG_V8_GetModule(void *) {
v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo);
- if (moduleinfo_extern.IsEmpty())
+ if (moduleinfo_extern.IsEmpty() || moduleinfo_extern->IsNull() || moduleinfo_extern->IsUndefined())
{
// Something's not right
return 0;
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 5ac52a51dc..30002c02a3 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -193,8 +193,10 @@ public:
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
+#else
+ void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
#endif
};
@@ -241,9 +243,12 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
+#else
+SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
#endif
delete proxy;
@@ -312,12 +317,18 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
} else {
cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
}
-#else
+#elifif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
} else {
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
}
+#else
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter);
+ } else {
+ cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter);
+ }
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
@@ -470,7 +481,14 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
v8::Handle<v8::Object> objRef = valRef->ToObject();
if(objRef->InternalFieldCount() < 1) return false;
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
+ v8::Local<v8::Value> flag;
+ if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
+ return false;
+#endif
return (flag->IsBoolean() && flag->BooleanValue());
}
@@ -519,10 +537,13 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist
SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
v8::Local<v8::Object> object = data.GetValue();
SwigV8PackedData *cdata = data.GetParameter();
+#else
+SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) {
+ SwigV8PackedData *cdata = data.GetParameter();
#endif
delete cdata;
@@ -537,7 +558,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Ob
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
object.Clear();
#endif
}
@@ -550,7 +571,12 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
+#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
+ obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true));
+#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
obj->SetPointerInInternalField(0, cdata);
@@ -573,9 +599,11 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
-#else
+#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
+#else
+ cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter);
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)

View File

@ -1,217 +0,0 @@
From 9ce8d7e7c99e75163318428aeff6e60d398fcdca Mon Sep 17 00:00:00 2001
From: Patrick Schneider <patrick.schneider@meetnow.eu>
Date: Thu, 13 Apr 2017 19:39:44 +0200
Subject: [PATCH 2/2] Remove warnings on Node 6.x aka V8 5.0 and 5.1
The proposed changes targetted at 5.2 (or 5.4 to be more precise, since there is no Node release with V8 5.2 or 5.3) work for lower versions as well and bust the deprecation warnings there.
---
Lib/javascript/v8/javascriptcode.swg | 14 +++++++-------
Lib/javascript/v8/javascripthelpers.swg | 8 ++++----
Lib/javascript/v8/javascriptinit.swg | 4 ++--
Lib/javascript/v8/javascriptrun.swg | 16 ++++++++--------
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index b8c5089816..c4aaf3db0c 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -133,7 +133,7 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
@@ -150,7 +150,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
}
delete proxy;
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
@@ -160,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
object.Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
object->Dispose();
#endif
}
@@ -182,7 +182,7 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
@@ -205,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
}
@@ -219,7 +219,7 @@ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
* ----------------------------------------------------------------------------- */
%fragment("js_getter", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
#else
static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
@@ -245,7 +245,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("js_setter", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
#else
static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index 74610793af..7b8a5ec237 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -6,7 +6,7 @@ typedef v8::InvocationCallback SwigV8FunctionCallback;
typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
typedef v8::FunctionCallback SwigV8FunctionCallback;
typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
@@ -70,14 +70,14 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char
*/
SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
#else
obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
#endif
}
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
#else
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
@@ -87,7 +87,7 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8
char msg[512];
int res;
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
property->WriteUtf8(buffer, 256);
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
#else
diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
index 86008d927f..e83f478d9d 100644
--- a/Lib/javascript/v8/javascriptinit.swg
+++ b/Lib/javascript/v8/javascriptinit.swg
@@ -7,7 +7,7 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module);
assert(!mod.IsEmpty());
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod);
#else
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
@@ -18,7 +18,7 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
SWIGRUNTIME swig_module_info *
SWIG_V8_GetModule(void *) {
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"));
#else
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 30002c02a3..0af9f4eb0a 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -193,7 +193,7 @@ public:
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
#else
void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
@@ -243,7 +243,7 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
#else
@@ -317,7 +317,7 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
} else {
cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
}
-#elifif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
} else {
@@ -481,7 +481,7 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
v8::Handle<v8::Object> objRef = valRef->ToObject();
if(objRef->InternalFieldCount() < 1) return false;
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
#else
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
@@ -537,7 +537,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist
SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
v8::Local<v8::Object> object = data.GetValue();
SwigV8PackedData *cdata = data.GetParameter();
@@ -558,7 +558,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
}
@@ -571,7 +571,7 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
-#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#if (V8_MAJOR_VERSION-0) < 5
obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
#else
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
@@ -599,7 +599,7 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
-#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+#elif (V8_MAJOR_VERSION-0) < 5
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
#else

View File

@ -1,26 +0,0 @@
From db9822788e183b79457d6bedab8b9a5cabb4cd5e Mon Sep 17 00:00:00 2001
From: Christian Kellner <christian@kellner.me>
Date: Fri, 12 Jul 2019 18:33:29 +0200
Subject: [PATCH] Use PyObject_GC_UnTrack in lieu of the old variant
The _PyObject_GC_UNTRACK[1] macro got deprecated in 3.6 and finally
removed in 3.8. Therefore use PyObject_GC_UnTrack instead.
[1] https://docs.python.org/3/c-api/gcsupport.html#c._PyObject_GC_UNTRACK
---
Lib/python/builtin.swg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg
index 5062a8b424..28051e67b9 100644
--- a/Lib/python/builtin.swg
+++ b/Lib/python/builtin.swg
@@ -117,7 +117,7 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure)
SWIGINTERN void
SwigPyStaticVar_dealloc(PyDescrObject *descr) {
- _PyObject_GC_UNTRACK(descr);
+ PyObject_GC_UnTrack(descr);
Py_XDECREF(PyDescr_TYPE(descr));
Py_XDECREF(PyDescr_NAME(descr));
PyObject_GC_Del(descr);

View File

@ -53,27 +53,6 @@ nodejs:
prep_11: '/usr/bin/wget.exe https://nodejs.org/dist/v11.15.0/node-v11.15.0-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_NODE_DIR -tzip -aoa node-v11.15.0-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v11.15.0-win-x64/:$PATH'
prep_12: '/usr/bin/wget.exe https://nodejs.org/dist/v12.14.1/node-v12.14.1-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_NODE_DIR -tzip -aoa node-v12.14.1-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v12.14.1-win-x64/:$PATH'
prep_13: '/usr/bin/wget.exe https://nodejs.org/dist/v13.6.0/node-v13.6.0-win-x64.zip && ""C:\Program Files\7-zip\7z.exe"" x -o$TASKCLUSTER_NODE_DIR -tzip -aoa node-v13.6.0-win-x64.zip && rm node-*.zip && export PATH=$TASKCLUSTER_TASK_DIR/bin/node-v13.6.0-win-x64/:$PATH'
## swig -javascript requires swig >= 3.0.7 (14.04 provides 2.0.11)
## force 3.0.10 for nodejs V8 API compatibility
swig:
packages:
install_script: 'wget http://mirrors.kernel.org/ubuntu/pool/universe/s/swig/swig_3.0.12-1_amd64.deb -O /tmp/swig_3.0.12-1_amd64.deb && wget http://mirrors.kernel.org/ubuntu/pool/universe/s/swig/swig3.0_3.0.12-1_amd64.deb -O /tmp/swig3.0_3.0.12-1_amd64.deb && dpkg -i /tmp/swig_3.0.12-1_amd64.deb /tmp/swig3.0_3.0.12-1_amd64.deb'
patch_nodejs:
linux: '(for patch_file in /home/build-user/DeepSpeech/ds/native_client/swig_node_v7x-v8x-v9x_*.patch /home/build-user/DeepSpeech/ds/native_client/swig_node_v10.12.patch /home/build-user/DeepSpeech/ds/native_client/swig_node_v12_*.patch /home/build-user/DeepSpeech/ds/native_client/swig_py38_untrack.patch ; do patch -d /usr/share/swig3.0/ -p2 < $patch_file; done)'
# Test if we can reverse patch #2:
# - if yes, likely we are in a good state, patch _0001 and _0002 have
# been applied
# - if no, then we need to apply both
#
# We cannot test reverse patch of _0002 AND of_0001 since testing reverse
# 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-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)'
cpp:
brew:
setup: 'install_local_homebrew "cpp-ds-test"'
@ -81,6 +60,13 @@ cpp:
env: 'export EXTRA_ENV="DYLD_LIBRARY_PATH=$LOCAL_HOMEBREW_DIRECTORY/lib/:$DYLD_LIBRARY_PATH"'
system:
node_gyp_cache: 'https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.node-gyp-cache.0/artifacts/public/node-gyp-cache.tar.gz'
swig:
repo: "https://github.com/lissyx/swig"
sha1: "04baa423c41008712e811cd5c1ee94e9e90894aa"
cache:
linux_amd64: 'https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.linux.amd64.04baa423c41008712e811cd5c1ee94e9e90894aa/artifacts/public/ds-swig.tar.gz'
darwin_amd64: 'https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.darwin.amd64.04baa423c41008712e811cd5c1ee94e9e90894aa/artifacts/public/ds-swig.tar.gz'
win_amd64: 'https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.win.amd64.04baa423c41008712e811cd5c1ee94e9e90894aa/artifacts/public/ds-swig.tar.gz'
username: 'build-user'
homedir:
linux: '/home/build-user'

View File

@ -1,17 +1,13 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.android-arm64"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.android-arm64"
- "index.project.deepspeech.deepspeech.native_client.android-arm64.${event.head.sha}"
- "notify.irc-channel.${notifications.irc}.on-exception"
- "notify.irc-channel.${notifications.irc}.on-failed"
system_setup:
>
${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.android-arm64/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/android-build.sh arm64-v8a"

View File

@ -1,17 +1,13 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.android-armv7"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.android-armv7"
- "index.project.deepspeech.deepspeech.native_client.android-armv7.${event.head.sha}"
- "notify.irc-channel.${notifications.irc}.on-exception"
- "notify.irc-channel.${notifications.irc}.on-failed"
system_setup:
>
${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.android-armv7/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/android-build.sh armeabi-v7a"

View File

@ -12,7 +12,7 @@ build:
- "android-x86_64-cpu-opt"
system_setup:
>
apt-get -qq -y install curl && ${swig.packages.install_script}
apt-get -qq -y install curl
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.android-armv7/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/android-apk-build.sh"

View File

@ -1,17 +1,13 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.android-x86_64"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.android-x86_64"
- "index.project.deepspeech.deepspeech.native_client.android-x86_64.${event.head.sha}"
- "notify.irc-channel.${notifications.irc}.on-exception"
- "notify.irc-channel.${notifications.irc}.on-failed"
system_setup:
>
${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.android-arm64/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/android-build.sh x86_64"

View File

@ -1,5 +1,7 @@
build:
template_file: darwin-opt-base.tyml
dependencies:
- "swig-darwin-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.osx"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.osx"

View File

@ -1,5 +1,7 @@
build:
template_file: darwin-opt-base.tyml
dependencies:
- "swig-darwin-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.osx-ctc"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.osx-ctc"

View File

@ -1,5 +1,7 @@
build:
template_file: darwin-opt-base.tyml
dependencies:
- "swig-darwin-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.osx-tflite"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.osx-tflite"

View File

@ -99,8 +99,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/homebrew/bin/brew uninstall swig &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.build} &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.package}
@ -112,8 +111,8 @@ payload:
then: { $fromNow: '6 months' }
else: { $fromNow: '7 days' }
# Define node gyp cache mount twice because we cannot have it separated
# from the if/then without the parser to break
# Define node gyp cache and swig mount twice because we cannot have it
# separated from the if/then without the parser to break
mounts:
$if: '(event.event != "push") && (event.event != "tag")'
then:
@ -127,11 +126,19 @@ payload:
format: tar.gz
content:
url: ${system.node_gyp_cache}
- directory: ds-swig
format: tar.gz
content:
url: ${system.swig.cache.darwin_amd64}
else:
- directory: ${system.homedir.osx}/Library/Caches/node-gyp/
format: tar.gz
content:
url: ${system.node_gyp_cache}
- directory: ds-swig
format: tar.gz
content:
url: ${system.swig.cache.darwin_amd64}
metadata:
name: ${build.metadata.name}

View File

@ -1,5 +1,7 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.cpu"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.cpu"
@ -10,10 +12,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.cpu/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/host-build.sh"

View File

@ -1,5 +1,7 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.cpu-ctc"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.cpu-ctc"
@ -10,10 +12,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.cpu/artifacts/public/home.tar.xz"
scripts:
build: 'taskcluster/decoder-build.sh'

View File

@ -1,5 +1,7 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.gpu"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.gpu"
@ -8,10 +10,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.gpu/artifacts/public/home.tar.xz"
maxRunTime: 14400
scripts:

View File

@ -1,5 +1,7 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.tflite"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.tflite"
@ -10,10 +12,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.cpu/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/host-build.sh tflite"

View File

@ -1,5 +1,7 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.arm64"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.arm64"
@ -13,11 +15,10 @@ build:
echo "y" | gdebi /tmp/multistrap_2.2.0ubuntu2_all.deb &&
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
apt-get -qq -y install ${python.packages_trusty.apt}
system_config:
>
multistrap -d /tmp/multistrap-armbian64-buster/ -f ${system.homedir.linux}/DeepSpeech/ds/native_client/multistrap_armbian64_buster.conf &&
${swig.patch_nodejs.linux}
multistrap -d /tmp/multistrap-armbian64-buster/ -f ${system.homedir.linux}/DeepSpeech/ds/native_client/multistrap_armbian64_buster.conf
scripts:
build: "taskcluster/arm64-build.sh"
package: "taskcluster/package.sh"

View File

@ -45,10 +45,10 @@ then:
in: >
apt-get -qq -y remove --purge ubuntu-advantage-tools &&
${aptEc2Mirrors} &&
apt-get -qq update && apt-get -qq -y install git pixz wget pkg-config libsox-dev && ${extraSystemSetup} &&
adduser --system --home ${system.homedir.linux} ${system.username} &&
apt-get -qq update && apt-get -qq -y install git pixz wget pkg-config libsox-dev && ${extraSystemSetup} &&
cd ${system.homedir.linux}/ &&
echo -e "#!/bin/bash\nset -xe\n env && id && (wget -O - $TENSORFLOW_BUILD_ARTIFACT | pixz -d | tar -C ${system.homedir.linux}/ -xf - ) && git clone --quiet ${event.head.repo.url} ~/DeepSpeech/ds/ && cd ~/DeepSpeech/ds && git checkout --quiet ${event.head.sha} && ln -s ~/DeepSpeech/ds/native_client/ ~/DeepSpeech/tf/native_client && mkdir -p ${system.homedir.linux}/.cache/node-gyp/ && wget -O - ${system.node_gyp_cache} | tar -C ${system.homedir.linux}/.cache/node-gyp/ -xzf -" > /tmp/clone.sh && chmod +x /tmp/clone.sh &&
echo -e "#!/bin/bash\nset -xe\n env && id && (wget -O - $TENSORFLOW_BUILD_ARTIFACT | pixz -d | tar -C ${system.homedir.linux}/ -xf - ) && git clone --quiet ${event.head.repo.url} ~/DeepSpeech/ds/ && cd ~/DeepSpeech/ds && git checkout --quiet ${event.head.sha} && ln -s ~/DeepSpeech/ds/native_client/ ~/DeepSpeech/tf/native_client && mkdir -p ${system.homedir.linux}/.cache/node-gyp/ && wget -O - ${system.node_gyp_cache} | tar -C ${system.homedir.linux}/.cache/node-gyp/ -xzf - && mkdir -p ${system.homedir.linux}/ds-swig/bin/ && wget -O - ${system.swig.cache.linux_amd64} | tar -C ${system.homedir.linux}/ds-swig/ -xzf -" > /tmp/clone.sh && chmod +x /tmp/clone.sh &&
sudo -H -u ${system.username} /bin/bash /tmp/clone.sh &&
${system.homedir.linux}/DeepSpeech/tf/tc-apt.sh && ${extraSystemConfig} &&
sudo -H -u ${system.username} --preserve-env /bin/bash ${system.homedir.linux}/DeepSpeech/ds/${build.scripts.build} &&

View File

@ -1,5 +1,7 @@
build:
template_file: linux-opt-base.tyml
dependencies:
- "swig-linux-amd64"
routes:
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.arm"
- "index.project.deepspeech.deepspeech.native_client.${event.head.branchortag}.${event.head.sha}.arm"
@ -13,11 +15,10 @@ build:
echo "y" | gdebi /tmp/multistrap_2.2.0ubuntu2_all.deb &&
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
apt-get -qq -y install ${python.packages_trusty.apt}
system_config:
>
multistrap -d /tmp/multistrap-raspbian-buster/ -f ${system.homedir.linux}/DeepSpeech/ds/native_client/multistrap_raspbian_buster.conf &&
${swig.patch_nodejs.linux}
multistrap -d /tmp/multistrap-raspbian-buster/ -f ${system.homedir.linux}/DeepSpeech/ds/native_client/multistrap_raspbian_buster.conf
scripts:
build: "taskcluster/rpi3-build.sh"
package: "taskcluster/package.sh"

View File

@ -13,10 +13,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.cpu/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/node-build.sh"

View File

@ -10,10 +10,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.cpu/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/node-build.sh --cuda"

View File

@ -11,10 +11,7 @@ build:
>
${nodejs.packages_trusty.prep_12} && ${nodejs.packages_trusty.apt_pinning}
&& apt-get -qq update && apt-get -qq -y install nodejs python-yaml &&
apt-get -qq -y install ${python.packages_trusty.apt} && ${swig.packages.install_script}
system_config:
>
${swig.patch_nodejs.linux}
apt-get -qq -y install ${python.packages_trusty.apt}
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.cpu/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/node-build.sh --tflite"

View File

@ -0,0 +1,10 @@
build:
template_file: swig-darwin-opt-base.tyml
swig_system: "darwin"
swig_arch: "amd64"
scripts:
build: "taskcluster/build.sh"
package: "taskcluster/package.sh"
metadata:
name: "SWIG macOS AMD64"
description: "Building SWIG for macOS/AMD64"

View File

@ -0,0 +1,51 @@
taskId: ${taskcluster.taskId}
provisionerId: ${taskcluster.generic.provisionerId}
workerType: ${taskcluster.generic.workerType}
taskGroupId: ${taskcluster.taskGroupId}
schedulerId: ${taskcluster.schedulerId}
dependencies:
$map: { $eval: build.dependencies }
each(b):
$eval: as_slugid(b)
created: { $fromNow: '0 sec' }
deadline: { $fromNow: '1 day' }
expires: { $fromNow: '6 months' }
routes:
- "index.project.deepspeech.swig.${build.swig_system}.${build.swig_arch}.${system.swig.sha1}"
payload:
maxRunTime: { $eval: to_int(build.maxRunTime) }
command:
- - "/bin/bash"
- "--login"
- "-cxe"
- >
export TASKCLUSTER_ARTIFACTS="$(pwd)/public/" &&
export TASKCLUSTER_TASKDIR="$(pwd)" &&
export TASKCLUSTER_ORIG_TASKDIR="$(pwd)" &&
export LC_ALL=C &&
export MACOSX_DEPLOYMENT_TARGET=10.10 &&
export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/ &&
export HOMEBREW_NO_AUTO_UPDATE=1 &&
env &&
swig_bin=`curl -sSIL -o /dev/null -w "%{http_code}" https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.${build.swig_system}.${build.swig_arch}.${system.swig.sha1}/artifacts/public/ds-swig.tar.gz` &&
if [ "$swig_bin" != "200" ]; then
git clone --quiet ${system.swig.repo} $TASKCLUSTER_TASKDIR/swig/ &&
cd $TASKCLUSTER_TASKDIR/swig/ && git checkout --quiet ${system.swig.sha1} &&
$TASKCLUSTER_TASKDIR/swig/${build.scripts.build} &&
$TASKCLUSTER_TASKDIR/swig/${build.scripts.package}
else
mkdir -p $TASKCLUSTER_ARTIFACTS/ && curl -sSL -o $TASKCLUSTER_ARTIFACTS/ds-swig.tar.gz https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.${build.swig_system}.${build.swig_arch}.${system.swig.sha1}/artifacts/public/ds-swig.tar.gz
fi;
artifacts:
- type: "directory"
path: "public/"
expires: { $fromNow: '6 months' }
metadata:
name: ${build.metadata.name}
description: ${build.metadata.description}
owner: ${event.head.user.email}
source: ${event.head.repo.url}

View File

@ -0,0 +1,14 @@
build:
template_file: swig-linux-opt-base.tyml
docker_image: "ubuntu:14.04"
swig_system: "linux"
swig_arch: "amd64"
system_setup:
>
apt-get -qq -y install autoconf automake bison build-essential
scripts:
build: "taskcluster/build.sh"
package: "taskcluster/package.sh"
metadata:
name: "SWIG Linux AMD64"
description: "Building SWIG for Linux/AMD64"

View File

@ -0,0 +1,49 @@
$if: 'event.event in build.allowed'
then:
taskId: ${taskcluster.taskId}
provisionerId: ${taskcluster.docker.provisionerId}
workerType: ${taskcluster.docker.workerType}
taskGroupId: ${taskcluster.taskGroupId}
schedulerId: ${taskcluster.schedulerId}
created: { $fromNow: '0 sec' }
deadline: { $fromNow: '1 day' }
expires: { $fromNow: '6 months' }
routes:
- "index.project.deepspeech.swig.${build.swig_system}.${build.swig_arch}.${system.swig.sha1}"
payload:
maxRunTime: { $eval: to_int(build.maxRunTime) }
image: ${build.docker_image}
command:
- "/bin/bash"
- "--login"
- "-cxe"
- $let:
extraSystemSetup: { $eval: strip(str(build.system_setup)) }
extraSystemConfig: { $eval: strip(str(build.system_config)) }
in: >
(apt-get -qq -y remove --purge ubuntu-advantage-tools || true) &&
apt-get -qq update && apt-get -qq -y install curl git && ${extraSystemSetup};
swig_bin=`curl -sSIL -o /dev/null -w "%{http_code}" https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.${build.swig_system}.${build.swig_arch}.${system.swig.sha1}/artifacts/public/ds-swig.tar.gz` &&
if [ "$swig_bin" != "200" ]; then
adduser --system --home ${system.homedir.linux} ${system.username} && cd ${system.homedir.linux}/ &&
echo -e "#!/bin/bash\nset -xe\n env && id && (git clone --quiet ${system.swig.repo} ~/swig/ && cd ~/swig/ && git checkout --quiet ${system.swig.sha1})" > /tmp/clone.sh && chmod +x /tmp/clone.sh &&
sudo -H -u ${system.username} /bin/bash /tmp/clone.sh &&
sudo -H -u ${system.username} --preserve-env /bin/bash ${system.homedir.linux}/swig/${build.scripts.build} &&
sudo -H -u ${system.username} /bin/bash ${system.homedir.linux}/swig/${build.scripts.package}
else
mkdir -p /tmp/artifacts/ && curl -sSL -o /tmp/artifacts/ds-swig.tar.gz https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.swig.${build.swig_system}.${build.swig_arch}.${system.swig.sha1}/artifacts/public/ds-swig.tar.gz
fi;
artifacts:
"public":
type: "directory"
path: "/tmp/artifacts/"
expires: { $fromNow: '6 months' }
metadata:
name: ${build.metadata.name}
description: ${build.metadata.description}
owner: ${event.head.user.email}
source: ${event.head.repo.url}

View File

@ -0,0 +1,15 @@
build:
template_file: swig-linux-opt-base.tyml
docker_image: "ubuntu:18.04"
swig_system: "win"
swig_arch: "amd64"
system_setup:
>
apt-get -qq -y install autoconf automake bison build-essential mingw-w64 &&
(apt-get -qq -y install sudo || true)
scripts:
build: "taskcluster/build.sh x86_64-w64-mingw32"
package: "taskcluster/package.sh"
metadata:
name: "SWIG Windows AMD64"
description: "Building SWIG for Windows/AMD64"

View File

@ -5,16 +5,18 @@ set -xe
export OS=$(uname)
if [ "${OS}" = "Linux" ]; then
export DS_ROOT_TASK=${HOME}
export SWIG_ROOT="${HOME}/ds-swig"
fi;
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
export DS_ROOT_TASK=${TASKCLUSTER_TASK_DIR}
export SWIG_ROOT="$(cygpath ${USERPROFILE})/ds-swig"
export PLATFORM_EXE_SUFFIX=.exe
fi;
if [ "${OS}" = "Darwin" ]; then
export SWIG_ROOT="${TASKCLUSTER_ORIG_TASKDIR}/ds-swig"
export DS_ROOT_TASK=${TASKCLUSTER_TASK_DIR}
export SWIG_LIB="$(find ${DS_ROOT_TASK}/homebrew/Cellar/swig/ -type f -name "swig.swg" | xargs dirname)"
# It seems chaining |export DYLD_LIBRARY_PATH=...| does not work, maybe
# because of SIP? Who knows ...
@ -23,6 +25,19 @@ if [ "${OS}" = "Darwin" ]; then
fi;
fi;
SWIG_BIN=swig${PLATFORM_EXE_SUFFIX}
DS_SWIG_BIN=ds-swig${PLATFORM_EXE_SUFFIX}
if [ -f "${SWIG_ROOT}/bin/${DS_SWIG_BIN}" ]; then
export PATH=${SWIG_ROOT}/bin/:$PATH
export SWIG_LIB="$(find ${SWIG_ROOT}/share/swig/ -type f -name "swig.swg" | xargs dirname)"
# Make an alias to be more magic
if [ ! -L "${SWIG_ROOT}/bin/${SWIG_BIN}" ]; then
ln -s ${DS_SWIG_BIN} ${SWIG_ROOT}/bin/${SWIG_BIN}
fi;
swig -version
swig -swiglib
fi;
export TASKCLUSTER_ARTIFACTS=${TASKCLUSTER_ARTIFACTS:-/tmp/artifacts}
export TASKCLUSTER_TMP_DIR=${TASKCLUSTER_TMP_DIR:-/tmp}

View File

@ -52,7 +52,7 @@ then:
${extraSystemSetup} &&
adduser --system --home ${system.homedir.linux} ${system.username} &&
cd ${system.homedir.linux} &&
echo -e "#!/bin/bash\nset -xe\n env && id && mkdir ~/DeepSpeech/ && git clone --quiet ${event.head.repo.url} ~/DeepSpeech/ds/ && cd ~/DeepSpeech/ds && git checkout --quiet ${event.head.sha}" > /tmp/clone.sh && chmod +x /tmp/clone.sh &&
echo -e "#!/bin/bash\nset -xe\n env && id && mkdir ~/DeepSpeech/ && git clone --quiet ${event.head.repo.url} ~/DeepSpeech/ds/ && cd ~/DeepSpeech/ds && git checkout --quiet ${event.head.sha} && mkdir -p ${system.homedir.linux}/ds-swig/bin/ && wget -O - ${system.swig.cache.linux_amd64} | tar -C ${system.homedir.linux}/ds-swig/ -xzf -" > /tmp/clone.sh && chmod +x /tmp/clone.sh &&
sudo -H -u ${system.username} /bin/bash /tmp/clone.sh &&
sudo -H -u ${system.username} --preserve-env /bin/bash ${build.args.tests_cmdline}

View File

@ -1,12 +1,13 @@
build:
template_file: test-android-opt-base.tyml
dependencies:
- "swig-linux-amd64"
- "android-x86_64-cpu-opt"
- "test-training_16k-linux-amd64-py36m-opt"
test_model_task: "test-training_16k-linux-amd64-py36m-opt"
system_setup:
>
apt-get -qq -y install curl make python && ${swig.packages.install_script}
apt-get -qq -y install curl make python
args:
tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-android-apk-tests.sh x86_64 android-24 16k"
metadata:

View File

@ -1,12 +1,13 @@
build:
template_file: test-android-opt-base.tyml
dependencies:
- "swig-linux-amd64"
- "android-x86_64-cpu-opt"
- "test-training_16k-linux-amd64-py36m-opt"
test_model_task: "test-training_16k-linux-amd64-py36m-opt"
system_setup:
>
apt-get -qq -y install curl make python && ${swig.packages.install_script}
apt-get -qq -y install curl make python
args:
tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-android-apk-tests.sh x86_64 android-25 16k"
metadata:

View File

@ -6,7 +6,7 @@ build:
- "test-training_16k-linux-amd64-py36m-opt"
system_setup:
>
apt-get -qq -y install curl make python && ${swig.packages.install_script}
apt-get -qq -y install curl make python
args:
tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-android-apk-tests.sh x86_64 android-26"
metadata:

View File

@ -6,7 +6,7 @@ build:
- "test-training_16k-linux-amd64-py36m-opt"
system_setup:
>
apt-get -qq -y install curl make python && ${swig.packages.install_script}
apt-get -qq -y install curl make python
args:
tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-android-apk-tests.sh x86_64 android-28"
metadata:

View File

@ -8,6 +8,7 @@ build:
- "notify.irc-channel.${notifications.irc}.on-failed"
dependencies:
- "node-gyp-cache"
- "swig-win-amd64"
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.win/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/win-build.sh"

View File

@ -8,6 +8,7 @@ build:
- "notify.irc-channel.${notifications.irc}.on-failed"
dependencies:
- "node-gyp-cache"
- "swig-win-amd64"
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.win-cuda/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/win-build.sh --cuda"

View File

@ -8,6 +8,7 @@ build:
- "notify.irc-channel.${notifications.irc}.on-failed"
dependencies:
- "node-gyp-cache"
- "swig-win-amd64"
tensorflow: "https://community-tc.services.mozilla.com/api/index/v1/task/project.deepspeech.tensorflow.pip.r1.15.ceb46aae5836a0f648a2c3da5942af2b7d1b98bf.win/artifacts/public/home.tar.xz"
scripts:
build: "taskcluster/win-build.sh --tflite"

View File

@ -38,6 +38,10 @@ payload:
format: tar.gz
content:
url: ${system.node_gyp_cache}
- directory: ds-swig
format: tar.gz
content:
url: ${system.swig.cache.win_amd64}
env:
TC_MSYS_VERSION: 'MSYS_NT-6.3'
@ -70,9 +74,6 @@ payload:
pacman --noconfirm -R bsdtar &&
pacman --noconfirm -S tar make &&
pacman --noconfirm -S zip &&
(pacman --noconfirm -S patch swig &&
(for patch_file in $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_*.patch ; do patch -d /usr/share/swig/*/ -p2 < $patch_file; done)
) &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.build} &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.package} ;
echo \"export TASKCLUSTER_TASK_EXIT_CODE=$?\" > $USERPROFILE/tc-exit.sh &&