fix(cli): accept Kotlin source directory in cap doctor - #8600
Open
fabiomartino wants to merge 1 commit into
Open
fabiomartino wants to merge 1 commit into
fabiomartino wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
cap doctorreports a false positive for Android projects that use Kotlin as their only source language. The main activity check in@capacitor/cliprobes onlyapp/src/main/javafor theMainActivity, so projects that place their source inapp/src/main/kotlin(the documented plugin authoring language) fail with:even though the app is perfectly valid.
This PR makes the check accept either source directory: it probes both
javaandkotlinundersrc/main, fails only when neither exists, and scans whichever are present (the file filter already accepted.ktfiles).Change Type
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
Notes / Comments
The error message changes from
java directory is missing in ...tojava or kotlin directory is missing in ...so it stays accurate for both layouts.