diff options
author | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-08-17 14:37:44 -0700 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-08-17 14:37:44 -0700 |
commit | c734dd980de4bcd2351ef80a4956646506402ab1 (patch) | |
tree | 44c106860be98efa7bd2d77ab8bd2baa632867ff | |
parent | f42745b1d88e7ad563f1fd9668c04ed8b261189b (diff) | |
download | godot-android-samples-c734dd980de4bcd2351ef80a4956646506402ab1.tar.gz godot-android-samples-c734dd980de4bcd2351ef80a4956646506402ab1.tar.bz2 godot-android-samples-c734dd980de4bcd2351ef80a4956646506402ab1.zip |
Update the 'Hello Signals' plugin sample to match updates to the addon's folder structure
15 files changed, 54 insertions, 18 deletions
diff --git a/plugins/hello_signals/README.md b/plugins/hello_signals/README.md index 7845f21..a6c39e8 100644 --- a/plugins/hello_signals/README.md +++ b/plugins/hello_signals/README.md @@ -2,3 +2,18 @@ Showcases how to build a Godot Android plugin which is invoked from gdscript and emit signals from the java logic. + +### Building the Hello Signals plugin + +Use the following commands to build the plugin: + +``` +cd Godot-Android-Samples +./gradlew :plugins:hello_signals:assemble +``` + +The generated artifact can be found under [`demo/addons`](src/main/assets/addons). + +### Usage + +Open the [`demo`](demo) project in the Godot Editor diff --git a/plugins/hello_signals/build.gradle b/plugins/hello_signals/build.gradle index 6549636..eff0811 100644 --- a/plugins/hello_signals/build.gradle +++ b/plugins/hello_signals/build.gradle @@ -13,9 +13,11 @@ android { versionName "1.0" } + namespace = "fhuyakou.godot.plugin.android.hellosignals" + // Used to customize the name of generated AAR file. - libraryVariants.all { variant -> - variant.outputs.all { output -> + libraryVariants.configureEach { variant -> + variant.outputs.configureEach { output -> output.outputFileName = "HelloSignals.${variant.name}.aar" } } @@ -23,21 +25,34 @@ android { } dependencies { - compileOnly "org.godotengine:godot:$versions.godotLibVersion" + // TODO: Update the godot dep when 4.2 is stable + compileOnly "io.github.m4gr3d:godot:4.2.0.dev-SNAPSHOT" implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlinVersion" } -task copyDebugAARToAddons(type: Copy) { +tasks.register('copyDebugAARToAddons', Copy) { from 'build/outputs/aar' include 'HelloSignals.debug.aar' - into 'demo/addons/hello_signals_plugin/export' + into 'src/main/assets/addons/hello_signals_plugin/.bin/debug' } -task copyReleaseAARToAddons(type: Copy) { +tasks.register('copyReleaseAARToAddons', Copy) { from 'build/outputs/aar' include 'HelloSignals.release.aar' - into 'demo/addons/hello_signals_plugin/export' + into 'src/main/assets/addons/hello_signals_plugin/.bin/release' +} + +tasks.register('copyAddonsToDemo', Copy) { + dependsOn(copyDebugAARToAddons) + dependsOn(copyReleaseAARToAddons) + + doFirst { + delete('demo/addons/hello_signals_plugin') + } + from 'src/main/assets/addons/hello_signals_plugin' + into 'demo/addons/hello_signals_plugin' } assemble.finalizedBy(copyDebugAARToAddons) assemble.finalizedBy(copyReleaseAARToAddons) +assemble.finalizedBy(copyAddonsToDemo) diff --git a/plugins/hello_signals/demo/addons/.gitignore b/plugins/hello_signals/demo/addons/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/plugins/hello_signals/demo/addons/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar Binary files differdeleted file mode 100644 index d241ab1..0000000 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar +++ /dev/null diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar Binary files differdeleted file mode 100644 index 6dae345..0000000 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar +++ /dev/null diff --git a/plugins/hello_signals/demo/export_presets.cfg b/plugins/hello_signals/demo/export_presets.cfg index 1d4cb1f..44a32e5 100644 --- a/plugins/hello_signals/demo/export_presets.cfg +++ b/plugins/hello_signals/demo/export_presets.cfg @@ -8,7 +8,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="android/Hello Signals Plugin Demo.apk" +export_path="" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -22,7 +22,7 @@ gradle_build/use_gradle_build=true gradle_build/export_format=0 gradle_build/min_sdk="" gradle_build/target_sdk="" -architectures/armeabi-v7a=true +architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false architectures/x86_64=false @@ -34,6 +34,8 @@ package/signed=true package/app_category=2 package/retain_data_on_uninstall=false package/exclude_from_recents=false +package/show_in_android_tv=false +package/show_as_launcher_app=false launcher_icons/main_192x192="" launcher_icons/adaptive_foreground_432x432="" launcher_icons/adaptive_background_432x432="" diff --git a/plugins/hello_signals/demo/project.godot b/plugins/hello_signals/demo/project.godot index 655eefc..637a2e0 100644 --- a/plugins/hello_signals/demo/project.godot +++ b/plugins/hello_signals/demo/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="Hello Signals Plugin Demo" run/main_scene="res://Main.tscn" -config/features=PackedStringArray("4.1") +config/features=PackedStringArray("4.2") config/icon="res://icon.png" [debug] diff --git a/plugins/hello_signals/src/main/AndroidManifest.xml b/plugins/hello_signals/src/main/AndroidManifest.xml index 8f791bd..45f0e71 100644 --- a/plugins/hello_signals/src/main/AndroidManifest.xml +++ b/plugins/hello_signals/src/main/AndroidManifest.xml @@ -1,11 +1,10 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="fhuyakou.godot.plugin.android.hellosignals"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application> <!-- Plugin metadata: - - In the `android:name` attribute, the `org.godotengine.plugin.v1` prefix + - In the `android:name` attribute, the `org.godotengine.plugin.v2` prefix is required so Godot can recognize the project as a valid Godot Android plugin. The plugin name following the prefix should match the value of the plugin name returned by the plugin initializer. @@ -14,7 +13,7 @@ initializer. --> <meta-data - android:name="org.godotengine.plugin.v1.HelloSignals" + android:name="org.godotengine.plugin.v2.HelloSignals" android:value="fhuyakou.godot.plugin.android.hellosignals.HelloSignalsPlugin" /> </application> </manifest> diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore index 8b13789..8b13789 100644 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore new file mode 100644 index 0000000..375ed0d --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.gdignore diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore @@ -0,0 +1 @@ + diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd index f0f3288..ca0bcf4 100644 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd @@ -8,9 +8,9 @@ func _supports_platform(platform): func _get_android_libraries(platform, debug): if debug: - return PackedStringArray(["hello_signals_plugin/export/HelloSignals.debug.aar"]) + return PackedStringArray(["hello_signals_plugin/.bin/debug/HelloSignals.debug.aar"]) else: - return PackedStringArray(["hello_signals_plugin/export/HelloSignals.release.aar"]) + return PackedStringArray(["hello_signals_plugin/.bin/release/HelloSignals.release.aar"]) func _get_name(): return "Hello Signals plugin" diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd index 5c71083..5df34a9 100644 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd @@ -8,7 +8,6 @@ func _enter_tree(): # Initialization of the plugin goes here. export_plugin = preload("hello_signals_editor_export_plugin.gd").new() add_export_plugin(export_plugin) - pass func _exit_tree(): diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/interface/hello_signals_plugin.gd index 0cc9c1d..0cc9c1d 100644 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/interface/hello_signals_plugin.gd diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/plugin.cfg index b32555f..ca4a695 100644 --- a/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/plugin.cfg @@ -4,4 +4,4 @@ name="Hello Signals plugin" description="Showcases how to package a sample Android plugin" author="Fredia Huya-Kouadio" version="" -script="export/hello_signals_editor_plugin.gd" +script=".export/hello_signals_editor_plugin.gd" |