Support installing android APKs from local ABI-specific build folders

This commit is contained in:
baldurk
2018-05-11 13:08:32 +01:00
parent 10f263b060
commit e40ca6f59d
3 changed files with 30 additions and 12 deletions
+20 -5
View File
@@ -347,10 +347,15 @@ bool InstallRenderDocServer(const std::string &deviceID)
paths.push_back(customPath);
#endif
paths.push_back(exeDir + "/plugins/android/"); // Windows install
paths.push_back(exeDir + "/../share/renderdoc/plugins/android/"); // Linux install
paths.push_back(exeDir + "/../../build-android/bin/"); // Local build
paths.push_back(exeDir + "/../../../../../build-android/bin/"); // macOS build
std::string suff = GetRenderDocPackageForABI(abis[0], '-');
suff.erase(0, strlen(RENDERDOC_ANDROID_PACKAGE_BASE));
paths.push_back(exeDir + "/plugins/android/"); // Windows install
paths.push_back(exeDir + "/../share/renderdoc/plugins/android/"); // Linux install
paths.push_back(exeDir + "/../../build-android/bin/"); // Local build
paths.push_back(exeDir + "/../../build-android" + suff + "/bin/"); // Local ABI build
paths.push_back(exeDir + "/../../../../../build-android/bin/"); // macOS build
paths.push_back(exeDir + "/../../../../../build-android" + suff + "/bin/"); // macOS ABI build
// use the first ABI for searching
std::string apk = GetRenderDocPackageForABI(abis[0]);
@@ -381,7 +386,17 @@ bool InstallRenderDocServer(const std::string &deviceID)
for(ABI abi : abis)
{
apk = apksFolder + GetRenderDocPackageForABI(abi) + ".apk";
apk = apksFolder;
size_t abiSuffix = apk.find(suff);
if(abiSuffix != std::string::npos)
{
std::string abisuff = GetRenderDocPackageForABI(abi, '-');
abisuff.erase(0, strlen(RENDERDOC_ANDROID_PACKAGE_BASE));
apk.replace(abiSuffix, suff.size(), abisuff);
}
apk += GetRenderDocPackageForABI(abi) + ".apk";
if(!FileIO::exists(apk.c_str()))
RDCWARN(
+9 -6
View File
@@ -92,18 +92,21 @@ std::vector<ABI> GetSupportedABIs(const std::string &deviceID)
return {};
}
std::string GetRenderDocPackageForABI(ABI abi)
std::string GetRenderDocPackageForABI(ABI abi, char sep)
{
std::string ret = RENDERDOC_ANDROID_PACKAGE_BASE;
ret += sep;
switch(abi)
{
case ABI::arm64_v8a: return RENDERDOC_ANDROID_PACKAGE_BASE ".arm64";
case ABI::armeabi_v7a: return RENDERDOC_ANDROID_PACKAGE_BASE ".arm32";
case ABI::x86_64: return RENDERDOC_ANDROID_PACKAGE_BASE ".x64";
case ABI::x86: return RENDERDOC_ANDROID_PACKAGE_BASE ".x86";
case ABI::arm64_v8a: return ret + "arm64";
case ABI::armeabi_v7a: return ret + "arm32";
case ABI::x86_64: return ret + "x64";
case ABI::x86: return ret + "x86";
default: break;
}
return RENDERDOC_ANDROID_PACKAGE_BASE ".unknown";
return ret + "unknown";
}
std::string GetPathForPackage(const std::string &deviceID, const std::string &packageName)
+1 -1
View File
@@ -63,7 +63,7 @@ enum class ABI
ABI GetABI(const std::string &abiName);
std::vector<ABI> GetSupportedABIs(const std::string &deviceID);
std::string GetRenderDocPackageForABI(ABI abi);
std::string GetRenderDocPackageForABI(ABI abi, char sep = '.');
std::string GetPathForPackage(const std::string &deviceID, const std::string &packageName);
bool PatchManifest(std::vector<byte> &manifest);