-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leverage Android archive (AAR) file for Godot custom build #31919
Leverage Android archive (AAR) file for Godot custom build #31919
Conversation
Awesome work! You should be able to fix the style checks with this patch: diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format
index 3a0ac9f38..e309233a8 100755
--- a/misc/hooks/pre-commit-clang-format
+++ b/misc/hooks/pre-commit-clang-format
@@ -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
diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh
index 48378281d..097b2a937 100755
--- a/misc/travis/clang-format.sh
+++ b/misc/travis/clang-format.sh
@@ -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 |
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the reference, I don't know why those changes were needed in the first place. Might be worth reviewing whether they actually are, and if so see if we can contribute a change upstream to make these files package-agnostic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are needed because we're not using the library correctly. It's intended to be used as an android library, actually in a similar way to what I'm doing in this PR.
Directly adding the library source code into our own codebase is what's creating the need for the patch. I can look into cleanup that dependency later on.
.../java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
Outdated
Show resolved
Hide resolved
Could you squash commits together? (at least the style fixes, the removal of |
This looks awesome from a quick overview, thanks a ton! One concern is that there is now some amount of duplication around the |
The duplication was mostly with the |
…(`lib`) and an application module (`app`). The application module `app` serves double duties of providing the prebuilt Godot binaries ('android_debug.apk', 'android_release.apk') and the Godot custom build template ('android_source.zip').
b299391
to
f2d203a
Compare
Done. the commits have been squashed together and the removal of |
Thanks! Sorry for the delay merging this, was on holidays :) |
No problem, thanks! |
As discussed in PR #31706, this PR leverages the Android library and its output file format (AAR file) to improve the Godot custom build process, and in the process the generation of the Godot prebuilt export templates.
This is done via the following steps:
platfrom/android/java
toplatform/android/java/lib
(responsible for the large number of changed files)lib/build.gradle
accordingly to reflect the new status as Android library. Additional gradle tasks were added to automatically generate the Godot Android shared (.so) files viascons
when the library is built.lib/AndroidManifest.xml
file accordingly to reflect the Android library change.Godot.java
is made abstract to prevent its direct use as an activity.prebuiltApp
binary module is added to replace the previous binary module responsible for generating the prebuilt export templatesPrebuiltApp.java
extendsGodot.java
customApp
binary module is added which serves as template for Godot custom build process. The module depends on exportedAAR
files to access and use Godot's functionality.To simplify the generation of the Godot prebuilt (
android_debug.apk
,android_release.apk
) and custom build (android_source.zip
) templates, a set of gradle tasks are added.They can now be generated via the following steps:
cd platform/android/java
./gradlew generateGodotTemplates
The resulting outputs (
android_debug.apk
,android_release.apk
,android_source.zip
) can be found under the Godotbin
directory.Misc cleanup: Removed the
jetbrains
ide setup directory as it's made obsolete by the new layout structure inplatform/android/java
.