Skip to content
Merged
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
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,10 @@ Opt-in add-ons (each `-noop` twin is the matching `releaseImplementation`):

| Coordinate | Release twin | Adds |
|---|---|---|
| `devconsole-ui-compose` | *(none — `debugImplementation` only)* | Compose launcher-panel API (the on-device inspector itself already ships inside `devconsole`; name this coordinate only to call the panel composables) |
| `devconsole-ui-views` | *(none — `debugImplementation` only)* | `DevConsolePanelView` launcher for XML/Views hosts |
| `devconsole-network-ktor` | *(none)* | Ktor `HttpClient` capture plugin (full request + response body capture, any engine; see [Network adapters](docs/NETWORK_ADAPTERS.md)) |
| `devconsole-ui-compose` | *(none — `debugImplementation` only)* | Compose launcher-panel API; protected variants reject it unless scoped to debug |
| `devconsole-ui-views` | *(none — `debugImplementation` only)* | `DevConsolePanelView` launcher for XML/Views hosts; protected variants reject it unless scoped to debug |
| `devconsole-network-ktor` | *(none)* | Ktor `HttpClient` capture plugin (full request + response body capture, any engine; protected variants reject it; see [Network adapters](docs/NETWORK_ADAPTERS.md)) |
| `devconsole-logs-timber` | *(none)* | Timber tree + `DevConsoleLog` drop-in that forward app logs to the timeline (release-safe: forwards to the no-op recorder in protected variants) |
| `devconsole-socket-paho` | `devconsole-socket-paho-noop` | MQTT capture via Eclipse Paho |
| `devconsole-push-firebase` | `devconsole-push-firebase-noop` | FCM push adapter (reflection-based) |
| `devconsole-remote-config-firebase` | `devconsole-remote-config-firebase-noop` | Firebase Remote Config adapter (reflection-based; see [Remote Config](docs/REMOTE_CONFIG.md)) |
Expand All @@ -453,7 +454,7 @@ You never name those. Every module publishes sources, javadoc, and a POM.

### Versions and unreleased code

