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
62 changes: 62 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project

ViewBindingPropertyDelegate — Android library that simplifies ViewBinding lifecycle management using Kotlin property delegates. Manages binding lifecycle, clears references to prevent memory leaks, and creates bindings lazily.

## Build Commands

```bash
./gradlew check # full check: build + unit tests + detekt + ktlint
./gradlew assembleRelease # build AARs for all library modules
./gradlew ktlintFormat # auto-fix Kotlin formatting
./gradlew koverHtmlReport # generate code coverage report

# per-module commands
./gradlew :vbpd-core:check # check single module
./gradlew :vbpd:assembleRelease # build single module AAR
```

## Architecture

Three library modules with a linear dependency chain:

```
vbpd-core ←(api)— vbpd ←(api)— vbpd-reflection
```

### vbpd-core (foundation)
Defines `ViewBindingProperty<R, T>` interface (extends `ReadOnlyProperty` + `clear()`), plus `LazyViewBindingProperty` and `EagerViewBindingProperty` base classes. No Android component dependencies — only `androidx.viewbinding` + `androidx.annotation`.

### vbpd (no-reflection delegates)
Lifecycle-aware delegates for Activity, Fragment, ViewGroup, ViewHolder. Registers lifecycle callbacks to auto-clear bindings (Activity → `onDestroy`, Fragment → view destruction). AndroidX dependencies (`fragment`, `activity`, `recyclerview`) are **compile-only** — consumers provide their own versions.

Key files: `ActivityViewBindings.kt`, `FragmentViewBindings.kt`, `ViewGroupBindings.kt`, `ViewHolderBindings.kt`, `internal/VbpdUtils.kt`.

### vbpd-reflection (reflection + cache)
Adds reified-type overloads that discover `bind()`/`inflate()` methods via reflection. `ViewBindingCache` caches reflection lookups. `CreateMethod` enum selects BIND vs INFLATE strategy. Consumer ProGuard rules keep ViewBinding `bind()` and `inflate()` methods.

## Branch Strategy

- `master` — stable releases. Never push directly.
- `develop` — active development. All feature branches merge here.
- Feature branches: `feature/<name>`, `fix/<name>`, `chore/<name>`, `docs/<name>`
- PRs target `develop`, except hotfixes → `master` (then merge into `develop`).
- Release: merge `develop` → `master`, update version in `gradle/libs.versions.toml`, tag `vX.Y.Z`, push. CI publishes to Maven Central.

## Conventions

- **Version**: `gradle/libs.versions.toml` → `vbpd` key
- **Kotlin explicit API mode** enabled — all public declarations need explicit visibility modifiers
- **JVM target**: Java 11
- **Convention plugins** in `gradle/conventions-plugins/vbpd-library-base/` apply Detekt, ktlint, Kover, and Vanniktech Maven Publish to all library modules
- **Publishing**: Vanniktech Maven Publish → Sonatype Central Portal. CI uses `ORG_GRADLE_PROJECT_*` env vars; local dev uses `local.properties` with signing + Maven Central credentials
- **Package**: `dev.androidbroadcast.vbpd` (namespace per module)

## CI

- **android.yml**: Runs `./gradlew check` on push/PR to `master`
- **build.yml**: Builds release AARs on push to `develop`, uploads as artifacts
- **Dependabot**: Weekly checks for Gradle deps and GitHub Actions
62 changes: 62 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Contributing

## Branch Strategy

| Branch | Purpose |
|--------|---------|
| `master` | Stable, released code. Every commit here is either a release or a release-ready state. |
| `develop` | Active development. All feature branches merge here first. |

### Rules

- **Never push directly to `master`.** All changes go through `develop` first.
- **`develop` → `master`** merge happens only when preparing a release.
- Feature branches are created from `develop` and merged back into `develop` via PR.
- Hotfix branches are created from `master`, merged into both `master` and `develop`.
Comment on lines +12 to +15
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch strategy says feature branches merge via PR into develop, but the repo's PR CI workflow (.github/workflows/android.yml) is configured to run only for PRs targeting master. If develop is the intended PR target, update the workflow to include develop (or adjust this doc to match the current CI behavior), otherwise contributors won't get CI feedback on PRs to develop.

Copilot uses AI. Check for mistakes.

### Branch Naming

| Type | Pattern | Example |
|------|---------|---------|
| Feature | `feature/<short-name>` | `feature/dialog-fragment-support` |
| Bug fix | `fix/<short-name>` | `fix/lifecycle-leak` |
| Hotfix (from master) | `hotfix/<short-name>` | `hotfix/crash-on-api-21` |
| Chore / CI | `chore/<short-name>` | `chore/update-dependencies` |
| Docs | `docs/<short-name>` | `docs/migration-guide` |

### Workflow

```
feature/xyz ──PR──► develop ──release──► master ──tag──► v2.0.5
GitHub Actions
publishes to
Maven Central
```
Comment on lines +29 to +35
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow diagram states GitHub Actions publishes to Maven Central as part of the developmaster→tag flow, but the repository currently has no workflow triggered by tags/releases (only android.yml on master and build.yml on develop). Please update the diagram (and/or add the missing release workflow) so contributors aren't relying on a CI flow that doesn't exist in this repo.

Copilot uses AI. Check for mistakes.

## Release Process

1. Ensure `develop` is stable and all tests pass
2. Merge `develop` into `master`
3. Update version in `gradle/libs.versions.toml` (`vbpd = "X.Y.Z"`)
4. Commit, tag, and push:
```bash
git tag vX.Y.Z
git push origin master --tags
```
5. CI automatically: validates version → runs checks → publishes to Maven Central → creates GitHub Release
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 5 claims CI will validate the version, run checks, publish to Maven Central, and create a GitHub Release, but there is no release/publish GitHub Actions workflow in .github/workflows/ to do this. Either adjust the release steps to reflect the current manual process, or add the automation so the documented process is accurate.

Copilot uses AI. Check for mistakes.

## Development Setup

1. Clone the repository
2. Open in Android Studio
3. For local publishing, create `local.properties` with signing and Maven Central credentials
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions mention adding signing + Maven Central credentials to local.properties, but don't explicitly remind contributors that this file contains secrets and must not be committed (even though it's currently gitignored). Please add a short note to avoid accidental credential leaks, and consider listing the expected property keys (signing.*, mavenCentralUsername, mavenCentralPassword) to reduce setup friction.

Suggested change
3. For local publishing, create `local.properties` with signing and Maven Central credentials
3. For local publishing, create a `local.properties` file (not checked into version control) containing your signing and Maven Central credentials. This file contains secrets and must never be committed.
Example properties:
```properties
signing.keyId=...
signing.password=...
signing.secretKeyRingFile=/absolute/path/to/your/secring.gpg
mavenCentralUsername=...
mavenCentralPassword=...

Copilot uses AI. Check for mistakes.

## Code Quality

The project uses:
- **Detekt** — Kotlin static analysis
- **ktlint** — Kotlin code formatting
- **Kover** — code coverage

Run all checks: `./gradlew check`