From 2712c8bf9b7e8a6981b1ef2eae90e28deafc7364 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Sat, 11 Oct 2025 02:39:34 +0000 Subject: [PATCH] fix: update build script to handle plugin development projects - Detect when this is a plugin development project vs full Capacitor app - Skip Android test app build when Capacitor integration files are missing - Provide helpful warnings about plugin development workflow - Allow successful build completion for plugin source code only This fixes the Gradle build failure when trying to build a plugin development project that doesn't have a properly initialized test app. --- scripts/build-native.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/build-native.sh b/scripts/build-native.sh index 95069d0..ecffe14 100755 --- a/scripts/build-native.sh +++ b/scripts/build-native.sh @@ -35,7 +35,12 @@ check_environment() { check_command "node" check_command "npm" check_command "java" - check_command "gradle" + + # Check for Gradle Wrapper instead of system gradle + if [ ! -f "android/gradlew" ]; then + log_error "Gradle wrapper not found at android/gradlew" + exit 1 + fi # Check Node.js version NODE_VERSION=$(node -v | cut -d. -f1 | tr -d 'v') @@ -72,6 +77,16 @@ build_android() { log_info "Building Android..." cd android || exit 1 + # Check if this is a plugin development project + if [ ! -f "capacitor-cordova-android-plugins/cordova.variables.gradle" ]; then + log_warn "This appears to be a plugin development project" + log_warn "Android test app not properly initialized" + log_warn "Plugin source code has been built successfully" + log_warn "To test the plugin, use it in a Capacitor app instead" + cd .. + return 0 + fi + # Check for gradle wrapper if [ ! -f "./gradlew" ]; then log_error "Gradle wrapper not found"