From c72cdcb88ed2442b99cbbd0641a3f73542ef3b1c Mon Sep 17 00:00:00 2001 From: zhangbin Date: Mon, 24 Jun 2013 17:00:02 +0800 Subject: [PATCH] Update the JS binding for plugin. --- .../auto/jsb_pluginx_protocols_auto.cpp | 72 +++++++++---------- .../auto/jsb_pluginx_protocols_auto.hpp | 16 ++--- .../auto/jsb_pluginx_protocols_auto_api.js | 6 +- plugin/jsbindings/js/jsb_pluginx.js | 10 +-- .../manual/jsb_pluginx_basic_conversions.cpp | 2 +- .../manual/jsb_pluginx_basic_conversions.h | 4 +- .../jsb_pluginx_extension_registration.cpp | 4 +- .../manual/jsb_pluginx_manual_callback.cpp | 4 +- .../manual/jsb_pluginx_manual_callback.h | 2 +- plugin/protocols/jsb_protocols.ini | 14 ++-- .../HelloAds/proj.android/jni/Application.mk | 1 + .../proj.android/jni/Application.mk | 1 + .../proj.android/jni/Application.mk | 1 + .../proj.android/jni/Application.mk | 1 + .../HelloIAP/proj.android/jni/Application.mk | 1 + .../proj.android/jni/Application.mk | 1 + plugin/tools/tojs/conversions.yaml | 4 +- plugin/tools/tojs/genbindings.sh | 2 +- 18 files changed, 76 insertions(+), 70 deletions(-) diff --git a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp index acf4a9708e..60e8290bc7 100644 --- a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp +++ b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp @@ -6,7 +6,7 @@ using namespace pluginx; #include "ProtocolAnalytics.h" #include "ProtocolIAP.h" #include "ProtocolAds.h" -#include "ProtocolSocial.h" +#include "ProtocolShare.h" template static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) { @@ -970,16 +970,16 @@ void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global) } -JSClass *jsb_ProtocolSocial_class; -JSObject *jsb_ProtocolSocial_prototype; +JSClass *jsb_ProtocolShare_class; +JSObject *jsb_ProtocolShare_prototype; -JSBool js_pluginx_protocols_ProtocolSocial_onShareResult(JSContext *cx, uint32_t argc, jsval *vp) +JSBool js_pluginx_protocols_ProtocolShare_onShareResult(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSBool ok = JS_TRUE; JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL); + cocos2d::plugin::ProtocolShare* cobj = (cocos2d::plugin::ProtocolShare *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 2) { cocos2d::plugin::ShareResultCode arg0; @@ -995,13 +995,13 @@ JSBool js_pluginx_protocols_ProtocolSocial_onShareResult(JSContext *cx, uint32_t JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2); return JS_FALSE; } -JSBool js_pluginx_protocols_ProtocolSocial_share(JSContext *cx, uint32_t argc, jsval *vp) +JSBool js_pluginx_protocols_ProtocolShare_share(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSBool ok = JS_TRUE; JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL); + cocos2d::plugin::ProtocolShare* cobj = (cocos2d::plugin::ProtocolShare *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { TShareInfo arg0; @@ -1015,17 +1015,17 @@ JSBool js_pluginx_protocols_ProtocolSocial_share(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); return JS_FALSE; } -JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp) +JSBool js_pluginx_protocols_ProtocolShare_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSBool ok = JS_TRUE; JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL); + cocos2d::plugin::ProtocolShare* cobj = (cocos2d::plugin::ProtocolShare *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { - TSocialDeveloperInfo arg0; - ok &= jsval_to_TSocialDeveloperInfo(cx, argv[0], &arg0); + TShareDeveloperInfo arg0; + ok &= jsval_to_TShareDeveloperInfo(cx, argv[0], &arg0); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cobj->configDeveloperInfo(arg0); JS_SET_RVAL(cx, vp, JSVAL_VOID); @@ -1039,15 +1039,15 @@ JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, ui extern JSObject *jsb_PluginProtocol_prototype; -void js_pluginx_protocols_ProtocolSocial_finalize(JSFreeOp *fop, JSObject *obj) { - CCLOGINFO("jsbindings: finalizing JS object %p (ProtocolSocial)", obj); +void js_pluginx_protocols_ProtocolShare_finalize(JSFreeOp *fop, JSObject *obj) { + CCLOGINFO("jsbindings: finalizing JS object %p (ProtocolShare)", obj); js_proxy_t* nproxy; js_proxy_t* jsproxy; jsproxy = jsb_get_js_proxy(obj); if (jsproxy) { nproxy = jsb_get_native_proxy(jsproxy->ptr); -// cocos2d::plugin::ProtocolSocial *nobj = static_cast(nproxy->ptr); +// cocos2d::plugin::ProtocolShare *nobj = static_cast(nproxy->ptr); // if (nobj) // delete nobj; @@ -1055,36 +1055,36 @@ void js_pluginx_protocols_ProtocolSocial_finalize(JSFreeOp *fop, JSObject *obj) } } -void js_register_pluginx_protocols_ProtocolSocial(JSContext *cx, JSObject *global) { - jsb_ProtocolSocial_class = (JSClass *)calloc(1, sizeof(JSClass)); - jsb_ProtocolSocial_class->name = "ProtocolSocial"; - jsb_ProtocolSocial_class->addProperty = JS_PropertyStub; - jsb_ProtocolSocial_class->delProperty = JS_PropertyStub; - jsb_ProtocolSocial_class->getProperty = JS_PropertyStub; - jsb_ProtocolSocial_class->setProperty = JS_StrictPropertyStub; - jsb_ProtocolSocial_class->enumerate = JS_EnumerateStub; - jsb_ProtocolSocial_class->resolve = JS_ResolveStub; - jsb_ProtocolSocial_class->convert = JS_ConvertStub; - jsb_ProtocolSocial_class->finalize = js_pluginx_protocols_ProtocolSocial_finalize; - jsb_ProtocolSocial_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); +void js_register_pluginx_protocols_ProtocolShare(JSContext *cx, JSObject *global) { + jsb_ProtocolShare_class = (JSClass *)calloc(1, sizeof(JSClass)); + jsb_ProtocolShare_class->name = "ProtocolShare"; + jsb_ProtocolShare_class->addProperty = JS_PropertyStub; + jsb_ProtocolShare_class->delProperty = JS_PropertyStub; + jsb_ProtocolShare_class->getProperty = JS_PropertyStub; + jsb_ProtocolShare_class->setProperty = JS_StrictPropertyStub; + jsb_ProtocolShare_class->enumerate = JS_EnumerateStub; + jsb_ProtocolShare_class->resolve = JS_ResolveStub; + jsb_ProtocolShare_class->convert = JS_ConvertStub; + jsb_ProtocolShare_class->finalize = js_pluginx_protocols_ProtocolShare_finalize; + jsb_ProtocolShare_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); static JSPropertySpec properties[] = { {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER} }; static JSFunctionSpec funcs[] = { - JS_FN("onShareResult", js_pluginx_protocols_ProtocolSocial_onShareResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("share", js_pluginx_protocols_ProtocolSocial_share, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("configDeveloperInfo", js_pluginx_protocols_ProtocolSocial_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("onShareResult", js_pluginx_protocols_ProtocolShare_onShareResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("share", js_pluginx_protocols_ProtocolShare_share, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("configDeveloperInfo", js_pluginx_protocols_ProtocolShare_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; JSFunctionSpec *st_funcs = NULL; - jsb_ProtocolSocial_prototype = JS_InitClass( + jsb_ProtocolShare_prototype = JS_InitClass( cx, global, jsb_PluginProtocol_prototype, - jsb_ProtocolSocial_class, + jsb_ProtocolShare_class, empty_constructor, 0, properties, funcs, @@ -1092,18 +1092,18 @@ void js_register_pluginx_protocols_ProtocolSocial(JSContext *cx, JSObject *globa st_funcs); // make the class enumerable in the registered namespace JSBool found; - JS_SetPropertyAttributes(cx, global, "ProtocolSocial", JSPROP_ENUMERATE | JSPROP_READONLY, &found); + JS_SetPropertyAttributes(cx, global, "ProtocolShare", JSPROP_ENUMERATE | JSPROP_READONLY, &found); // add the proto and JSClass to the type->js info hash table - TypeTest t; + TypeTest t; js_type_class_t *p; uint32_t typeId = t.s_id(); HASH_FIND_INT(_js_global_type_ht, &typeId, p); if (!p) { p = (js_type_class_t *)malloc(sizeof(js_type_class_t)); p->type = typeId; - p->jsclass = jsb_ProtocolSocial_class; - p->proto = jsb_ProtocolSocial_prototype; + p->jsclass = jsb_ProtocolShare_class; + p->proto = jsb_ProtocolShare_prototype; p->parentProto = jsb_PluginProtocol_prototype; HASH_ADD_INT(_js_global_type_ht, type, p); } @@ -1124,8 +1124,8 @@ void register_all_pluginx_protocols(JSContext* cx, JSObject* obj) { obj = ns; js_register_pluginx_protocols_PluginProtocol(cx, obj); + js_register_pluginx_protocols_ProtocolShare(cx, obj); js_register_pluginx_protocols_ProtocolIAP(cx, obj); - js_register_pluginx_protocols_ProtocolSocial(cx, obj); js_register_pluginx_protocols_ProtocolAnalytics(cx, obj); js_register_pluginx_protocols_ProtocolAds(cx, obj); js_register_pluginx_protocols_PluginManager(cx, obj); diff --git a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.hpp b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.hpp index 2d413a19d2..6c15735955 100644 --- a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.hpp +++ b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.hpp @@ -71,15 +71,15 @@ JSBool js_pluginx_protocols_ProtocolAds_spendPoints(JSContext *cx, uint32_t argc JSBool js_pluginx_protocols_ProtocolAds_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp); JSBool js_pluginx_protocols_ProtocolAds_onPlayerGetPoints(JSContext *cx, uint32_t argc, jsval *vp); -extern JSClass *jsb_ProtocolSocial_class; -extern JSObject *jsb_ProtocolSocial_prototype; +extern JSClass *jsb_ProtocolShare_class; +extern JSObject *jsb_ProtocolShare_prototype; -JSBool js_pluginx_protocols_ProtocolSocial_constructor(JSContext *cx, uint32_t argc, jsval *vp); -void js_pluginx_protocols_ProtocolSocial_finalize(JSContext *cx, JSObject *obj); -void js_register_pluginx_protocols_ProtocolSocial(JSContext *cx, JSObject *global); +JSBool js_pluginx_protocols_ProtocolShare_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_pluginx_protocols_ProtocolShare_finalize(JSContext *cx, JSObject *obj); +void js_register_pluginx_protocols_ProtocolShare(JSContext *cx, JSObject *global); void register_all_pluginx_protocols(JSContext* cx, JSObject* obj); -JSBool js_pluginx_protocols_ProtocolSocial_onShareResult(JSContext *cx, uint32_t argc, jsval *vp); -JSBool js_pluginx_protocols_ProtocolSocial_share(JSContext *cx, uint32_t argc, jsval *vp); -JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp); +JSBool js_pluginx_protocols_ProtocolShare_onShareResult(JSContext *cx, uint32_t argc, jsval *vp); +JSBool js_pluginx_protocols_ProtocolShare_share(JSContext *cx, uint32_t argc, jsval *vp); +JSBool js_pluginx_protocols_ProtocolShare_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp); #endif diff --git a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto_api.js b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto_api.js index 346878d298..bb403dc846 100644 --- a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto_api.js +++ b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto_api.js @@ -199,9 +199,9 @@ onPlayerGetPoints : function () {}, }; /** - * @class ProtocolSocial + * @class ProtocolShare */ -plugin.ProtocolSocial = { +plugin.ProtocolShare = { /** * @method onShareResult @@ -218,7 +218,7 @@ share : function () {}, /** * @method configDeveloperInfo - * @param {TSocialDeveloperInfo} + * @param {TShareDeveloperInfo} */ configDeveloperInfo : function () {}, diff --git a/plugin/jsbindings/js/jsb_pluginx.js b/plugin/jsbindings/js/jsb_pluginx.js index 42bf575205..089ab45456 100644 --- a/plugin/jsbindings/js/jsb_pluginx.js +++ b/plugin/jsbindings/js/jsb_pluginx.js @@ -36,9 +36,9 @@ plugin.ProtocolIAP.PayResultCode.PayFail = 1; plugin.ProtocolIAP.PayResultCode.PayCancel = 2; plugin.ProtocolIAP.PayResultCode.PayTimeOut = 3; -plugin.ProtocolSocial.ShareResultCode = {}; -plugin.ProtocolSocial.ShareResultCode.ShareSuccess = 0; -plugin.ProtocolSocial.ShareResultCode.ShareFail = 1; -plugin.ProtocolSocial.ShareResultCode.ShareCancel = 2; -plugin.ProtocolSocial.ShareResultCode.ShareTimeOut = 3; +plugin.ProtocolShare.ShareResultCode = {}; +plugin.ProtocolShare.ShareResultCode.ShareSuccess = 0; +plugin.ProtocolShare.ShareResultCode.ShareFail = 1; +plugin.ProtocolShare.ShareResultCode.ShareCancel = 2; +plugin.ProtocolShare.ShareResultCode.ShareTimeOut = 3; diff --git a/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.cpp b/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.cpp index 5b78a23bc3..613e6168c1 100644 --- a/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.cpp +++ b/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.cpp @@ -206,7 +206,7 @@ JSBool jsval_to_TAdsDeveloperInfo(JSContext *cx, jsval v, TAdsDeveloperInfo* ret return jsval_to_TProductInfo(cx, v, ret); } -JSBool jsval_to_TSocialDeveloperInfo(JSContext *cx, jsval v, TSocialDeveloperInfo* ret) +JSBool jsval_to_TShareDeveloperInfo(JSContext *cx, jsval v, TShareDeveloperInfo* ret) { return jsval_to_TProductInfo(cx, v, ret); } diff --git a/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.h b/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.h index 12973e6e6c..bef2f42684 100644 --- a/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.h +++ b/plugin/jsbindings/manual/jsb_pluginx_basic_conversions.h @@ -7,7 +7,7 @@ #include "ProtocolIAP.h" #include "ProtocolAnalytics.h" #include "ProtocolAds.h" -#include "ProtocolSocial.h" +#include "ProtocolShare.h" #ifndef CCLOGINFO #define CCLOGINFO(...) @@ -27,7 +27,7 @@ JSBool jsval_to_std_string(JSContext *cx, jsval v, std::string* ret); JSBool jsval_to_TProductInfo(JSContext *cx, jsval v, TProductInfo* ret); JSBool jsval_to_TIAPDeveloperInfo(JSContext *cx, jsval v, TIAPDeveloperInfo* ret); JSBool jsval_to_TAdsDeveloperInfo(JSContext *cx, jsval v, TAdsDeveloperInfo* ret); -JSBool jsval_to_TSocialDeveloperInfo(JSContext *cx, jsval v, TSocialDeveloperInfo* ret); +JSBool jsval_to_TShareDeveloperInfo(JSContext *cx, jsval v, TShareDeveloperInfo* ret); JSBool jsval_to_TShareInfo(JSContext *cx, jsval v, TShareInfo* ret); JSBool jsval_to_TPaymentInfo(JSContext *cx, jsval v, std::map* ret); JSBool jsval_to_LogEventParamMap(JSContext *cx, jsval v, LogEventParamMap** ret); diff --git a/plugin/jsbindings/manual/jsb_pluginx_extension_registration.cpp b/plugin/jsbindings/manual/jsb_pluginx_extension_registration.cpp index 28f5d1a872..54dc5396d0 100644 --- a/plugin/jsbindings/manual/jsb_pluginx_extension_registration.cpp +++ b/plugin/jsbindings/manual/jsb_pluginx_extension_registration.cpp @@ -12,7 +12,7 @@ static jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string) extern JSObject *jsb_ProtocolIAP_prototype; extern JSObject *jsb_ProtocolAds_prototype; -extern JSObject *jsb_ProtocolSocial_prototype; +extern JSObject *jsb_ProtocolShare_prototype; extern JSObject *jsb_PluginProtocol_prototype; void register_pluginx_js_extensions(JSContext* cx, JSObject* global) @@ -31,7 +31,7 @@ void register_pluginx_js_extensions(JSContext* cx, JSObject* global) JS_DefineFunction(cx, jsb_ProtocolIAP_prototype, "setResultListener", js_pluginx_ProtocolIAP_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, jsb_ProtocolAds_prototype, "setAdsListener", js_pluginx_ProtocolAds_setAdsListener, 1, JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineFunction(cx, jsb_ProtocolSocial_prototype, "setResultListener", js_pluginx_ProtocolSocial_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, jsb_ProtocolShare_prototype, "setResultListener", js_pluginx_ProtocolShare_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callFuncWithParam", js_pluginx_PluginProtocol_callFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callStringFuncWithParam", js_pluginx_PluginProtocol_callStringFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callIntFuncWithParam", js_pluginx_PluginProtocol_callIntFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT); diff --git a/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp b/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp index 205e9e31e2..3aa300ab65 100644 --- a/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp +++ b/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp @@ -212,13 +212,13 @@ private: JSObject* _JSDelegate; }; -JSBool js_pluginx_ProtocolSocial_setResultListener(JSContext *cx, uint32_t argc, jsval *vp) +JSBool js_pluginx_ProtocolShare_setResultListener(JSContext *cx, uint32_t argc, jsval *vp) { s_cx = cx; jsval *argv = JS_ARGV(cx, vp); JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); - cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL); + cocos2d::plugin::ProtocolShare* cobj = (cocos2d::plugin::ProtocolShare *)(proxy ? proxy->ptr : NULL); JSBool ok = JS_TRUE; if (argc == 1) { diff --git a/plugin/jsbindings/manual/jsb_pluginx_manual_callback.h b/plugin/jsbindings/manual/jsb_pluginx_manual_callback.h index 740eca6a02..7aec12d5bb 100644 --- a/plugin/jsbindings/manual/jsb_pluginx_manual_callback.h +++ b/plugin/jsbindings/manual/jsb_pluginx_manual_callback.h @@ -6,6 +6,6 @@ JSBool js_pluginx_ProtocolIAP_setResultListener(JSContext *cx, uint32_t argc, jsval *vp); JSBool js_pluginx_ProtocolAds_setAdsListener(JSContext *cx, uint32_t argc, jsval *vp); -JSBool js_pluginx_ProtocolSocial_setResultListener(JSContext *cx, uint32_t argc, jsval *vp); +JSBool js_pluginx_ProtocolShare_setResultListener(JSContext *cx, uint32_t argc, jsval *vp); #endif /* __JS_MANUAL_CALLBACK_H__ */ diff --git a/plugin/protocols/jsb_protocols.ini b/plugin/protocols/jsb_protocols.ini index 2596b928bc..1b5b202a91 100644 --- a/plugin/protocols/jsb_protocols.ini +++ b/plugin/protocols/jsb_protocols.ini @@ -7,11 +7,11 @@ prefix = pluginx_protocols # all classes will be embedded in that namespace target_namespace = plugin -android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include +android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include android_flags = -D_SIZE_T_DEFINED_ -clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include -clang_flags = -nostdinc -x c++ +clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include +clang_flags = -nostdinc -x c++ -std=c++11 cocos_headers = -I%(pluginxdir)s/protocols/include @@ -23,11 +23,11 @@ cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s # what headers to parse -headers = %(pluginxdir)s/protocols/include/PluginManager.h %(pluginxdir)s/protocols/include/ProtocolAnalytics.h %(pluginxdir)s/protocols/include/ProtocolIAP.h %(pluginxdir)s/protocols/include/ProtocolAds.h %(pluginxdir)s/protocols/include/ProtocolSocial.h +headers = %(pluginxdir)s/protocols/include/PluginManager.h %(pluginxdir)s/protocols/include/ProtocolAnalytics.h %(pluginxdir)s/protocols/include/ProtocolIAP.h %(pluginxdir)s/protocols/include/ProtocolAds.h %(pluginxdir)s/protocols/include/ProtocolShare.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^CCMenu*$". -classes = PluginProtocol PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds ProtocolSocial +classes = PluginProtocol PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds ProtocolShare # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -38,7 +38,7 @@ classes = PluginProtocol PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds skip = ProtocolIAP::[setResultListener], ProtocolAds::[setAdsListener], - ProtocolSocial::[setResultListener], + ProtocolShare::[setResultListener], PluginProtocol::[callFuncWithParam callStringFuncWithParam callIntFuncWithParam callBoolFuncWithParam callFloatFuncWithParam] rename_functions = @@ -56,7 +56,7 @@ base_classes_to_skip = # classes that create no constructor # CCSet is special and we will use a hand-written constructor -abstract_classes = PluginProtocol ProtocolIAP ProtocolAnalytics PluginManager ProtocolAds ProtocolSocial +abstract_classes = PluginProtocol ProtocolIAP ProtocolAnalytics PluginManager ProtocolAds ProtocolShare # Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. script_control_cpp = yes diff --git a/plugin/samples/HelloAds/proj.android/jni/Application.mk b/plugin/samples/HelloAds/proj.android/jni/Application.mk index b20df4f373..43499d7113 100644 --- a/plugin/samples/HelloAds/proj.android/jni/Application.mk +++ b/plugin/samples/HelloAds/proj.android/jni/Application.mk @@ -1,2 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 +NDK_TOOLCHAIN_VERSION=4.7 diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk index 7d9d576f0c..8e3c31147c 100644 --- a/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk +++ b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk @@ -1,3 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 +NDK_TOOLCHAIN_VERSION=4.7 diff --git a/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk b/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk index a0385dad95..488132832e 100644 --- a/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk +++ b/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk @@ -1,2 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS += -frtti -std=c++11 +NDK_TOOLCHAIN_VERSION=4.7 diff --git a/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk b/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk index 7d9d576f0c..8e3c31147c 100755 --- a/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk +++ b/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk @@ -1,3 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 +NDK_TOOLCHAIN_VERSION=4.7 diff --git a/plugin/samples/HelloIAP/proj.android/jni/Application.mk b/plugin/samples/HelloIAP/proj.android/jni/Application.mk index a0385dad95..488132832e 100644 --- a/plugin/samples/HelloIAP/proj.android/jni/Application.mk +++ b/plugin/samples/HelloIAP/proj.android/jni/Application.mk @@ -1,2 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS += -frtti -std=c++11 +NDK_TOOLCHAIN_VERSION=4.7 diff --git a/plugin/samples/HelloShare/proj.android/jni/Application.mk b/plugin/samples/HelloShare/proj.android/jni/Application.mk index a0385dad95..488132832e 100755 --- a/plugin/samples/HelloShare/proj.android/jni/Application.mk +++ b/plugin/samples/HelloShare/proj.android/jni/Application.mk @@ -1,2 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS += -frtti -std=c++11 +NDK_TOOLCHAIN_VERSION=4.7 diff --git a/plugin/tools/tojs/conversions.yaml b/plugin/tools/tojs/conversions.yaml index 9df10de63c..992588048b 100644 --- a/plugin/tools/tojs/conversions.yaml +++ b/plugin/tools/tojs/conversions.yaml @@ -40,7 +40,7 @@ conversions: TIAPDeveloperInfo: "ok &= jsval_to_TIAPDeveloperInfo(cx, ${in_value}, &${out_value})" TPaymentInfo: "ok &= jsval_to_TPaymentInfo(cx, ${in_value}, &${out_value})" TAdsDeveloperInfo: "ok &= jsval_to_TAdsDeveloperInfo(cx, ${in_value}, &${out_value})" - TSocialDeveloperInfo: "ok &= jsval_to_TSocialDeveloperInfo(cx, ${in_value}, &${out_value})" + TShareDeveloperInfo: "ok &= jsval_to_TShareDeveloperInfo(cx, ${in_value}, &${out_value})" TShareInfo: "ok &= jsval_to_TShareInfo(cx, ${in_value}, &${out_value})" LogEventParamMap*: | LogEventParamMap ${out_value}_tmp; @@ -65,7 +65,7 @@ conversions: TIAPDeveloperInfo: "${out_value} = TIAPDeveloperInfo_to_jsval(cx, ${in_value})" TPaymentInfo: "${out_value} = TPaymentInfo_to_jsval(cx, ${in_value})" TAdsDeveloperInfo: "${out_value} = TAdsDeveloperInfo_to_jsval(cx, ${in_value})" - TSocialDeveloperInfo: "${out_value} = TSocialDeveloperInfo_to_jsval(cx, ${in_value})" + TShareDeveloperInfo: "${out_value} = TShareDeveloperInfo_to_jsval(cx, ${in_value})" TShareInfo: "${out_value} = TShareInfo_to_jsval(cx, ${in_value})" LogEventParamMap*: "${out_value} = LogEventParamMap_to_jsval(cx, ${in_value})" long: "${out_value} = long_to_jsval(cx, ${in_value})" diff --git a/plugin/tools/tojs/genbindings.sh b/plugin/tools/tojs/genbindings.sh index 85414ff920..535efb923f 100755 --- a/plugin/tools/tojs/genbindings.sh +++ b/plugin/tools/tojs/genbindings.sh @@ -97,7 +97,7 @@ set -x mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup cp conversions.yaml $CXX_GENERATOR_ROOT/targets/spidermonkey -LD_LIBRARY_PATH=${CLANG_ROOT}/lib +LD_LIBRARY_PATH=${CLANG_ROOT}/lib \ $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${PLUGINX_ROOT}/${SUB_DIR}$PLUGIN_NAME/$INI_NAME -s $PLUGIN_NAME -o $PLUGINX_ROOT/jsbindings/auto -n $OUTPUT_FILENAME mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml