Update API coverage badges
The API Coverage badge for each module in the README's Available libraries
table is the percentage of public firebase-android-sdk API members that this SDK
invokes:
coverage = (Android SDK members invoked from the module's androidMain sources)
/ (all public, non-deprecated members in the module's api.txt on main)
The Android API surface comes from
https://github.com/firebase/firebase-android-sdk/blob/main/firebase-<module>/api.txt.
Steps
From the repository root run:
python3 .claude/skills/update-api-coverage/api_coverage.py --write
It downloads each api.txt from the main branch of firebase-android-sdk, computes
the percentages, prints a table, and rewrites the badge for every module it knows
about in README.md. Add -v to see which members of each class are counted as
used or missing, and --exclude-pipeline to leave out the Firestore Pipeline
API (a large, separately-gated surface that this SDK does not wrap).
If GitHub raw content is unreachable, save the api.txt files as
<module>.txt in a directory and pass --api-dir DIR.
Review git diff README.md. Badge colour is green above 60%, orange otherwise.
Commit the README change.
Counting rules (implemented in api_coverage.py)
- A member is one of
ctor, method, field, enum_constant, or property in
api.txt. Overloads collapse to one entry per (class, name). @Deprecated,
@RestrictTo, non-public members, annotation types, Companion and INSTANCE
are excluded. A Kotlin property and its synthetic getX/setX/isX count once.
- A member is invoked when the module's
src/androidMain Kotlin calls it
(name(, name {, ::name), reads or writes it as a Kotlin property
(.x for getX, .isX, .x = for setX), references a field or enum constant
by name, or constructs the class. Declarations in the wrapper (fun name(,
val name) do not count.
- Every member of an Android class exposed through a
public actual typealias
(exceptions, enums such as Direction, ChangeType, FunctionsExceptionCode)
counts as invoked, because users get the whole class.
- Firestore
Pipeline* classes and the com.google.firebase.firestore.pipeline
packages count as unused unless the module sources mention "pipeline", to avoid
false matches on generic names such as where and limit.
Authentication and Analytics (no api.txt)
These two Android libraries are closed source and have no module in
firebase-android-sdk, so the script lists their API from the AARs instead
(this reproduces the method used in PR #874: Authentication 166/314 = 53%,
Analytics 26/160 = 16%). It needs javap from a JDK and access to Google Maven:
- The BOM version is read from
gradle/libs.versions.toml and the BOM POM is
fetched from https://dl.google.com/dl/android/maven2/ to resolve the library
versions (BOM 34.18.0: firebase-auth 24.2.0, firebase-analytics 23.2.0).
- The AARs are downloaded and
classes.jar extracted:
- Authentication:
com.google.firebase:firebase-auth, package com.google.firebase.auth.
- Analytics: the
firebase-analytics AAR is an empty shim, so the script reads
the play-services-measurement-api version from the firebase-analytics POM
and downloads com.google.android.gms:play-services-measurement-api
(23.2.0 for BOM 34.18.0), package com.google.firebase.analytics.
javap -v runs over every class in that package and its sub-packages except
internal and connector. Non-public, synthetic, bridge and deprecated
members are dropped, as are obfuscated zz* names, $-suffixed helpers,
anonymous and lambda classes, and enum values/valueOf. The result feeds
the same counting rules as the api.txt modules; the Kotlin facade classes
(FirebaseAuthKt, AnalyticsKt) and DSL receivers such as ConsentBuilder
are ordinary classes here and count by member name.
- The Analytics total includes the 118 string constants on
FirebaseAnalytics.Event, Param and UserProperty, which the Kotlin SDK
does not expose. They stay in for consistency with the api.txt badges, which
count constants too.
If Google Maven is blocked in the sandbox, download the two AARs elsewhere, put
them in a directory as firebase-auth-<version>.aar and
play-services-measurement-api-<version>.aar, and pass --aar-dir DIR. If that
is not possible either, run the script for the other modules only
(api_coverage.py --write database firestore ...) and say the two badges were
not recalculated rather than estimating them.
1---2name: update-api-coverage3description: Recalculate the "API Coverage" badges in the README's Available libraries table by comparing each module's androidMain sources against the firebase-android-sdk api.txt files.4---56# Update API coverage badges78The **API Coverage** badge for each module in the README's *Available libraries*9table is the percentage of public firebase-android-sdk API members that this SDK10invokes:1112 coverage = (Android SDK members invoked from the module's androidMain sources)13 / (all public, non-deprecated members in the module's api.txt on main)1415The Android API surface comes from16`https://github.com/firebase/firebase-android-sdk/blob/main/firebase-<module>/api.txt`.1718## Steps19201. From the repository root run:2122 python3 .claude/skills/update-api-coverage/api_coverage.py --write2324 It downloads each api.txt from the `main` branch of firebase-android-sdk, computes25 the percentages, prints a table, and rewrites the badge for every module it knows26 about in `README.md`. Add `-v` to see which members of each class are counted as27 used or missing, and `--exclude-pipeline` to leave out the Firestore Pipeline28 API (a large, separately-gated surface that this SDK does not wrap).29 If GitHub raw content is unreachable, save the api.txt files as30 `<module>.txt` in a directory and pass `--api-dir DIR`.31322. Review `git diff README.md`. Badge colour is green above 60%, orange otherwise.33343. Commit the README change.3536## Counting rules (implemented in `api_coverage.py`)3738- A member is one of `ctor`, `method`, `field`, `enum_constant`, or `property` in39 api.txt. Overloads collapse to one entry per (class, name). `@Deprecated`,40 `@RestrictTo`, non-public members, annotation types, `Companion` and `INSTANCE`41 are excluded. A Kotlin `property` and its synthetic `getX`/`setX`/`isX` count once.42- A member is *invoked* when the module's `src/androidMain` Kotlin calls it43 (`name(`, `name {`, `::name`), reads or writes it as a Kotlin property44 (`.x` for `getX`, `.isX`, `.x =` for `setX`), references a field or enum constant45 by name, or constructs the class. Declarations in the wrapper (`fun name(`,46 `val name`) do not count.47- Every member of an Android class exposed through a `public actual typealias`48 (exceptions, enums such as `Direction`, `ChangeType`, `FunctionsExceptionCode`)49 counts as invoked, because users get the whole class.50- Firestore `Pipeline*` classes and the `com.google.firebase.firestore.pipeline`51 packages count as unused unless the module sources mention "pipeline", to avoid52 false matches on generic names such as `where` and `limit`.5354## Authentication and Analytics (no api.txt)5556These two Android libraries are closed source and have no module in57firebase-android-sdk, so the script lists their API from the AARs instead58(this reproduces the method used in PR #874: Authentication 166/314 = 53%,59Analytics 26/160 = 16%). It needs `javap` from a JDK and access to Google Maven:60611. The BOM version is read from `gradle/libs.versions.toml` and the BOM POM is62 fetched from `https://dl.google.com/dl/android/maven2/` to resolve the library63 versions (BOM 34.18.0: `firebase-auth` 24.2.0, `firebase-analytics` 23.2.0).642. The AARs are downloaded and `classes.jar` extracted:65 - Authentication: `com.google.firebase:firebase-auth`, package `com.google.firebase.auth`.66 - Analytics: the `firebase-analytics` AAR is an empty shim, so the script reads67 the `play-services-measurement-api` version from the firebase-analytics POM68 and downloads `com.google.android.gms:play-services-measurement-api`69 (23.2.0 for BOM 34.18.0), package `com.google.firebase.analytics`.703. `javap -v` runs over every class in that package and its sub-packages except71 `internal` and `connector`. Non-public, synthetic, bridge and deprecated72 members are dropped, as are obfuscated `zz*` names, `$`-suffixed helpers,73 anonymous and lambda classes, and enum `values`/`valueOf`. The result feeds74 the same counting rules as the api.txt modules; the Kotlin facade classes75 (`FirebaseAuthKt`, `AnalyticsKt`) and DSL receivers such as `ConsentBuilder`76 are ordinary classes here and count by member name.774. The Analytics total includes the 118 string constants on78 `FirebaseAnalytics.Event`, `Param` and `UserProperty`, which the Kotlin SDK79 does not expose. They stay in for consistency with the api.txt badges, which80 count constants too.8182If Google Maven is blocked in the sandbox, download the two AARs elsewhere, put83them in a directory as `firebase-auth-<version>.aar` and84`play-services-measurement-api-<version>.aar`, and pass `--aar-dir DIR`. If that85is not possible either, run the script for the other modules only86(`api_coverage.py --write database firestore ...`) and say the two badges were87not recalculated rather than estimating them.