diff --git a/.gitignore b/.gitignore index 7f32f88..2ed69fa 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ android/.gradle/ android/build/ android/local.properties android/libs/ -*.aar +android/*.aar # iOS - Old native plugin (deprecated, now using GDExtension) /ios/ @@ -67,8 +67,11 @@ Thumbs.db docs/.docusaurus/ docs/node_modules/ -# Android binaries (built locally, not committed) -addons/godot-iap/android/*.aar +# Android binaries are committed to git (like iOS frameworks) for Asset Library compatibility +# addons/godot-iap/android/*.aar - TRACKED + +# Old Android binaries in bin/ (deprecated location, use addons/godot-iap/android/ instead) +addons/godot-iap/bin/android/ # iOS frameworks are committed to git for faster CI builds # addons/godot-iap/bin/ios/ - TRACKED diff --git a/Makefile b/Makefile index 60c40fd..b9837d9 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ GODOT_VERSION ?= 4.3 GODOT_LIB_URL = https://github.com/godotengine/godot/releases/download/$(GODOT_VERSION)-stable/godot-lib.$(GODOT_VERSION).stable.template_release.aar +SWIFT_GODOT_VERSION ?= v0.74.0 # Directories PROJECT_ROOT := $(shell pwd) @@ -82,6 +83,14 @@ setup: else \ echo "$(GREEN)✓ godot-lib.aar already exists$(NC)"; \ fi + @if [ ! -d "$(PROJECT_ROOT)/SwiftGodot" ]; then \ + echo "$(YELLOW)Cloning SwiftGodot ($(SWIFT_GODOT_VERSION))...$(NC)"; \ + git clone --depth 1 --branch $(SWIFT_GODOT_VERSION) https://github.com/migueldeicaza/SwiftGodot.git "$(PROJECT_ROOT)/SwiftGodot" || \ + (echo "$(RED)Failed to clone SwiftGodot$(NC)" && exit 1); \ + echo "$(GREEN)✓ SwiftGodot cloned$(NC)"; \ + else \ + echo "$(GREEN)✓ SwiftGodot already exists$(NC)"; \ + fi @echo "$(GREEN)Installing git hooks...$(NC)" @$(PROJECT_ROOT)/scripts/install-hooks.sh @echo "$(GREEN)Setup complete!$(NC)" @@ -120,6 +129,18 @@ macos-build: android: setup gradle-wrapper @echo "$(GREEN)Building Android plugin...$(NC)" @cd $(ANDROID_DIR) && ./gradlew copyReleaseAarToAddons + @echo "$(GREEN)Generating GDAP file...$(NC)" + @OPENIAP_VERSION=$$(python3 -c "import json; print(json.load(open('$(PROJECT_ROOT)/openiap-versions.json'))['google'])"); \ + printf '%s\n' \ + '[config]' \ + 'name="GodotIap"' \ + 'binary_type="local"' \ + 'binary="GodotIap.release.aar"' \ + '' \ + '[dependencies]' \ + 'local=[]' \ + "remote=[\"com.android.billingclient:billing:7.1.1\", \"io.github.hyochan.openiap:openiap-google:$$OPENIAP_VERSION\"]" \ + > $(ADDON_DIR)/android/GodotIap.gdap @echo "$(GREEN)✓ Android plugin built$(NC)" @echo "Output: $(ADDON_DIR)/android/" @ls -la $(ADDON_DIR)/android/*.aar 2>/dev/null || echo " (AAR files will appear after successful build)" diff --git a/addons/godot-iap/android/GodotIap.debug.aar b/addons/godot-iap/android/GodotIap.debug.aar new file mode 100644 index 0000000..dc39ee9 Binary files /dev/null and b/addons/godot-iap/android/GodotIap.debug.aar differ diff --git a/addons/godot-iap/android/GodotIap.gdap b/addons/godot-iap/android/GodotIap.gdap new file mode 100644 index 0000000..203f4b5 --- /dev/null +++ b/addons/godot-iap/android/GodotIap.gdap @@ -0,0 +1,8 @@ +[config] +name="GodotIap" +binary_type="local" +binary="GodotIap.release.aar" + +[dependencies] +local=[] +remote=["com.android.billingclient:billing:7.1.1", "io.github.hyochan.openiap:openiap-google:1.3.28"] diff --git a/addons/godot-iap/android/GodotIap.release.aar b/addons/godot-iap/android/GodotIap.release.aar new file mode 100644 index 0000000..2282d17 Binary files /dev/null and b/addons/godot-iap/android/GodotIap.release.aar differ diff --git a/scripts/pre-commit b/scripts/pre-commit index 86e372d..20abbb7 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -25,6 +25,7 @@ if [ -n "$VERSIONS_CHANGED" ]; then # Stage the updated files git add "$PROJECT_ROOT/addons/godot-iap/godot_iap_plugin.gd" 2>/dev/null git add "$PROJECT_ROOT/Example/addons/godot-iap/godot_iap_plugin.gd" 2>/dev/null + git add "$PROJECT_ROOT/addons/godot-iap/android/GodotIap.gdap" 2>/dev/null echo -e "${GREEN}✓ Version sync complete${NC}" fi echo "" diff --git a/scripts/sync-versions.sh b/scripts/sync-versions.sh index 608d8d7..21034c1 100755 --- a/scripts/sync-versions.sh +++ b/scripts/sync-versions.sh @@ -42,4 +42,15 @@ if [ -f "$PLUGIN_FILE" ]; then echo "Updated: Example/addons/godot-iap/godot_iap_plugin.gd" fi +# Update GDAP file Android dependencies +GDAP_FILE="$PROJECT_ROOT/addons/godot-iap/android/GodotIap.gdap" +if [ -f "$GDAP_FILE" ]; then + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "s/openiap-google:[0-9.]*\"/openiap-google:$GOOGLE_VERSION\"/g" "$GDAP_FILE" + else + sed -i "s/openiap-google:[0-9.]*\"/openiap-google:$GOOGLE_VERSION\"/g" "$GDAP_FILE" + fi + echo "Updated: addons/godot-iap/android/GodotIap.gdap" +fi + echo "Version sync complete!"