Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Firebase MCP server to detect Crashlytics in Gradle version catalogs (*.versions.toml) in addition to build.gradle files. It extracts file patterns to scan for both Android and iOS into constants and updates the detection logic accordingly. Comprehensive unit tests are added to verify this behavior. The reviewer suggested adding an additional test case to ensure camelCase firebaseCrashlytics is correctly detected directly in build.gradle files.
| it("should return true for an Android project with Crashlytics library in gradle/libs.versions.toml", async () => { | ||
| mockfs({ | ||
| "/test-dir": { | ||
| gradle: { | ||
| "libs.versions.toml": | ||
| '[libraries]\ncrashlytics = { module = "com.google.firebase:firebase-crashlytics", version = "21.0.0" }', | ||
| }, | ||
| android: { | ||
| "build.gradle.kts": "dependencies { implementation(libs.crashlytics) }", | ||
| src: { main: {} }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const result = await isCrashlyticsAvailable(mockContext("/test-dir")); | ||
|
|
||
| expect(result).to.be.true; | ||
| }); |
There was a problem hiding this comment.
Add Test Case for camelCase firebaseCrashlytics in build.gradle
To ensure that camelCase firebaseCrashlytics is correctly detected directly in build.gradle (or build.gradle.kts) files without relying on version catalogs, we should add a test case specifically for this scenario.
it("should return true for an Android project with Crashlytics library in gradle/libs.versions.toml", async () => {
mockfs({
"/test-dir": {
gradle: {
"libs.versions.toml":
'[libraries]\ncrashlytics = { module = "com.google.firebase:firebase-crashlytics", version = "21.0.0" }',
},
android: {
"build.gradle.kts": "dependencies { implementation(libs.crashlytics) }",
src: { main: {} },
},
},
});
const result = await isCrashlyticsAvailable(mockContext("/test-dir"));
expect(result).to.be.true;
});
it("should return true for an Android project with camelCase firebaseCrashlytics in build.gradle", async () => {
mockfs({
"/test-dir": {
android: {
"build.gradle": "dependencies { implementation libs.firebaseCrashlytics }",
src: { main: {} },
},
},
});
const result = await isCrashlyticsAvailable(mockContext("/test-dir"));
expect(result).to.be.true;
});There was a problem hiding this comment.
we probably don't need to look for camelCase firebaseCrashlytics in build.gradle files since the dependency firebase-crashlytics would be declared in *.versions.toml
Description
Fixes #11351
Scenarios Tested
verified that
crashlyticstool is enabled vianpx -y @modelcontextprotocol/inspector@latestSample Commands
Notes
camelCase naming convention from what I can gather isn't recommended. Recommended convention is kebab-case, however camelCase is still used in some cases
our detection code failed to parse build.gradle since
firebaseCrashlyticsis in camel casefirebase-tools/src/mcp/util/crashlytics/availability.ts
Lines 57 to 68 in 83ffba0
Parsing the existing
*.versions.tomlshould fix this since thefirebase-crashlyticsdependency would be listed there ascom.google.firebase:firebase-crashlytics