Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .cursor/rules/wsl-unison-setup.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,35 @@ Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data,
The `scripts/bundle_or_skip.js` wrapper automatically detects and copies the pre-built bundle, skipping Metro on Windows. This is configured via `cliFile` in `android/app/build.gradle`.

See: https://github.com/nativewind/nativewind/issues/1667

## Running Android Instrumentation Tests

Android instrumentation tests (`connectedAndroidTest`) must be run from **Windows**, not WSL. The test runner communicates with the emulator over ports that don't work properly through WSL.

### From WSL Terminal (via PowerShell)

```bash
# Wait for Unison sync after file changes (~15 seconds)
sleep 15

# Run all tests for a specific class
powershell.exe -Command 'cd C:\dev\CN\android; $env:JAVA_HOME = "C:\Program Files\Android\Android_Studio\jbr"; .\gradlew.bat :app:connectedX8664DebugAndroidTest "-Pandroid.testInstrumentationRunnerArguments.class=com.github.quarck.calnotify.monitorstorage.MonitorStorageMigrationTest"'

# Run all instrumentation tests
powershell.exe -Command 'cd C:\dev\CN\android; $env:JAVA_HOME = "C:\Program Files\Android\Android_Studio\jbr"; .\gradlew.bat :app:connectedX8664DebugAndroidTest'
```

### Important Notes

1. **Wait for sync**: Unison syncs every 10 seconds (no inotify on Windows mounts). Wait 15s after file changes before running tests.

2. **JAVA_HOME**: Must be set in PowerShell. Android Studio's bundled JBR is at `C:\Program Files\Android\Android_Studio\jbr`

3. **Test filtering**: Use `-Pandroid.testInstrumentationRunnerArguments.class=...`, NOT `--tests` (which doesn't work for `connectedAndroidTest`)

4. **Signature conflicts**: If you get `INSTALL_FAILED_UPDATE_INCOMPATIBLE`, uninstall the app first:
```bash
adb uninstall com.github.quarck.calnotify
```

5. **Building APKs**: Can be done from either side, but running connected tests requires Windows.
3 changes: 2 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,8 @@ jobs:
if: always() && steps.verify_results.outputs.has_results == 'true'
with:
name: 'Integration Tests (Shard ${{ matrix.shard }})'
path: android/app/build/outputs/*.xml,android/app/build/outputs/**/*.xml
# Exclude allure-results which contain non-JUnit XML files (use comma-separated paths)
path: 'android/app/build/outputs/*.xml,android/app/build/outputs/androidTest-results/**/*.xml,android/app/build/outputs/connected/**/*.xml'
reporter: java-junit
fail-on-error: true

Expand Down
24 changes: 17 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,19 @@ dependencies {
// Jacoco
androidTestImplementation 'org.jacoco:org.jacoco.core:0.8.12'

// Room POC (test only - verifying cr-sqlite compatibility)
// Room database library
// See docs/dev_todo/database_modernization_plan.md
// Note: Room 2.7.0+ required for Kotlin 2.0.x metadata compatibility
// https://developer.android.com/jetpack/androidx/releases/room
def roomVersion = "2.8.4"
androidTestImplementation "androidx.room:room-runtime:$roomVersion"
androidTestImplementation "androidx.room:room-ktx:$roomVersion"
androidTestImplementation "androidx.room:room-testing:$roomVersion"
kspAndroidTest "androidx.room:room-compiler:$roomVersion"
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
ksp "androidx.room:room-compiler:$roomVersion"
// Room 2.8+ uses the new androidx.sqlite library
androidTestImplementation "androidx.sqlite:sqlite:2.6.2"
androidTestImplementation "androidx.sqlite:sqlite-framework:2.6.2"
implementation "androidx.sqlite:sqlite:2.6.2"
implementation "androidx.sqlite:sqlite-framework:2.6.2"
// Room testing support
androidTestImplementation "androidx.room:room-testing:$roomVersion"
}

// https://reactnative.dev/docs/react-native-gradle-plugin
Expand Down Expand Up @@ -396,6 +397,15 @@ afterEvaluate {
.withPathSensitivity(PathSensitivity.RELATIVE)
.optional()
}

// Wire KSP tasks (Room annotation processor)
tasks.matching { it.name.matches('ksp.*Kotlin') }.configureEach { task ->
task.dependsOn(autolinkTask)
task.inputs.dir(autolinkingDir)
.withPropertyName('autolinkingSources')
.withPathSensitivity(PathSensitivity.RELATIVE)
.optional()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.github.quarck.calnotify.database.CrSqliteRoomFactory

/**
* POC Room database configured to use cr-sqlite via CrSqliteRoomFactory.
Expand Down
Loading
Loading