fix(cli): accept Kotlin source directory in cap doctor
Description
cap doctor reports a false positive for Android projects that use Kotlin as their only source language. The main activity check in @capacitor/cli probes only app/src/main/java for the MainActivity, so projects that place their source in app/src/main/kotlin (the documented plugin authoring language) fail with:
java directory is missing in android/app/src/main/java
even though the app is perfectly valid.
This PR makes the check accept either source directory: it probes both java and kotlin under src/main, fails only when neither exists, and scans whichever are present (the file filter already accepted .kt files).
Change Type
- Fix
- Feature
- Refactor
- Breaking Change
- Documentation
- Other (CI, chores, etc.)
Rationale / Problems Fixed
Kotlin-only Capacitor apps trigger a misleading doctor error that makes a healthy project look broken. The fix removes the false positive without weakening the check for genuinely missing source layouts.
Tests or Reproductions
npx jest -i test/doctor.android.spec.ts— new suite with 5 cases: Kotlin-only passes, Java-only passes (no regression), both directories pass, neither directory rejects with the updated message, Kotlin without aMainActivitystill rejects withMain activity file (...) is missing.npx jest -i— 57 tests pass across 9 suites. The 4 failing suites (migrate-uiscene-*,xcode.spec.ts) are pre-existing environment failures unrelated to this change (missing@types/xcodein the dev node_modules).npx tsc --noEmit— no new errors.
Screenshots / Media
N/A
Platforms Affected
- Android
- iOS
- Web
Notes / Comments
The error message changes from java directory is missing in ... to java or kotlin directory is missing in ... so it stays accurate for both layouts.