android: adding classpath and gradle plugins

This commit is contained in:
Ramesh Mani Maran 2017-03-06 15:34:21 +05:30 committed by Rémi Verschelde
parent 111d3e8063
commit 27c7d253aa
4 changed files with 21 additions and 1 deletions

View file

@ -73,6 +73,8 @@ 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_dependencies = []
env_base.android_gradle_plugins = []
env_base.android_gradle_classpath = []
env_base.android_java_dirs = []
env_base.android_res_dirs = []
env_base.android_aidl_dirs = []
@ -96,6 +98,8 @@ env_base.__class__.android_add_default_config = methods.android_add_default_conf
env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest
env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions
env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
env_base.__class__.android_add_gradle_plugin = methods.android_add_gradle_plugin
env_base.__class__.android_add_gradle_classpath = methods.android_add_gradle_classpath
env_base.__class__.disable_module = methods.disable_module
env_base.__class__.add_source_files = methods.add_source_files

View file

@ -1381,6 +1381,11 @@ def android_add_jni_dir(self, subpath):
base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath
self.android_jni_dirs.append(base_path)
def android_add_gradle_plugin(self, plugin):
self.android_gradle_plugins.append(plugin)
def android_add_gradle_classpath(self, classpath):
self.android_gradle_classpath.append(classpath)
def android_add_default_config(self, config):
self.android_default_config.append(config)

View file

@ -65,6 +65,13 @@ gradle_java_dirs_text = ""
for x in env.android_java_dirs:
gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'"
gradle_plugins = ""
for x in env.android_gradle_plugins:
gradle_plugins += "apply plugin: \"" + x + "\"\n"
gradle_classpath = ""
for x in env.android_gradle_classpath:
gradle_classpath += "\t\tclasspath \"" + x + "\"\n"
gradle_res_dirs_text = ""
@ -96,7 +103,8 @@ gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_tex
gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text)
gradle_text = gradle_text.replace("$$GRADLE_PLUGINS$$", gradle_plugins)
gradle_text = gradle_text.replace("$$GRADLE_CLASSPATH$$", gradle_classpath)
gradle_baseout.write(gradle_text)
gradle_baseout.close()

View file

@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
$$GRADLE_CLASSPATH$$
}
}
@ -83,3 +84,5 @@ android {
variant.outputs.get(0).setOutputFile(new File("${projectDir}/../../../bin", "android_${variant.name}.apk"))
}
}
$$GRADLE_PLUGINS$$