From a4cee286e66293dab1a377c83971764fe7d480a2 Mon Sep 17 00:00:00 2001 From: Ramesh Ravone Date: Sat, 7 Oct 2017 15:10:17 +0530 Subject: [PATCH] flatDir support [Android] --- SConstruct | 2 ++ methods.py | 4 ++++ platform/android/SCsub | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/SConstruct b/SConstruct index 6045be54c7e..c05a4332ab0 100644 --- a/SConstruct +++ b/SConstruct @@ -72,6 +72,7 @@ env_base.AppendENVPath('PATH', os.getenv('PATH')) env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.global_defaults = global_defaults env_base.android_maven_repos = [] +env_base.android_flat_dirs = [] env_base.android_dependencies = [] env_base.android_gradle_plugins = [] env_base.android_gradle_classpath = [] @@ -96,6 +97,7 @@ env_base.SetOption('implicit_cache', 1) env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository +env_base.__class__.android_add_flat_dir = methods.android_add_flat_dir env_base.__class__.android_add_dependency = methods.android_add_dependency env_base.__class__.android_add_java_dir = methods.android_add_java_dir env_base.__class__.android_add_res_dir = methods.android_add_res_dir diff --git a/methods.py b/methods.py index f1ef95f6fe8..b56a0364b56 100644 --- a/methods.py +++ b/methods.py @@ -1360,6 +1360,10 @@ def win32_spawn(sh, escape, cmd, args, spawnenv): return exit_code """ +def android_add_flat_dir(self, dir): + if (dir not in self.android_flat_dirs): + self.android_flat_dirs.append(dir) + def android_add_maven_repository(self, url): if (url not in self.android_maven_repos): self.android_maven_repos.append(url) diff --git a/platform/android/SCsub b/platform/android/SCsub index e9a370869fb..7fa02623593 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -46,8 +46,18 @@ gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w") gradle_text = gradle_basein.read() +gradle_maven_flat_text = "" +if len(env.android_flat_dirs) > 0: + gradle_maven_flat_text += "flatDir {\n" + gradle_maven_flat_text += "\tdirs " + for x in env.android_flat_dirs: + gradle_maven_flat_text += "'" + x + "'," + gradle_maven_flat_text = gradle_maven_flat_text[:-1] + gradle_maven_flat_text += "\n\t}\n" + gradle_maven_repos_text = "" +gradle_maven_repos_text += gradle_maven_flat_text if len(env.android_maven_repos) > 0: gradle_maven_repos_text += ""