Merge pull request #31919 from m4gr3d/use_aar_for_custom_build
Leverage Android archive (AAR) file for Godot custom build
@ -562,10 +562,8 @@ bool ExportTemplateManager::can_install_android_template() {
|
||||
|
||||
Error ExportTemplateManager::install_android_template() {
|
||||
|
||||
// To support custom Android builds, we install various things to the project's res://android folder.
|
||||
// First is the Java source code and buildsystem from android_source.zip.
|
||||
// Then we extract the Godot Android libraries from pre-build android_release.apk
|
||||
// and android_debug.apk, to place them in the libs folder.
|
||||
// To support custom Android builds, we install the Java source code and buildsystem
|
||||
// from android_source.zip to the project's res://android folder.
|
||||
|
||||
DirAccessRef da = DirAccess::open("res://");
|
||||
ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
|
||||
@ -661,89 +659,6 @@ Error ExportTemplateManager::install_android_template() {
|
||||
ProgressDialog::get_singleton()->end_task("uncompress_src");
|
||||
unzClose(pkg);
|
||||
|
||||
// Extract libs from pre-built APKs.
|
||||
err = _extract_libs_from_apk("release");
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Can't extract Android libs from android_release.apk.");
|
||||
err = _extract_libs_from_apk("debug");
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Can't extract Android libs from android_debug.apk.");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error ExportTemplateManager::_extract_libs_from_apk(const String &p_target_name) {
|
||||
|
||||
const String &templates_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(VERSION_FULL_CONFIG);
|
||||
const String &apk_file = templates_path.plus_file("android_" + p_target_name + ".apk");
|
||||
ERR_FAIL_COND_V(!FileAccess::exists(apk_file), ERR_CANT_OPEN);
|
||||
|
||||
FileAccess *src_f = NULL;
|
||||
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
||||
|
||||
unzFile pkg = unzOpen2(apk_file.utf8().get_data(), &io);
|
||||
ERR_FAIL_COND_V_MSG(!pkg, ERR_CANT_OPEN, "Android APK can't be extracted.");
|
||||
|
||||
DirAccessRef da = DirAccess::open("res://");
|
||||
ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
|
||||
|
||||
// 8 steps because 4 arches, 2 libs per arch.
|
||||
ProgressDialog::get_singleton()->add_task("extract_libs_from_apk", TTR("Extracting Android Libraries From APKs"), 8);
|
||||
|
||||
int ret = unzGoToFirstFile(pkg);
|
||||
Set<String> dirs_tested;
|
||||
int idx = 0;
|
||||
while (ret == UNZ_OK) {
|
||||
// Get file path.
|
||||
unz_file_info info;
|
||||
char fpath[16384];
|
||||
ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, NULL, 0, NULL, 0);
|
||||
|
||||
String path = fpath;
|
||||
String base_dir = path.get_base_dir();
|
||||
String file = path.get_file();
|
||||
|
||||
if (!base_dir.begins_with("lib") || path.ends_with("/")) {
|
||||
ret = unzGoToNextFile(pkg);
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector<uint8_t> data;
|
||||
data.resize(info.uncompressed_size);
|
||||
|
||||
// Read.
|
||||
unzOpenCurrentFile(pkg);
|
||||
unzReadCurrentFile(pkg, data.ptrw(), data.size());
|
||||
unzCloseCurrentFile(pkg);
|
||||
|
||||
// We have a "lib" folder in the APK, but it should be "libs/{release,debug}" in the source dir.
|
||||
String target_base_dir = base_dir.replace_first("lib", String("libs").plus_file(p_target_name));
|
||||
|
||||
if (!dirs_tested.has(base_dir)) {
|
||||
da->make_dir_recursive(String("android/build").plus_file(target_base_dir));
|
||||
dirs_tested.insert(base_dir);
|
||||
}
|
||||
|
||||
String to_write = String("res://android/build").plus_file(target_base_dir.plus_file(path.get_file()));
|
||||
FileAccess *f = FileAccess::open(to_write, FileAccess::WRITE);
|
||||
if (f) {
|
||||
f->store_buffer(data.ptr(), data.size());
|
||||
memdelete(f);
|
||||
#ifndef WINDOWS_ENABLED
|
||||
// We can't retrieve Unix permissions from the APK it seems, so simply set 0755 as should be.
|
||||
FileAccess::set_unix_permissions(to_write, 0755);
|
||||
#endif
|
||||
} else {
|
||||
ERR_PRINTS("Can't uncompress file: " + to_write);
|
||||
}
|
||||
|
||||
ProgressDialog::get_singleton()->task_step("extract_libs_from_apk", path, idx);
|
||||
|
||||
idx++;
|
||||
ret = unzGoToNextFile(pkg);
|
||||
}
|
||||
|
||||
ProgressDialog::get_singleton()->end_task("extract_libs_from_apk");
|
||||
unzClose(pkg);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,6 @@ class ExportTemplateManager : public ConfirmationDialog {
|
||||
virtual void ok_pressed();
|
||||
bool _install_from_file(const String &p_file, bool p_use_progress = true);
|
||||
|
||||
Error _extract_libs_from_apk(const String &p_target_name);
|
||||
|
||||
void _http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data);
|
||||
void _http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data);
|
||||
|
||||
|
@ -86,7 +86,7 @@ do
|
||||
if grep -q "thirdparty" <<< $file; then
|
||||
continue;
|
||||
fi
|
||||
if grep -q "platform/android/java/src/com" <<< $file; then
|
||||
if grep -q "platform/android/java/lib/src/com" <<< $file; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.godot.game"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
<supports-screens android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"/>
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
|
||||
|
||||
|
||||
<application android:label="@string/godot_project_name_string" android:icon="@drawable/icon" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" >
|
||||
<activity android:name="org.godotengine.godot.Godot"
|
||||
android:label="@string/godot_project_name_string"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize"
|
||||
android:resizeableActivity="false"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service android:name="org.godotengine.godot.GodotDownloaderService" />
|
||||
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
<instrumentation android:icon="@drawable/icon"
|
||||
android:label="@string/godot_project_name_string"
|
||||
android:name="org.godotengine.godot.GodotInstrumentation"
|
||||
android:targetPackage="com.godot.game" />
|
||||
|
||||
</manifest>
|
BIN
misc/ide/jetbrains/gradle/wrapper/gradle-wrapper.jar
vendored
@ -1,6 +0,0 @@
|
||||
#Wed Aug 21 13:47:30 PDT 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
172
misc/ide/jetbrains/gradlew
vendored
@ -1,172 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
84
misc/ide/jetbrains/gradlew.bat
vendored
@ -1,84 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -11,7 +11,7 @@ else
|
||||
RANGE=HEAD
|
||||
fi
|
||||
|
||||
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -v platform/android/java/src/com/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
|
||||
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -v platform/android/java/lib/src/com/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
|
||||
echo "Checking files:\n$FILES"
|
||||
|
||||
# create a random filename to store our generated patch
|
||||
|
@ -18,7 +18,7 @@ android_arch_dirs = {
|
||||
|
||||
|
||||
def get_android_out_dir(env):
|
||||
return os.path.join(Dir('#platform/android/java/libs').abspath,
|
||||
return os.path.join(Dir('#platform/android/java/lib/libs').abspath,
|
||||
'release' if env['target'] == 'release' else 'debug',
|
||||
android_arch_dirs[env['android_arch']])
|
||||
|
||||
|
@ -50,30 +50,8 @@ if lib_arch_dir != '':
|
||||
else: # release_debug, debug
|
||||
lib_type_dir = 'debug'
|
||||
|
||||
out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir
|
||||
out_dir = '#platform/android/java/lib/libs/' + lib_type_dir + '/' + lib_arch_dir
|
||||
env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$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)
|
||||
|
@ -794,6 +794,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
||||
string_table.write[attr_value] = version_name;
|
||||
}
|
||||
|
||||
if (tname == "instrumentation" && attrname == "targetPackage") {
|
||||
string_table.write[attr_value] = get_package_name(package_name);
|
||||
}
|
||||
|
||||
if (tname == "activity" && attrname == "screenOrientation") {
|
||||
|
||||
encode_uint32(orientation == 0 ? 0 : 1, &p_manifest.write[iofs + 16]);
|
||||
|
@ -41,7 +41,7 @@
|
||||
android:value="xr_mode_metadata_value" />
|
||||
|
||||
<activity
|
||||
android:name="org.godotengine.godot.Godot"
|
||||
android:name=".GodotApp"
|
||||
android:label="@string/godot_project_name_string"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
@ -56,18 +56,10 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name="org.godotengine.godot.GodotDownloaderService" />
|
||||
|
||||
<!-- Custom application XML added by add-ons. -->
|
||||
<!--CHUNK_APPLICATION_BEGIN-->
|
||||
<!--CHUNK_APPLICATION_END-->
|
||||
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/godot_project_name_string"
|
||||
android:name="org.godotengine.godot.GodotInstrumentation"
|
||||
android:targetPackage="org.godotengine.game" />
|
||||
|
||||
</manifest>
|
121
platform/android/java/app/build.gradle
Normal file
@ -0,0 +1,121 @@
|
||||
// Gradle build config for Godot Engine's Android port.
|
||||
//
|
||||
// Do not remove/modify comments ending with BEGIN/END, they are used to inject
|
||||
// addon-specific configuration.
|
||||
apply from: 'config.gradle'
|
||||
|
||||
buildscript {
|
||||
apply from: 'config.gradle'
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
//CHUNK_BUILDSCRIPT_REPOSITORIES_BEGIN
|
||||
//CHUNK_BUILDSCRIPT_REPOSITORIES_END
|
||||
}
|
||||
dependencies {
|
||||
classpath libraries.androidGradlePlugin
|
||||
//CHUNK_BUILDSCRIPT_DEPENDENCIES_BEGIN
|
||||
//CHUNK_BUILDSCRIPT_DEPENDENCIES_END
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
jcenter()
|
||||
//CHUNK_ALLPROJECTS_REPOSITORIES_BEGIN
|
||||
//CHUNK_ALLPROJECTS_REPOSITORIES_END
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
if (rootProject.findProject(":lib")) {
|
||||
implementation project(":lib")
|
||||
} else {
|
||||
// Custom build mode. In this scenario this project is the only one around and the Godot
|
||||
// library is available through the pre-generated godot-lib.*.aar android archive files.
|
||||
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
|
||||
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
|
||||
}
|
||||
//CHUNK_DEPENDENCIES_BEGIN
|
||||
//CHUNK_DEPENDENCIES_END
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion versions.compileSdk
|
||||
buildToolsVersion versions.buildTools
|
||||
|
||||
defaultConfig {
|
||||
// Feel free to modify the application id to your own.
|
||||
applicationId "com.godot.game"
|
||||
minSdkVersion versions.minSdk
|
||||
targetSdkVersion versions.targetSdk
|
||||
//CHUNK_ANDROID_DEFAULTCONFIG_BEGIN
|
||||
//CHUNK_ANDROID_DEFAULTCONFIG_END
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
disable 'MissingTranslation', 'UnusedResources'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
|
||||
// Both signing and zip-aligning will be done at export time
|
||||
buildTypes.all { buildType ->
|
||||
buildType.zipAlignEnabled false
|
||||
buildType.signingConfig null
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = [
|
||||
'src'
|
||||
//DIR_SRC_BEGIN
|
||||
//DIR_SRC_END
|
||||
]
|
||||
res.srcDirs = [
|
||||
'res'
|
||||
//DIR_RES_BEGIN
|
||||
//DIR_RES_END
|
||||
]
|
||||
aidl.srcDirs = [
|
||||
'aidl'
|
||||
//DIR_AIDL_BEGIN
|
||||
//DIR_AIDL_END
|
||||
]
|
||||
assets.srcDirs = [
|
||||
'assets'
|
||||
//DIR_ASSETS_BEGIN
|
||||
//DIR_ASSETS_END
|
||||
]
|
||||
}
|
||||
debug.jniLibs.srcDirs = [
|
||||
'libs/debug'
|
||||
//DIR_JNI_DEBUG_BEGIN
|
||||
//DIR_JNI_DEBUG_END
|
||||
]
|
||||
release.jniLibs.srcDirs = [
|
||||
'libs/release'
|
||||
//DIR_JNI_RELEASE_BEGIN
|
||||
//DIR_JNI_RELEASE_END
|
||||
]
|
||||
}
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
output.outputFileName = "android_${variant.name}.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHUNK_GLOBAL_BEGIN
|
||||
//CHUNK_GLOBAL_END
|
12
platform/android/java/app/config.gradle
Normal file
@ -0,0 +1,12 @@
|
||||
ext.versions = [
|
||||
androidGradlePlugin : '3.4.2',
|
||||
compileSdk : 28,
|
||||
minSdk : 18,
|
||||
targetSdk : 28,
|
||||
buildTools : '28.0.3',
|
||||
|
||||
]
|
||||
|
||||
ext.libraries = [
|
||||
androidGradlePlugin : "com.android.tools.build:gradle:$versions.androidGradlePlugin"
|
||||
]
|
10
platform/android/java/app/src/com/godot/game/GodotApp.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.godot.game;
|
||||
|
||||
import org.godotengine.godot.Godot;
|
||||
|
||||
/**
|
||||
* Template activity for Godot Android custom builds.
|
||||
* Feel free to extend and modify this class for your custom logic.
|
||||
*/
|
||||
public class GodotApp extends Godot {
|
||||
}
|
@ -1,111 +1,95 @@
|
||||
// Gradle build config for Godot Engine's Android port.
|
||||
//
|
||||
// Do not remove/modify comments ending with BEGIN/END, they are used to inject
|
||||
// addon-specific configuration.
|
||||
apply from: 'app/config.gradle'
|
||||
|
||||
buildscript {
|
||||
apply from: 'app/config.gradle'
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
//CHUNK_BUILDSCRIPT_REPOSITORIES_BEGIN
|
||||
//CHUNK_BUILDSCRIPT_REPOSITORIES_END
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.4.2'
|
||||
//CHUNK_BUILDSCRIPT_DEPENDENCIES_BEGIN
|
||||
//CHUNK_BUILDSCRIPT_DEPENDENCIES_END
|
||||
classpath libraries.androidGradlePlugin
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
jcenter()
|
||||
//CHUNK_ALLPROJECTS_REPOSITORIES_BEGIN
|
||||
//CHUNK_ALLPROJECTS_REPOSITORIES_END
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.android.support:support-core-utils:28.0.0"
|
||||
//CHUNK_DEPENDENCIES_BEGIN
|
||||
//CHUNK_DEPENDENCIES_END
|
||||
def binDir = "../../../bin/"
|
||||
|
||||
/**
|
||||
* Copy the generated 'android_debug.apk' binary template into the Godot bin directory.
|
||||
* Depends on the app build task to ensure the binary is generated prior to copying.
|
||||
*/
|
||||
task copyDebugBinaryToBin(type: Copy) {
|
||||
dependsOn ':app:build'
|
||||
from('app/build/outputs/apk/debug')
|
||||
into(binDir)
|
||||
include('android_debug.apk')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 28
|
||||
//CHUNK_ANDROID_DEFAULTCONFIG_BEGIN
|
||||
//CHUNK_ANDROID_DEFAULTCONFIG_END
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
disable 'MissingTranslation', 'UnusedResources'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
|
||||
// Both signing and zip-aligning will be done at export time
|
||||
buildTypes.all { buildType ->
|
||||
buildType.zipAlignEnabled false
|
||||
buildType.signingConfig null
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = [
|
||||
'src'
|
||||
//DIR_SRC_BEGIN
|
||||
//DIR_SRC_END
|
||||
]
|
||||
res.srcDirs = [
|
||||
'res'
|
||||
//DIR_RES_BEGIN
|
||||
//DIR_RES_END
|
||||
]
|
||||
aidl.srcDirs = [
|
||||
'aidl'
|
||||
//DIR_AIDL_BEGIN
|
||||
//DIR_AIDL_END
|
||||
]
|
||||
assets.srcDirs = [
|
||||
'assets'
|
||||
//DIR_ASSETS_BEGIN
|
||||
//DIR_ASSETS_END
|
||||
]
|
||||
}
|
||||
debug.jniLibs.srcDirs = [
|
||||
'libs/debug'
|
||||
//DIR_JNI_DEBUG_BEGIN
|
||||
//DIR_JNI_DEBUG_END
|
||||
]
|
||||
release.jniLibs.srcDirs = [
|
||||
'libs/release'
|
||||
//DIR_JNI_RELEASE_BEGIN
|
||||
//DIR_JNI_RELEASE_END
|
||||
]
|
||||
}
|
||||
|
||||
// No longer used, as it's not useful for build source template
|
||||
//applicationVariants.all { variant ->
|
||||
// variant.outputs.all { output ->
|
||||
// output.outputFileName = "../../../../../../../bin/android_${variant.name}.apk"
|
||||
// }
|
||||
//}
|
||||
/**
|
||||
* Copy the generated 'android_release.apk' binary template into the Godot bin directory.
|
||||
* Depends on the app build task to ensure the binary is generated prior to copying.
|
||||
*/
|
||||
task copyReleaseBinaryToBin(type: Copy) {
|
||||
dependsOn ':app:build'
|
||||
from('app/build/outputs/apk/release')
|
||||
into(binDir)
|
||||
include('android_release.apk')
|
||||
}
|
||||
|
||||
//CHUNK_GLOBAL_BEGIN
|
||||
//CHUNK_GLOBAL_END
|
||||
/**
|
||||
* Copy the Godot android library archive debug file into the app debug libs directory.
|
||||
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||
*/
|
||||
task copyDebugAAR(type: Copy) {
|
||||
dependsOn ':lib:build'
|
||||
from('lib/build/outputs/aar')
|
||||
into('app/libs/debug')
|
||||
include('godot-lib.debug.aar')
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the Godot android library archive release file into the app release libs directory.
|
||||
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||
*/
|
||||
task copyReleaseAAR(type: Copy) {
|
||||
dependsOn ':lib:build'
|
||||
from('lib/build/outputs/aar')
|
||||
into('app/libs/release')
|
||||
include('godot-lib.release.aar')
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Godot custom build template by zipping the source files from the app directory, as well
|
||||
* as the AAR files generated by 'copyDebugAAR' and 'copyReleaseAAR'.
|
||||
* The zip file also includes some gradle tools to allow building of the custom build.
|
||||
*/
|
||||
task zipCustomBuild(type: Zip) {
|
||||
dependsOn 'copyDebugAAR'
|
||||
dependsOn 'copyReleaseAAR'
|
||||
from(fileTree(dir: 'app', excludes: ['**/build/**', '**/.gradle/**', '**/*.iml']), fileTree(dir: '.', includes: ['gradle.properties','gradlew', 'gradlew.bat', 'gradle/**']))
|
||||
include '**/*'
|
||||
archiveName 'android_source.zip'
|
||||
destinationDir(file(binDir))
|
||||
}
|
||||
|
||||
/**
|
||||
* Master task used to coordinate the tasks defined above to generate the set of Godot templates.
|
||||
*/
|
||||
task generateGodotTemplates(type: GradleBuild) {
|
||||
tasks = [
|
||||
// Copy the generated aar library files to the custom build directory.
|
||||
'copyDebugAAR', 'copyReleaseAAR',
|
||||
// Zip the custom build directory.
|
||||
'zipCustomBuild',
|
||||
// Copy the prebuilt binary templates to the bin directory.
|
||||
'copyDebugBinaryToBin', 'copyReleaseBinaryToBin',
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#Mon Sep 02 02:44:30 PDT 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
||||
|
19
platform/android/java/lib/AndroidManifest.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.godotengine.godot"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<application>
|
||||
|
||||
<service android:name=".GodotDownloaderService" />
|
||||
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/godot_project_name_string"
|
||||
android:name=".GodotInstrumentation"
|
||||
android:targetPackage="org.godotengine.godot" />
|
||||
|
||||
</manifest>
|
@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(GODOT_ROOT_DIR ../../..)
|
||||
set(GODOT_ROOT_DIR ../../../..)
|
||||
|
||||
# Get sources
|
||||
file(GLOB_RECURSE SOURCES ${GODOT_ROOT_DIR}/*.c**)
|
@ -1,60 +1,43 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.4.2'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
dependencies {
|
||||
implementation "com.android.support:support-core-utils:28.0.0"
|
||||
}
|
||||
|
||||
def pathToRootDir = "../../../"
|
||||
def pathToRootDir = "../../../../"
|
||||
// Note: Only keep the abis you support to speed up the gradle 'assemble' task.
|
||||
def supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
|
||||
|
||||
android {
|
||||
compileSdkVersion versions.compileSdk
|
||||
buildToolsVersion versions.buildTools
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion versions.minSdk
|
||||
targetSdkVersion versions.targetSdk
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
disable "MissingTranslation", 'UnusedResources'
|
||||
disable 'MissingTranslation', 'UnusedResources'
|
||||
}
|
||||
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 28
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
java.srcDirs = ["${pathToRootDir}platform/android/java/src"]
|
||||
res.srcDirs = ["${pathToRootDir}platform/android/java/res"]
|
||||
aidl.srcDirs = ["${pathToRootDir}platform/android/java/aidl"]
|
||||
assets.srcDirs = ["${pathToRootDir}platform/android/java/assets"]
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
aidl.srcDirs = ['aidl']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
debug.jniLibs.srcDirs = ["${pathToRootDir}platform/android/java/libs/debug"]
|
||||
release.jniLibs.srcDirs = ["${pathToRootDir}platform/android/java/libs/release"]
|
||||
debug.jniLibs.srcDirs = ['libs/debug']
|
||||
release.jniLibs.srcDirs = ['libs/release']
|
||||
}
|
||||
|
||||
libraryVariants.all { variant ->
|
@ -175,7 +175,7 @@ index e4b1b0f1c..36cd6aacf 100644
|
||||
-import com.android.vending.expansion.downloader.R;
|
||||
+// -- GODOT start --
|
||||
+//import com.android.vending.expansion.downloader.R;
|
||||
+import com.godot.game.R;
|
||||
+import org.godotengine.godot.R;
|
||||
+// -- GODOT end --
|
||||
|
||||
import java.io.File;
|
||||
@ -250,7 +250,7 @@ index f1536e80e..4b214b22d 100644
|
||||
-import com.android.vending.expansion.downloader.R;
|
||||
+// -- GODOT start --
|
||||
+//import com.android.vending.expansion.downloader.R;
|
||||
+import com.godot.game.R;
|
||||
+import org.godotengine.godot.R;
|
||||
+// -- GODOT end --
|
||||
+
|
||||
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
|
@ -21,7 +21,7 @@ index a0d2779af..a8bf65f9c 100644
|
||||
*/
|
||||
|
||||
+// -- GODOT start --
|
||||
+import com.godot.game.BuildConfig;
|
||||
import org.godotengine.godot.BuildConfig;
|
||||
+// -- GODOT end --
|
||||
+
|
||||
/**
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 718 B |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@ -26,7 +26,7 @@ import android.util.Log;
|
||||
|
||||
// -- GODOT start --
|
||||
//import com.android.vending.expansion.downloader.R;
|
||||
import com.godot.game.R;
|
||||
import org.godotengine.godot.R;
|
||||
// -- GODOT end --
|
||||
|
||||
import java.io.File;
|
@ -18,7 +18,7 @@ package com.google.android.vending.expansion.downloader.impl;
|
||||
|
||||
// -- GODOT start --
|
||||
//import com.android.vending.expansion.downloader.R;
|
||||
import com.godot.game.R;
|
||||
import org.godotengine.godot.R;
|
||||
// -- GODOT end --
|
||||
|
||||
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
|