-
-
Notifications
You must be signed in to change notification settings - Fork 100
Add CONTRIBUTING.md and CLAUDE.md #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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`. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ### 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
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| ## 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 | ||||||||||||||||||||
|
||||||||||||||||||||
| 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=... |
There was a problem hiding this comment.
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 targetingmaster. Ifdevelopis the intended PR target, update the workflow to includedevelop(or adjust this doc to match the current CI behavior), otherwise contributors won't get CI feedback on PRs todevelop.