diff --git a/README.md b/README.md index 3c251ff..5e663cd 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ You can find the docs for this first-party plugin in the [official Godot docs](h Prerequisites: -- Android SDK (platform version 30) +- Android SDK (platform version 33) - the Godot Android library (`godot-lib.***.release.aar`) for your version of Godot from the [downloads page](https://godotengine.org/download). Steps to build: @@ -21,3 +21,10 @@ Steps to build: 3. Run `./gradlew build` in the cloned repository If the build succeeds, you can find the resulting `.aar` files in `./godot-google-play-billing/build/outputs/aar/`. + +## Installing +- This now uses v2 of the [Android Plugin](https://docs.godotengine.org/en/stable/tutorials/platform/android/android_plugin.html) architecture. (Compatible with Godot 4.2+) +- Choose your preferred language and place the directory `google_play_billing` which is inside of `editor_export_plugin` into the `addons` folder of your Godot project. +- Take the compiled `.aar` files from the plugin and place them in the `libs` folder. +- Enable the plugin from the dedicated project settings tab. (For C# users, press the build button first) +- Make sure to enable Android Gradle builds when exporting. \ No newline at end of file diff --git a/build.gradle b/build.gradle index 25a626a..942d1b5 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:4.0.0" + classpath "com.android.tools.build:gradle:7.4.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/editor_export_plugin/csharp/google_play_billing/GooglePlayBillingConfig.cs b/editor_export_plugin/csharp/google_play_billing/GooglePlayBillingConfig.cs new file mode 100644 index 0000000..68185e3 --- /dev/null +++ b/editor_export_plugin/csharp/google_play_billing/GooglePlayBillingConfig.cs @@ -0,0 +1,83 @@ +#region Copyright +/*************************************************************************/ +/* GooglePlayBillingConfig.cs */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#endregion + +#if TOOLS + +using System; +using Godot; + +namespace GooglePlayBilling; + +[Tool] +public partial class GooglePlayBillingConfig : EditorExportPlugin +{ + private const string PLUGIN_NAME = "GodotGooglePlayBilling"; + + // Dependency paths relative to the project's addons folder. + private const string LIB_PATH_RELEASE = "google_play_billing/libs/GodotGooglePlayBilling.1.2.0.release.aar"; + private const string LIB_PATH_DEBUG = "google_play_billing/libs/GodotGooglePlayBilling.1.2.0.debug.aar"; + private const string BILLING_DEPENDENCY = "com.android.billingclient:billing:5.2.1"; + + + public override bool _SupportsPlatform(EditorExportPlatform platform) + { + if (platform is EditorExportPlatformAndroid) + { + return true; + } + else + { + return false; + } + } + public override string[] _GetAndroidLibraries(EditorExportPlatform platform, bool debug) + { + if (debug) + { + return new string[] { LIB_PATH_DEBUG }; + } + else + { + return new string[] { LIB_PATH_RELEASE }; + } + } + public override string[] _GetAndroidDependencies(EditorExportPlatform platform, bool debug) + { + return new string[] { BILLING_DEPENDENCY }; + } + public override string _GetName() + { + return PLUGIN_NAME; + } +} + +#endif \ No newline at end of file diff --git a/editor_export_plugin/csharp/google_play_billing/GooglePlayBillingEditorPlugin.cs b/editor_export_plugin/csharp/google_play_billing/GooglePlayBillingEditorPlugin.cs new file mode 100644 index 0000000..cf99be7 --- /dev/null +++ b/editor_export_plugin/csharp/google_play_billing/GooglePlayBillingEditorPlugin.cs @@ -0,0 +1,57 @@ +#region Copyright +/*************************************************************************/ +/* GooglePlayBillingEditorPlugin.cs */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#endregion + +#if TOOLS + +using System; +using Godot; + +namespace GooglePlayBilling; + +[Tool] +public partial class GooglePlayBillingEditorPlugin : EditorPlugin +{ + private GooglePlayBillingConfig playBillingConfig; + + public override void _EnterTree() + { + playBillingConfig = new(); + AddExportPlugin(playBillingConfig); + } + public override void _ExitTree() + { + RemoveExportPlugin(playBillingConfig); + playBillingConfig = null; + } +} + +#endif \ No newline at end of file diff --git a/editor_export_plugin/csharp/google_play_billing/libs/put output binaries in this folder b/editor_export_plugin/csharp/google_play_billing/libs/put output binaries in this folder new file mode 100644 index 0000000..e69de29 diff --git a/editor_export_plugin/csharp/google_play_billing/plugin.cfg b/editor_export_plugin/csharp/google_play_billing/plugin.cfg new file mode 100644 index 0000000..a5ef19a --- /dev/null +++ b/editor_export_plugin/csharp/google_play_billing/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Google Play Billing Plugin" +description="Implements purchasing API for Android." +author="Godot Engine" +version="1.0" +script="GooglePlayBillingEditorPlugin.cs" \ No newline at end of file diff --git a/editor_export_plugin/gdscript/google_play_billing/GooglePlayBillingConfig.gd b/editor_export_plugin/gdscript/google_play_billing/GooglePlayBillingConfig.gd new file mode 100644 index 0000000..c835e9c --- /dev/null +++ b/editor_export_plugin/gdscript/google_play_billing/GooglePlayBillingConfig.gd @@ -0,0 +1,57 @@ +#************************************************************************/ +# GooglePlayBillingEditorPlugin.gd */ +#************************************************************************/ +# This file is part of: */ +# GODOT ENGINE */ +# https://godotengine.org */ +#************************************************************************/ +# Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +# Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +# */ +# Permission is hereby granted, free of charge, to any person obtaining */ +# a copy of this software and associated documentation files (the */ +# "Software"), to deal in the Software without restriction, including */ +# without limitation the rights to use, copy, modify, merge, publish, */ +# distribute, sublicense, and/or sell copies of the Software, and to */ +# permit persons to whom the Software is furnished to do so, subject to */ +# the following conditions: */ +# */ +# The above copyright notice and this permission notice shall be */ +# included in all copies or substantial portions of the Software. */ +# */ +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#************************************************************************/ + +@tool +extends EditorExportPlugin + +var _plugin_name = "GodotGooglePlayBilling" + +# Dependency paths relative to the project's addons folder. +var _lib_path_release = "google_play_billing/libs/GodotGooglePlayBilling.1.2.0.release.aar" +var _lib_path_debug = "google_play_billing/libs/GodotGooglePlayBilling.1.2.0.debug.aar" +var _billing_dependency = "com.android.billingclient:billing:5.2.1" + +func _supports_platform(platform): + if (platform is EditorExportPlatformAndroid): + return true + else: + return false + +func _get_android_libraries(platform, debug): + if (debug): + return PackedStringArray([_lib_path_debug]) + else: + return PackedStringArray([_lib_path_release]) + +func _get_android_dependencies(platform, debug): + return PackedStringArray([_billing_dependency]) + +func _get_name(): + return _plugin_name \ No newline at end of file diff --git a/editor_export_plugin/gdscript/google_play_billing/GooglePlayBillingEditorPlugin.gd b/editor_export_plugin/gdscript/google_play_billing/GooglePlayBillingEditorPlugin.gd new file mode 100644 index 0000000..1e178ff --- /dev/null +++ b/editor_export_plugin/gdscript/google_play_billing/GooglePlayBillingEditorPlugin.gd @@ -0,0 +1,42 @@ +#************************************************************************/ +# GooglePlayBillingEditorPlugin.gd */ +#************************************************************************/ +# This file is part of: */ +# GODOT ENGINE */ +# https://godotengine.org */ +#************************************************************************/ +# Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +# Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +# */ +# Permission is hereby granted, free of charge, to any person obtaining */ +# a copy of this software and associated documentation files (the */ +# "Software"), to deal in the Software without restriction, including */ +# without limitation the rights to use, copy, modify, merge, publish, */ +# distribute, sublicense, and/or sell copies of the Software, and to */ +# permit persons to whom the Software is furnished to do so, subject to */ +# the following conditions: */ +# */ +# The above copyright notice and this permission notice shall be */ +# included in all copies or substantial portions of the Software. */ +# */ +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#************************************************************************/ + +@tool +extends EditorPlugin + +var play_billing_config : GooglePlayBillingConfig + +func _enter_tree(): + play_billing_config = AndroidExportPlugin.new() + add_export_plugin(play_billing_config) + +func _exit_tree(): + remove_export_plugin(play_billing_config) + play_billing_config = null \ No newline at end of file diff --git a/editor_export_plugin/gdscript/google_play_billing/libs/put output binaries in this folder b/editor_export_plugin/gdscript/google_play_billing/libs/put output binaries in this folder new file mode 100644 index 0000000..e69de29 diff --git a/editor_export_plugin/gdscript/google_play_billing/plugin.cfg b/editor_export_plugin/gdscript/google_play_billing/plugin.cfg new file mode 100644 index 0000000..00c589e --- /dev/null +++ b/editor_export_plugin/gdscript/google_play_billing/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Google Play Billing Plugin" +description="Implements purchasing API for Android." +author="Godot Engine" +version="1.0" +script="GooglePlayBillingEditorPlugin.gd" \ No newline at end of file diff --git a/godot-google-play-billing/build.gradle b/godot-google-play-billing/build.gradle index abc981d..e14c13d 100644 --- a/godot-google-play-billing/build.gradle +++ b/godot-google-play-billing/build.gradle @@ -6,12 +6,12 @@ ext.pluginVersionCode = 5 ext.pluginVersionName = "1.2.0" android { - compileSdkVersion 31 + compileSdk 33 buildToolsVersion "30.0.3" defaultConfig { - minSdkVersion 18 - targetSdkVersion 31 + minSdk 24 + targetSdk 33 versionCode pluginVersionCode versionName pluginVersionName } diff --git a/godot-google-play-billing/libs/put 'godot-lib.arr' in this folder b/godot-google-play-billing/libs/put 'godot-lib.arr' in this folder new file mode 100644 index 0000000..e69de29 diff --git a/godot-google-play-billing/src/main/AndroidManifest.xml b/godot-google-play-billing/src/main/AndroidManifest.xml index f64f031..761df5f 100644 --- a/godot-google-play-billing/src/main/AndroidManifest.xml +++ b/godot-google-play-billing/src/main/AndroidManifest.xml @@ -4,7 +4,7 @@ diff --git a/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/GodotGooglePlayBilling.java b/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/GodotGooglePlayBilling.java index 1baa7dd..20682bf 100644 --- a/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/GodotGooglePlayBilling.java +++ b/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/GodotGooglePlayBilling.java @@ -1,5 +1,5 @@ /*************************************************************************/ -/* GodotGooglePlayBilling.java */ +/* GodotGooglePlayBilling.java */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/utils/GooglePlayBillingUtils.java b/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/utils/GooglePlayBillingUtils.java index 1c1cb28..d7822f5 100644 --- a/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/utils/GooglePlayBillingUtils.java +++ b/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/utils/GooglePlayBillingUtils.java @@ -1,5 +1,5 @@ /*************************************************************************/ -/* GooglePlayBillingUtils.java */ +/* GooglePlayBillingUtils.java */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fef635c..3bd4782 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jun 15 13:39:16 CEST 2020 +#Mon Apr 29 14:02:56 EDT 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip