diff --git a/SConstruct b/SConstruct index 2e7683d17ab..e9a6bc44b6f 100644 --- a/SConstruct +++ b/SConstruct @@ -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 diff --git a/methods.py b/methods.py index 7177dcb804c..a86fa1937d4 100644 --- a/methods.py +++ b/methods.py @@ -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) diff --git a/platform/android/SCsub b/platform/android/SCsub index 2a024525096..e8536953a33 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -65,7 +65,14 @@ 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 = "" for x in env.android_res_dirs: @@ -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() diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index c46a15bd125..24aab8e01fa 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -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$$