Merge pull request #11847 from RameshRavone/patch-8

flatDir support [Android] (2.1)
This commit is contained in:
Rémi Verschelde 2017-10-09 12:34:00 +02:00 committed by GitHub
commit b641a58951
3 changed files with 16 additions and 0 deletions

View File

@ -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 = []
@ -89,6 +90,7 @@ env_base.split_drivers = False
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

View File

@ -1279,6 +1279,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)

View File

@ -44,8 +44,18 @@ gradle_baseout = open(abspath + "/java/build.gradle", "wb")
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 += ""