From b3262cb8299c1b6f7520a598c20a95147c7ac69a Mon Sep 17 00:00:00 2001 From: Nicolas BOUQUET Date: Mon, 12 Jun 2017 15:00:50 +0200 Subject: [PATCH] [export] Make export variables global [android] Build for all archs by default [android] Strip 64 bit libs on export by default [plugin/json] Auto integrate on iOS --- android/lib/jni/Application.mk | 2 +- gdrexport/ExportLua.cpp | 4 +- gdrexport/ExportXml.cpp | 75 ++++++++++++------- gdrexport/ExportXml.h | 4 +- gdrexport/exportcontext.h | 2 + libgvfs/jni/Application.mk | 2 +- libgvfs/vfscanf.c | 2 + lua/jni/Application.mk | 2 +- luabinding/texturebasebinder.cpp | 6 ++ luabinding/texturebinder.cpp | 6 ++ .../source/Android/jni/Application.mk | 2 +- plugins/ads/source/Android/jni/Application.mk | 2 +- plugins/bitop/source/jni/Application.mk | 2 +- .../camera/source/Android/jni/Application.mk | 2 +- plugins/clipper/source/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- .../countly/source/Android/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- .../flurry/source/Android/jni/Application.mk | 2 +- .../gaming/source/Android/jni/Application.mk | 2 +- .../giftiz/source/Android/jni/Application.mk | 2 +- .../gmedia/source/Android/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- plugins/iab/source/Android/jni/Application.mk | 2 +- plugins/json/json.gplugin | 13 ++++ plugins/json/source/jni/Application.mk | 2 +- plugins/lfs/source/jni/Application.mk | 2 +- plugins/lpeg/source/jni/Application.mk | 2 +- plugins/lsqlite3/source/jni/Application.mk | 2 +- plugins/luasocket/source/jni/Application.mk | 2 +- plugins/luasqlite3/source/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- .../native/source/Android/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- .../source/Android/jni/Application.mk | 2 +- plugins/struct/source/jni/Application.mk | 2 +- plugins/tts/Makefile | 6 +- plugins/tts/source/Android/jni/Application.mk | 2 +- scripts/GidAndroid.mk | 7 +- .../Android Template/app/build.gradle | 3 + 42 files changed, 122 insertions(+), 68 deletions(-) diff --git a/android/lib/jni/Application.mk b/android/lib/jni/Application.mk index 3715abe0b..5a30defc1 100644 --- a/android/lib/jni/Application.mk +++ b/android/lib/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release APP_UNIFIED_HEADERS := true diff --git a/gdrexport/ExportLua.cpp b/gdrexport/ExportLua.cpp index ccb285995..f0d4838f7 100644 --- a/gdrexport/ExportLua.cpp +++ b/gdrexport/ExportLua.cpp @@ -16,7 +16,7 @@ static int getProperty(lua_State* L) if (!currentXml) return 0; const char *prop=luaL_checkstring(L,1); - lua_pushstring(L,currentXml->props[QString(prop)].toStdString().c_str()); + lua_pushstring(L,currentXml->GetProperty(QString(prop)).toStdString().c_str()); return 1; } @@ -26,7 +26,7 @@ static int setProperty(lua_State* L) return 0; const char *prop=luaL_checkstring(L,1); const char *val=luaL_checkstring(L,2); - currentXml->props[QString(prop)]=QString(val); + currentXml->SetProperty(QString(prop),QString(val)); return 0; } diff --git a/gdrexport/ExportXml.cpp b/gdrexport/ExportXml.cpp index f07712c2d..a16165bdd 100644 --- a/gdrexport/ExportXml.cpp +++ b/gdrexport/ExportXml.cpp @@ -56,39 +56,42 @@ void ExportXml::SetupProperties(ExportContext *ctx) { this->ctx = ctx; ctx->basews = Utilities::RemoveSpaces(ctx->base, false); + if (ctx->props.empty()) + { //Fill properties: System #ifdef Q_OS_WIN32 - props["sys.exeExtension"]=".exe"; + ctx->props["sys.exeExtension"]=".exe"; #else - props["sys.exeExtension"] = ""; + ctx->props["sys.exeExtension"] = ""; #endif - props["sys.cacheDir"] = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); - props["sys.giderosDir"] = QDir::currentPath(); - props["sys.homeDir"] = QDir::homePath(); - props["sys.exportDir"] = ctx->exportDir.absolutePath(); - props["sys.exportType"]=QString(ctx->player?"player":(ctx->assetsOnly?"assets":"full")); + ctx->props["sys.cacheDir"] = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); + ctx->props["sys.giderosDir"] = QDir::currentPath(); + ctx->props["sys.homeDir"] = QDir::homePath(); + ctx->props["sys.exportDir"] = ctx->exportDir.absolutePath(); + ctx->props["sys.exportType"]=QString(ctx->player?"player":(ctx->assetsOnly?"assets":"full")); //Fill properties: Project - props["project.name"] = ctx->base; - props["project.namews"] = ctx->basews; - props["project.package"] = ctx->properties.packageName; - props["project.version"] = ctx->properties.version; - props["project.platform"] = ctx->platform; - props["project.app_name"] = ctx->appName; - props["project.version_code"] = QString::number( + ctx->props["project.name"] = ctx->base; + ctx->props["project.namews"] = ctx->basews; + ctx->props["project.package"] = ctx->properties.packageName; + ctx->props["project.version"] = ctx->properties.version; + ctx->props["project.platform"] = ctx->platform; + ctx->props["project.app_name"] = ctx->appName; + ctx->props["project.version_code"] = QString::number( ctx->properties.version_code); - props["project.build_number"] = QString::number( + ctx->props["project.build_number"] = QString::number( ctx->properties.build_number); - props["project.autorotation"] = QString::number( + ctx->props["project.autorotation"] = QString::number( ctx->properties.autorotation); - props["project.orientation"] = QString::number(ctx->properties.orientation); - props["project.disableSplash"] = QString::number(ctx->properties.disableSplash?1:0); - props["project.backgroundColor"] = ctx->properties.backgroundColor; - props["project.ios_bundle"] = ctx->properties.ios_bundle; + ctx->props["project.orientation"] = QString::number(ctx->properties.orientation); + ctx->props["project.disableSplash"] = QString::number(ctx->properties.disableSplash?1:0); + ctx->props["project.backgroundColor"] = ctx->properties.backgroundColor; + ctx->props["project.ios_bundle"] = ctx->properties.ios_bundle; //Fill in passed arguments QHash::iterator i; for (i = ctx->args.begin(); i != ctx->args.end(); ++i) - props["args."+i.key()] = i.value(); + ctx->props["args."+i.key()] = i.value(); + } } bool ExportXml::Process(ExportContext *ctx) { @@ -97,7 +100,7 @@ bool ExportXml::Process(ExportContext *ctx) { QDomElement rules; QDir xmlDir=QFileInfo(xmlFile).dir(); if (isPlugin) { - props["sys.pluginDir"] = xmlDir.path(); + lprops["sys.pluginDir"] = xmlDir.path(); //Fill properties: Plugin for (QSet::const_iterator it = ctx->properties.plugins.begin(); @@ -106,7 +109,7 @@ bool ExportXml::Process(ExportContext *ctx) { for (QMap::const_iterator mit = (*it).properties.begin(); mit != (*it).properties.end(); mit++) - props[QString("plugin.").append(mit.key())] = mit.value(); + lprops[QString("plugin.").append(mit.key())] = mit.value(); } //Lookup target QDomNodeList targets = exporter.elementsByTagName("target"); @@ -119,7 +122,7 @@ bool ExportXml::Process(ExportContext *ctx) { } } else { //Fill properties: Export - props["sys.exportDir"] = xmlDir.path(); + ctx->props["sys.exporterDir"] = xmlDir.path(); rules = exporter.firstChildElement("rules"); for (QSet::const_iterator it = ctx->properties.exports.begin(); @@ -128,7 +131,7 @@ bool ExportXml::Process(ExportContext *ctx) { for (QMap::const_iterator mit = (*it).properties.begin(); mit != (*it).properties.end(); mit++) - props[QString("export.").append(mit.key())] = mit.value(); + ctx->props[QString("export.").append(mit.key())] = mit.value(); } } //Run rules @@ -404,7 +407,7 @@ QString ExportXml::ReplaceAttributes(QString text) { int ac = args.count(); QString rep; if (ac == 1) - rep = props[args[0]]; + rep = GetProperty(args[0]); else if (ac == 2) rep = ComputeUnary(args[0], args[1]); else if (ac == 3) @@ -483,7 +486,7 @@ bool ExportXml::RuleIf(QString cond, QDomElement rule) { bool ExportXml::RuleSet(QString key, QString val) { ExportCommon::exportInfo("Set: %s -> %s\n", key.toStdString().c_str(), SecretVal(key,val).toStdString().c_str()); - props[key] = val; + SetProperty(key,val); return true; } @@ -497,10 +500,26 @@ bool ExportXml::RuleAsk(QDomElement rule) { free(ret); ExportCommon::exportInfo("Ask: %s -> %s\n", key.toStdString().c_str(), SecretVal(key,val).toStdString().c_str()); - props[key] = val; + SetProperty(key,val); return true; } +void ExportXml::SetProperty(QString k,QString v) +{ + if (!(ctx->props[k].isEmpty())) + ctx->props[k]=v; + else + lprops[k]=v; +} + +QString ExportXml::GetProperty(QString k) +{ + if (!(ctx->props[k].isEmpty())) + return ctx->props[k]; + return lprops[k]; +} + + QString ExportXml::XmlAttributeOrElement(QDomElement elm,QString name) { QString value=elm.attribute(name); diff --git a/gdrexport/ExportXml.h b/gdrexport/ExportXml.h index c97545f25..250866956 100644 --- a/gdrexport/ExportXml.h +++ b/gdrexport/ExportXml.h @@ -45,11 +45,13 @@ class ExportXml { public: ExportXml(QString xmlFile,bool isPlugin=false); ExportXml(); + void SetProperty(QString k,QString v); + QString GetProperty(QString k); void SetupProperties(ExportContext *ctx); bool Process(ExportContext *ctx); bool ProcessRuleString(const char *xml); bool isPlugin; - QMap props; + QMap lprops; QString xmlFile; static bool exportXml(QString xmlFile,bool plugin,ExportContext *ctx); static QMap availableTargets(); diff --git a/gdrexport/exportcontext.h b/gdrexport/exportcontext.h index dcda8c715..5453b775f 100644 --- a/gdrexport/exportcontext.h +++ b/gdrexport/exportcontext.h @@ -74,6 +74,8 @@ struct ExportContext QImage *tvicon; QImage *splash_h_image; QImage *splash_v_image; + //XML + QMap props; //global properties // LUA lua_State *L; }; diff --git a/libgvfs/jni/Application.mk b/libgvfs/jni/Application.mk index ecc6ca5f8..15e90b871 100644 --- a/libgvfs/jni/Application.mk +++ b/libgvfs/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := gnustl_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/libgvfs/vfscanf.c b/libgvfs/vfscanf.c index 79e5e7903..4412c81cd 100644 --- a/libgvfs/vfscanf.c +++ b/libgvfs/vfscanf.c @@ -44,11 +44,13 @@ #endif #ifdef __ANDROID__ +#if UINTPTR_MAX == 0xffffffff //For 32bit target only static long double strtold(const char *s, char **sp) { return strtod(s, sp); } #endif +#endif #ifdef WINSTORE #define __signed diff --git a/lua/jni/Application.mk b/lua/jni/Application.mk index ecc6ca5f8..15e90b871 100644 --- a/lua/jni/Application.mk +++ b/lua/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := gnustl_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/luabinding/texturebasebinder.cpp b/luabinding/texturebasebinder.cpp index 03fd87f54..43a46b416 100644 --- a/luabinding/texturebasebinder.cpp +++ b/luabinding/texturebasebinder.cpp @@ -30,6 +30,12 @@ TextureBaseBinder::TextureBaseBinder(lua_State* L) lua_setfield(L, -2, "RGBA4444"); lua_pushstring(L, "rgba5551"); lua_setfield(L, -2, "RGBA5551"); + lua_pushstring(L, "y8"); + lua_setfield(L, -2, "Y8"); + lua_pushstring(L, "a8"); + lua_setfield(L, -2, "A8"); + lua_pushstring(L, "ya8"); + lua_setfield(L, -2, "YA8"); lua_pop(L, 1); } diff --git a/luabinding/texturebinder.cpp b/luabinding/texturebinder.cpp index c3544533e..bf1242f67 100644 --- a/luabinding/texturebinder.cpp +++ b/luabinding/texturebinder.cpp @@ -87,6 +87,12 @@ int TextureBinder::create(lua_State* L) format = eRGBA4444; else if (strcmp(formatstr, "rgba5551") == 0) format = eRGBA5551; + else if (strcmp(formatstr, "y8") == 0) + format = eY8; + else if (strcmp(formatstr, "a8") == 0) + format = eA8; + else if (strcmp(formatstr, "ya8") == 0) + format = eYA8; else { GStatus status(2008, "format"); // Error #2008: Parameter %s must be one of the accepted values. diff --git a/plugins/Facebook/source/Android/jni/Application.mk b/plugins/Facebook/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/Facebook/source/Android/jni/Application.mk +++ b/plugins/Facebook/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/ads/source/Android/jni/Application.mk b/plugins/ads/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/ads/source/Android/jni/Application.mk +++ b/plugins/ads/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/bitop/source/jni/Application.mk b/plugins/bitop/source/jni/Application.mk index fbd5f5ec5..fee0cd68b 100644 --- a/plugins/bitop/source/jni/Application.mk +++ b/plugins/bitop/source/jni/Application.mk @@ -1,5 +1,5 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release \ No newline at end of file diff --git a/plugins/camera/source/Android/jni/Application.mk b/plugins/camera/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/camera/source/Android/jni/Application.mk +++ b/plugins/camera/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/clipper/source/jni/Application.mk b/plugins/clipper/source/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/clipper/source/jni/Application.mk +++ b/plugins/clipper/source/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/controller/source/Android/jni/Application.mk b/plugins/controller/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/controller/source/Android/jni/Application.mk +++ b/plugins/controller/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/countly/source/Android/jni/Application.mk b/plugins/countly/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/countly/source/Android/jni/Application.mk +++ b/plugins/countly/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/exampleplugin/source/Android/jni/Application.mk b/plugins/exampleplugin/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/exampleplugin/source/Android/jni/Application.mk +++ b/plugins/exampleplugin/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/flurry/source/Android/jni/Application.mk b/plugins/flurry/source/Android/jni/Application.mk index 8e776e000..a3c1e0022 100644 --- a/plugins/flurry/source/Android/jni/Application.mk +++ b/plugins/flurry/source/Android/jni/Application.mk @@ -1,5 +1,5 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/gaming/source/Android/jni/Application.mk b/plugins/gaming/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/gaming/source/Android/jni/Application.mk +++ b/plugins/gaming/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/giftiz/source/Android/jni/Application.mk b/plugins/giftiz/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/giftiz/source/Android/jni/Application.mk +++ b/plugins/giftiz/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/gmedia/source/Android/jni/Application.mk b/plugins/gmedia/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/gmedia/source/Android/jni/Application.mk +++ b/plugins/gmedia/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/googlebilling/source/Android/jni/Application.mk b/plugins/googlebilling/source/Android/jni/Application.mk index fbd5f5ec5..fee0cd68b 100644 --- a/plugins/googlebilling/source/Android/jni/Application.mk +++ b/plugins/googlebilling/source/Android/jni/Application.mk @@ -1,5 +1,5 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release \ No newline at end of file diff --git a/plugins/googlelicensing/source/Android/jni/Application.mk b/plugins/googlelicensing/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/googlelicensing/source/Android/jni/Application.mk +++ b/plugins/googlelicensing/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/googleplay/source/Android/jni/Application.mk b/plugins/googleplay/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/googleplay/source/Android/jni/Application.mk +++ b/plugins/googleplay/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/iab/source/Android/jni/Application.mk b/plugins/iab/source/Android/jni/Application.mk index dd6c08cfa..642881840 100644 --- a/plugins/iab/source/Android/jni/Application.mk +++ b/plugins/iab/source/Android/jni/Application.mk @@ -1,7 +1,7 @@ APP_STL := c++_static APP_CPPFLAGS += -fexceptions -frtti APP_PLATFORM := android-9 -APP_ABI := armeabi armeabi-v7a x86 +APP_ABI := all APP_OPTIM := release diff --git a/plugins/json/json.gplugin b/plugins/json/json.gplugin index e09856ea2..aa063d252 100644 --- a/plugins/json/json.gplugin +++ b/plugins/json/json.gplugin @@ -17,6 +17,19 @@ + +