diff options
Diffstat (limited to 'platform/android/SCsub')
-rw-r--r-- | platform/android/SCsub | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index d772dc9d71..1bd8161fa7 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -1,12 +1,11 @@ #!/usr/bin/env python -Import('env') - -from distutils.version import LooseVersion from detect import get_ndk_version +from distutils.version import LooseVersion -android_files = [ +Import('env') +android_files = [ 'os_android.cpp', 'file_access_android.cpp', 'audio_driver_opensl.cpp', @@ -18,7 +17,7 @@ android_files = [ 'java_class_wrapper.cpp', 'java_godot_wrapper.cpp', 'java_godot_io_wrapper.cpp', -# 'power_android.cpp' + #'power_android.cpp' ] env_android = env.Clone() @@ -53,7 +52,28 @@ if lib_arch_dir != '': out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE")) - ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"]) - if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"): - 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")) + + 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) |