From 40d3234304535a3993b44c0a7cd55e18b14ced95 Mon Sep 17 00:00:00 2001 From: volzhs Date: Thu, 7 Jul 2016 04:03:50 +0900 Subject: [PATCH] Add android_add_default_config for config.py usage : env.android_add_default_config("applicationId 'com.godot.game'") --- SConstruct | 2 ++ methods.py | 4 +++- platform/android/SCsub | 6 ++++++ platform/android/build.gradle.template | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 01b1f2ce8e0..d168820f666 100644 --- a/SConstruct +++ b/SConstruct @@ -73,6 +73,7 @@ env_base.android_java_dirs=[] env_base.android_res_dirs=[] env_base.android_aidl_dirs=[] env_base.android_jni_dirs=[] +env_base.android_default_config=[] env_base.android_manifest_chunk="" env_base.android_permission_chunk="" env_base.android_appattributes_chunk="" @@ -88,6 +89,7 @@ env_base.__class__.android_add_java_dir=methods.android_add_java_dir env_base.__class__.android_add_res_dir=methods.android_add_res_dir env_base.__class__.android_add_aidl_dir=methods.android_add_aidl_dir env_base.__class__.android_add_jni_dir=methods.android_add_jni_dir +env_base.__class__.android_add_default_config=methods.android_add_default_config 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 diff --git a/methods.py b/methods.py index 7128b334ecc..74c282b8cf6 100755 --- a/methods.py +++ b/methods.py @@ -1326,7 +1326,9 @@ def android_add_aidl_dir(self,subpath): 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_default_config(self,config): + self.android_default_config.append(config) + def android_add_to_manifest(self,file): base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+file f = open(base_path,"rb") diff --git a/platform/android/SCsub b/platform/android/SCsub index c8feac8690f..0814f4a7bc3 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -79,6 +79,11 @@ for x in env.android_jni_dirs: gradle_asset_dirs_text="" +gradle_default_config_text="" + +for x in env.android_default_config: + gradle_default_config_text+=x+"\n\t\t" + gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$",gradle_maven_repos_text) gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$",gradle_maven_dependencies_text) gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$",gradle_java_dirs_text) @@ -86,6 +91,7 @@ gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$",gradle_res_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$",gradle_asset_dirs_text) 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_baseout.write( gradle_text ) diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 1e1461ef296..9e617a9e9e8 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -39,6 +39,7 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 + $$GRADLE_DEFAULT_CONFIG$$ } sourceSets { main {