summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/SCsub22
-rw-r--r--platform/android/export/export.cpp9
2 files changed, 25 insertions, 6 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub
index d2f27817c6..1bd8161fa7 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -55,3 +55,25 @@ if lib_arch_dir != '':
stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
+
+# Zip android/java folder for the source export template.
+print("Archiving platform/android/java as bin/android_source.zip...")
+import os
+import zipfile
+# Change dir to avoid have zipped paths start from the android/java folder.
+olddir = os.getcwd()
+os.chdir(Dir('#platform/android/java').abspath)
+bindir = Dir('#bin').abspath
+# Make 'bin' dir if missing, can happen on fresh clone.
+if not os.path.exists(bindir):
+ os.makedirs(bindir)
+zipf = zipfile.ZipFile(os.path.join(bindir, 'android_source.zip'), 'w', zipfile.ZIP_DEFLATED)
+exclude_dirs = ['.gradle', 'build', 'libs', 'patches']
+for root, dirs, files in os.walk('.', topdown=True):
+ # Change 'dirs' in place to exclude folders we don't want.
+ # https://stackoverflow.com/a/19859907
+ dirs[:] = [d for d in dirs if d not in exclude_dirs]
+ for f in files:
+ zipf.write(os.path.join(root, f))
+zipf.close()
+os.chdir(olddir)
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 16e49e8a38..441fa38bff 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1610,19 +1610,16 @@ public:
valid = false;
} else {
Error errn;
- DirAccess *da = DirAccess::open(sdk_path.plus_file("tools"), &errn);
+ DirAccessRef da = DirAccess::open(sdk_path.plus_file("tools"), &errn);
if (errn != OK) {
err += TTR("Invalid Android SDK path for custom build in Editor Settings.") + "\n";
valid = false;
}
- if (da) {
- memdelete(da);
- }
}
if (!FileAccess::exists("res://android/build/build.gradle")) {
- err += TTR("Android project is not installed for compiling. Install from Editor menu.") + "\n";
+ err += TTR("Android build template not installed in the project. Install it from the Project menu.") + "\n";
valid = false;
}
}
@@ -2513,7 +2510,7 @@ void register_android_exporter() {
EDITOR_DEF("export/android/debug_keystore_pass", "android");
EDITOR_DEF("export/android/force_system_user", false);
EDITOR_DEF("export/android/custom_build_sdk_path", "");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/custom_build_sdk_path", PROPERTY_HINT_GLOBAL_DIR, "*.keystore"));
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/custom_build_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
EDITOR_DEF("export/android/timestamping_authority_url", "");
EDITOR_DEF("export/android/shutdown_adb_on_exit", true);