From cca28306cb3483be18ed36f5c26810918160c450 Mon Sep 17 00:00:00 2001 From: kirich1409 Date: Sat, 14 Feb 2026 23:38:00 +0300 Subject: [PATCH 1/2] docs: add CONTRIBUTING.md and CLAUDE.md Document branch strategy (master for stable, develop for active work), branch naming conventions, release process, and project structure. Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 38 ++++++++++++++++++++++++++++++ CONTRIBUTING.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 CLAUDE.md create mode 100644 CONTRIBUTING.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..d29e498 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,38 @@ +# CLAUDE.md + +## Project + +ViewBindingPropertyDelegate — Android library for simplifying ViewBinding lifecycle management. + +## Branch Strategy + +- `master` — stable, released code. Never push directly. +- `develop` — active development. All feature branches merge here. +- Feature branches: `feature/`, `fix/`, `chore/`, `docs/` +- PRs always target `develop`, except hotfixes which target `master` (and then merge into `develop` too). +- Release: merge `develop` → `master`, tag `vX.Y.Z`, push tag to trigger CI release. + +## Build + +```bash +./gradlew check # full check (build + tests + detekt + ktlint) +./gradlew assembleRelease # build AARs +./gradlew ktlintFormat # auto-fix formatting +./gradlew koverHtmlReport # code coverage report +``` + +## Project Structure + +- `vbpd-core/` — base ViewBindingProperty classes (lazy, eager) +- `vbpd/` — delegates for Activity, Fragment, ViewGroup, ViewHolder (no reflection) +- `vbpd-reflection/` — reflection-based delegates + ViewBindingCache +- `sample/` — demo app +- `gradle/conventions-plugins/` — shared Gradle build logic (Detekt, ktlint, Kover, publishing) + +## Conventions + +- Version is in `gradle/libs.versions.toml` under `vbpd` +- Convention plugins apply Detekt, ktlint, Kover to all library modules +- Publishing uses Vanniktech Maven Publish to Sonatype Central Portal +- CI credentials via `ORG_GRADLE_PROJECT_*` env vars; local via `local.properties` +- Language: Kotlin, explicit API mode enabled diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4f76a45 --- /dev/null +++ b/CONTRIBUTING.md @@ -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`. + +### Branch Naming + +| Type | Pattern | Example | +|------|---------|---------| +| Feature | `feature/` | `feature/dialog-fragment-support` | +| Bug fix | `fix/` | `fix/lifecycle-leak` | +| Hotfix (from master) | `hotfix/` | `hotfix/crash-on-api-21` | +| Chore / CI | `chore/` | `chore/update-dependencies` | +| Docs | `docs/` | `docs/migration-guide` | + +### Workflow + +``` +feature/xyz ──PR──► develop ──release──► master ──tag──► v2.0.5 + │ + GitHub Actions + publishes to + Maven Central +``` + +## 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 + +## Development Setup + +1. Clone the repository +2. Open in Android Studio +3. For local publishing, create `local.properties` with signing and Maven Central credentials + +## Code Quality + +The project uses: +- **Detekt** — Kotlin static analysis +- **ktlint** — Kotlin code formatting +- **Kover** — code coverage + +Run all checks: `./gradlew check` From 730aee3e6417d3691561c87a9185d0003cafc9a0 Mon Sep 17 00:00:00 2001 From: kirich1409 Date: Sat, 14 Feb 2026 23:47:30 +0300 Subject: [PATCH 2/2] docs: improve CLAUDE.md with architecture details and per-module commands Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 72 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d29e498..b0bf376 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,38 +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 for simplifying ViewBinding lifecycle management. +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. -## Branch Strategy +## Build Commands -- `master` — stable, released code. Never push directly. -- `develop` — active development. All feature branches merge here. -- Feature branches: `feature/`, `fix/`, `chore/`, `docs/` -- PRs always target `develop`, except hotfixes which target `master` (and then merge into `develop` too). -- Release: merge `develop` → `master`, tag `vX.Y.Z`, push tag to trigger CI release. +```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 +``` -## Build +## Architecture -```bash -./gradlew check # full check (build + tests + detekt + ktlint) -./gradlew assembleRelease # build AARs -./gradlew ktlintFormat # auto-fix formatting -./gradlew koverHtmlReport # code coverage report +Three library modules with a linear dependency chain: + +``` +vbpd-core ←(api)— vbpd ←(api)— vbpd-reflection ``` -## Project Structure +### vbpd-core (foundation) +Defines `ViewBindingProperty` interface (extends `ReadOnlyProperty` + `clear()`), plus `LazyViewBindingProperty` and `EagerViewBindingProperty` base classes. No Android component dependencies — only `androidx.viewbinding` + `androidx.annotation`. -- `vbpd-core/` — base ViewBindingProperty classes (lazy, eager) -- `vbpd/` — delegates for Activity, Fragment, ViewGroup, ViewHolder (no reflection) -- `vbpd-reflection/` — reflection-based delegates + ViewBindingCache -- `sample/` — demo app -- `gradle/conventions-plugins/` — shared Gradle build logic (Detekt, ktlint, Kover, publishing) +### 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/`, `fix/`, `chore/`, `docs/` +- 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 is in `gradle/libs.versions.toml` under `vbpd` -- Convention plugins apply Detekt, ktlint, Kover to all library modules -- Publishing uses Vanniktech Maven Publish to Sonatype Central Portal -- CI credentials via `ORG_GRADLE_PROJECT_*` env vars; local via `local.properties` -- Language: Kotlin, explicit API mode enabled +- **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