All 34 library artifacts come from [JitPack](https://jitpack.io/#devconsole-android/DevConsole),
All 35 library artifacts come from [JitPack](https://jitpack.io/#devconsole-android/DevConsole),
which builds a ref on demand. Releases are tagged `v1.3.1`, and JitPack resolves a bare version
against the `v`-prefixed tag, which is why the coordinates above read `1.3.1` — the same spelling
the Gradle plugin uses on the Portal. Any branch works as `<branch>-SNAPSHOT`, with `/` written as
Expand Down Expand Up @@ -492,7 +493,10 @@ aapt2 dump permissions app/build/outputs/apk/release/app-release.apk

The Gradle plugin enforces the same split mechanically. `verify<Variant>DevConsoleProtectedArtifacts`
fails the build if the full runtime reaches a protected variant, checking declared dependencies, the
resolved runtime classpath, and the final APK/AAB bytes. See
resolved runtime classpath, and (on `assemble<Variant>` / `bundle<Variant>`) the final packaged
APK/AAB/AAR bytes through separate `verify<Variant>DevConsolePackagedArtifact` and
`verify<Variant>DevConsolePackagedBundle` tasks. Running the per-variant
`verify<Variant>DevConsoleProtectedArtifacts` task by itself checks dependencies only. See
[Build variants and production safety](docs/BUILD_VARIANTS_AND_PRODUCTION_SAFETY.md).

## Flavored projects: verify the variant you ship
Expand All @@ -509,7 +513,8 @@ verifyPartnerReleaseDevConsoleProtectedArtifacts
```

Each one is wired onto **its own** `assemble<Variant>` / `bundle<Variant>` and nothing else, so
`./gradlew :app:assembleProductionRelease` verifies `productionRelease` and resolves
`./gradlew :app:assembleProductionRelease` checks `productionRelease` dependencies and scans its
packaged APK, then resolves
`productionRelease`'s classpath — no other flavor is touched. That matters most when your flavors
carry environment-specific coordinates:

Expand All @@ -529,7 +534,9 @@ on the critical path of a single-flavor release build:

```bash
./gradlew :app:assembleProductionRelease # ships production, verifies production
./gradlew :app:verifyProductionReleaseDevConsoleProtectedArtifacts # the same check on its own
./gradlew :app:verifyProductionReleaseDevConsoleProtectedArtifacts # dependency graph check only
./gradlew :app:verifyProductionReleaseDevConsolePackagedArtifact # APK/AAR byte scan
./gradlew :app:verifyProductionReleaseDevConsolePackagedBundle # AAB byte scan
./gradlew :app:verifyDevConsoleProtectedArtifacts # full sweep, all flavors, CI
```

Expand Down Expand Up @@ -557,6 +564,8 @@ say — lower the default and name what you protect. Understand that a variant l
nobody checks:

```kotlin
import io.devconsole.gradle.DevConsoleVariantPolicy

devConsole {
defaultPolicy.set(DevConsoleVariantPolicy.DISABLED)
protectedVariantPatterns.set(listOf("(?i)production.*release"))
Expand Down
36 changes: 24 additions & 12 deletions docs/BUILD_VARIANTS_AND_PRODUCTION_SAFETY.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,24 @@ runtime in an extra internal variant:
devConsole {
enabledVariants.set(setOf("debug", "internal")) // gets the full runtime
protectedVariantPatterns.set(listOf("(?i).*release", "prod.*")) // verified free of it
protectedDependencyPaths.set(setOf(":sdk:full")) // default; override for a differently-pathed module
protectedDependencyPaths.set(setOf(":sdk:full")) // project paths only; override for a differently-pathed checkout
failBuildOnUnsafeVariant.set(true) // default; false downgrades to a warning
autoWireDependencies.set(true) // default; false to declare coordinates yourself
sdkVersion.set("1.3.1") // default; the JitPack version to resolve
}
```

`protectedVariantPatterns` entries are matched with `Regex.matches` — a **full** match against the
whole variant name, not a substring search. The bare pattern `"release"` only matches a variant
literally named `"release"`; it silently misses a flavored variant like `"prodRelease"`. Anchor
patterns with `.*` (as `(?i).*release` above does) so they match regardless of what a flavor
prefixes onto the build type.
whole variant name, not a substring search. Use `"(?i).*release"` to match release variants
including flavored names such as `"prodRelease"`. Configuration entries that match no variant are
reported as warnings.

`protectedDependencyPaths` defaults to the ten project modules that publish the core runtime,
capture adapters and UI launchers (`:sdk:full`, `:sdk:network-okhttp`, `:sdk:network-ktor`,
`:sdk:mocks-okhttp`, `:sdk:socket-okhttp`, `:sdk:socket-paho`, `:sdk:push-firebase`,
`:sdk:remote-config-firebase`, `:sdk:ui-compose` and `:sdk:ui-views`). Setting this property replaces
that project-path set. Published coordinates are checked separately by coordinate matching, and
packaged APK/AAB/AAR bytes are scanned for retained marker signatures.

**A variant that already names a DevConsole dependency is left alone.** Auto-wiring only fills a
gap, so an explicit `debugImplementation("com.github.devconsole-android.DevConsole:devconsole:...")` — or a
Expand All @@ -69,26 +75,32 @@ The plugin registers:

- `devConsoleVariantReport` writes `build/reports/devconsole/variants.json` listing the effective
policy (`ENABLED`/`DISABLED`/`PROTECTED`) for every variant.
- `verify<Variant>DevConsoleProtectedArtifacts` — one task per protected variant — inspects that
variant's dependency graph for a direct `ProjectDependency` on any path in
`protectedDependencyPaths`, and fails the build if one is found. Each variant's
- `verify<Variant>DevConsoleProtectedArtifacts` — one task per protected variant — inspects declared
dependencies and the resolved runtime dependency graph for protected DevConsole modules, and fails
the build if one is found. It does not inspect packaged bytes. Each variant's
`assemble<Variant>` and `bundle<Variant>` depends on its own verifier, so building a protected
artifact always runs its checks.
artifact always runs its dependency checks.
- `verify<Variant>DevConsolePackagedArtifact` scans the APK (or library AAR) bytes. Applications also
register `verify<Variant>DevConsolePackagedBundle` for AAB bytes. These tasks run on their matching
`assemble<Variant>` / `bundle<Variant>` lifecycle paths.
- `verifyDevConsoleProtectedArtifacts` is the aggregate: it depends on every per-variant verifier,
and `check` hangs off it. Run it as part of your release checklist — the three sample apps run it
in CI on every push (see [`.github/workflows/verify.yml`](../.github/workflows/verify.yml)).

```bash
./gradlew :app:assembleRelease :app:verifyDevConsoleProtectedArtifacts
./gradlew :app:assembleRelease # runs dependency verification and the packaged APK scan
./gradlew :app:verifyDevConsoleProtectedArtifacts # dependency graph sweep across protected variants
```

On a flavored project, ask for the variant you are actually shipping. The aggregate verifies *every*
protected variant, so on a project with `production`/`staging`/`partner` flavors it resolves — and
builds — all three release variants:

```bash
./gradlew :app:assembleProductionRelease # verifies productionRelease only
./gradlew :app:verifyProductionReleaseDevConsoleProtectedArtifacts # the same check, on its own
./gradlew :app:assembleProductionRelease # verifies dependencies and scans the production APK
./gradlew :app:verifyProductionReleaseDevConsoleProtectedArtifacts # dependency graph only
./gradlew :app:verifyProductionReleaseDevConsolePackagedArtifact # packaged APK/AAR scan
./gradlew :app:verifyProductionReleaseDevConsolePackagedBundle # packaged AAB scan
```

## Full/no-op parity
Expand Down
32 changes: 26 additions & 6 deletions docs/GETTING_STARTED_COMPOSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {

devConsole {
enabledVariants.set(setOf("debug"))
protectedVariantPatterns.set(listOf("release"))
protectedVariantPatterns.set(listOf("(?i).*release"))
}
```

Expand All @@ -42,11 +42,10 @@ form is used here because it also matches the plugin's version on the Gradle Plu
There is no BOM. `devconsole` (the debug runtime) and `devconsole-noop` are the only two coordinates
a normal integration names; everything else is `devconsole-<module>`.

**`devconsole-ui-compose` must be `debugImplementation`, never plain `implementation`.** It has no
release no-op counterpart and merges `DevConsoleActivity` into your manifest, so a plain
`implementation` dependency ships the whole in-app inspector — and an exported-by-merge Activity —
into your release build with no build-time warning. The Gradle plugin's variant protection does not
cover this module today; it is your responsibility to scope it to `debugImplementation` yourself.
**`devconsole-ui-compose` should be `debugImplementation`, never plain `implementation`.** It has no
release no-op counterpart and merges `DevConsoleActivity` into your manifest. The Gradle plugin now
treats it as a protected coordinate and marker: a protected variant that includes it fails with a
message directing you to use `debugImplementation`.

3. Add `INTERNET` to your own app's manifest. The full debug runtime auto-merges
`ACCESS_LOCAL_NETWORK`, `NEARBY_WIFI_DEVICES`, `ACCESS_NETWORK_STATE`, and the default
Expand Down Expand Up @@ -112,6 +111,27 @@ setContent {
`adb forward tcp:8080 tcp:8080` first — 8080 is only the first port tried, so use whatever port the
panel actually shows.

## Forwarding Timber / Log calls

Add `devconsole-logs-timber` to hand your existing log calls to the Logs inspector. The module is
release-safe, so it can stay on `implementation` in every variant — in protected builds it forwards
to DevConsole's disabled recorder:

```kotlin
implementation("com.github.devconsole-android.DevConsole:devconsole-logs-timber:1.3.1")

// Once, after DevConsole.initialize:
Timber.plant(DevConsoleTimberTree(DevConsole.logRecorder()))
DevConsoleLog.install(DevConsole.logRecorder())

// Existing call sites keep working and now also land on the timeline:
Timber.i("Checkout reached the timeline")
DevConsoleLog.w("Checkout", "Payment retried")
```

Use `DevConsoleTimberTree(recorder, minimumPriority)` to drop lines below a given
`android.util.Log` priority.

For a full working example, [`samples/compose-app`](../samples/compose-app/src/main/kotlin/io/devconsole/sample/compose/MainActivity.kt)
has one button per capability: network and WebSocket capture, mocks, push simulation, a feature
flag, and a state provider.
Expand Down
9 changes: 4 additions & 5 deletions docs/GETTING_STARTED_XML_KOTLIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {

devConsole {
enabledVariants.set(setOf("debug"))
protectedVariantPatterns.set(listOf("release"))
protectedVariantPatterns.set(listOf("(?i).*release"))
}
```

Expand All @@ -42,10 +42,9 @@ form is used here because it also matches the plugin's version on the Gradle Plu
There is no BOM. `devconsole` (the debug runtime) and `devconsole-noop` are the only two coordinates
a normal integration names; everything else is `devconsole-<module>`.

**`devconsole-ui-views` must be `debugImplementation`, never plain `implementation`.** It has no
release no-op counterpart, so a plain `implementation` dependency ships the launcher panel into your
release build with no build-time warning. The Gradle plugin's variant protection does not cover this
module today; it is your responsibility to scope it to `debugImplementation` yourself.
**`devconsole-ui-views` should be `debugImplementation`, never plain `implementation`.** It has no
release no-op counterpart. The Gradle plugin now treats it as a protected coordinate and marker: a
protected variant that includes it fails with a message directing you to use `debugImplementation`.

3. Add `INTERNET` to your own app's manifest. The full debug runtime auto-merges
`ACCESS_LOCAL_NETWORK`, `NEARBY_WIFI_DEVICES`, `ACCESS_NETWORK_STATE`, and the default
Expand Down
8 changes: 8 additions & 0 deletions docs/MQTT_CAPTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ mirroring the "record on the delegate's own success signal" rule the OkHttp WebS

See `samples/compose-app`'s "Open sample MQTT connection" action for a complete, crash-safe example
against a public test broker.

## Publishing from DevConsole

A Paho client wrapped by `DevConsolePahoMqtt` can also publish from the dashboard or the inspector:
open one of its frames and use the composer (topic required, QoS 0–2, retained). The publish goes
through the same wrapper, so it is captured as a sent frame. While Paho is reconnecting the composer
answers "Connection is not open". See [WEBSOCKET_INSPECTOR.md](WEBSOCKET_INSPECTOR.md#sending-a-frame)
for the gate and the route.
Loading
Loading