From 0b3d269f647368e033f20438f0bc6445ce9cf629 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 28 Oct 2025 09:46:33 +0000 Subject: [PATCH] feat(scripts): add automated test app build with plugin integration Enhanced build-native.sh to automatically build plugin and test app together: - Detects test app directory presence - Builds plugin AAR first - Removes stale AAR from test app's libs directory - Ensures symlink is in place for fresh plugin source - Builds test app with latest plugin code - Provides install command with APK path This automates the manual AAR copying workflow, ensuring test app always uses the latest plugin build without stale artifacts. The build process now: 1. Builds TypeScript interface 2. Builds plugin AAR 3. Removes any stale AAR from libs/ 4. Creates/verifies symlink to plugin source 5. Builds test app APK 6. Provides install command Benefits: - No manual file copying required - Fresh plugin code always included - Single command to rebuild everything --- scripts/build-native.sh | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/scripts/build-native.sh b/scripts/build-native.sh index 33e3f9a..7c598b7 100755 --- a/scripts/build-native.sh +++ b/scripts/build-native.sh @@ -73,8 +73,72 @@ build_typescript() { fi } +build_plugin_for_test_app() { + log_info "Building plugin for test app..." + + # Build the plugin AAR + log_info "Building plugin AAR..." + cd android || exit 1 + if ! ./gradlew :plugin:clean :plugin:assembleDebug; then + log_error "Plugin build failed" + exit 1 + fi + + AAR_FILE="plugin/build/outputs/aar/plugin-debug.aar" + if [ ! -f "$AAR_FILE" ]; then + log_error "AAR file not found at $AAR_FILE" + exit 1 + fi + log_info "Plugin AAR built: $AAR_FILE" + + # Remove any stale AAR from test app's libs directory + if [ -f "../test-apps/daily-notification-test/android/app/libs/plugin-debug.aar" ]; then + log_info "Removing stale AAR from test app libs..." + rm "../test-apps/daily-notification-test/android/app/libs/plugin-debug.aar" + fi + + cd .. + + # Ensure symlink is in place + SYMLINK="test-apps/daily-notification-test/node_modules/@timesafari/daily-notification-plugin" + if [ ! -L "$SYMLINK" ] || [ ! -e "$SYMLINK" ]; then + log_info "Creating symlink to plugin..." + mkdir -p "$(dirname "$SYMLINK")" + rm -f "$SYMLINK" + ln -sf "../../../" "$SYMLINK" + fi + + # Build test app + log_info "Building test app..." + cd test-apps/daily-notification-test/android || exit 1 + + if ! ./gradlew clean assembleDebug; then + log_error "Test app build failed" + exit 1 + fi + + APK_FILE="app/build/outputs/apk/debug/app-debug.apk" + if [ ! -f "$APK_FILE" ]; then + log_error "APK file not found at $APK_FILE" + exit 1 + fi + + log_info "Test app build successful: $APK_FILE" + log_info "Install with: adb install -r $APK_FILE" + + cd ../../.. +} + build_android() { log_info "Building Android..." + + # Detect project type + if [ -d "test-apps/daily-notification-test" ]; then + log_info "Detected test app. Building plugin and test app together..." + build_plugin_for_test_app + return 0 + fi + cd android || exit 1 # Check if this is a plugin development project