Skip to content

Commit f608d95

Browse files
committed
docs: consolidate and optimize .github documentation
Squashed merge of 5 documentation improvement commits. Changes: - CONTRIBUTING.md: Remove duplicated standards (-25 lines) - RELEASE.md: Streamline with tables, reduce verbosity (-16 lines) - copilot-instructions.md: Remove circular references (-5 lines) - instructions: Consolidate 3 files → 1 (code-conventions.instructions.md) - Remove 6 duplicate rules with copilot-instructions.md - Keep only 11 actionable layer-specific constraints - Fix format: standard YAML frontmatter, no code wrapper Result: 171 lines → 125 lines (-46, -27%) - Single source of truth for each constraint - Clearer information hierarchy - Follows Markdown best practices
1 parent 19572f7 commit f608d95

File tree

7 files changed

+63
-123
lines changed

7 files changed

+63
-123
lines changed

.github/CONTRIBUTING.md

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,27 @@
1111
## Code Standards
1212

1313
- Use **English** for all code comments, commit messages, and PR descriptions
14-
- Follow conventional-commit format for commits: `feat:`, `fix:`, `refactor:`, `chore:`
14+
- Follow conventional-commit format: `feat:`, `fix:`, `refactor:`, `chore:`
1515
- One logical change per commit
16-
17-
### C++ (Native)
18-
19-
- Follow `.clang-format` (Allman braces, 4-space indent)
20-
- All code in `namespace CGE {}`
21-
- No C++ exceptions (compiled with `-fno-exceptions`)
22-
- Use logging macros: `CGE_LOG_INFO`, `CGE_LOG_ERROR`, `CGE_LOG_KEEP`
23-
- Inline GLSL via `CGE_SHADER_STRING_PRECISION_H()` / `CGE_SHADER_STRING_PRECISION_M()`
24-
- Release GL resources (programs, textures, FBOs) along the handler lifecycle
25-
26-
### Java (Android)
27-
28-
- GL operations in `GLSurfaceView` subclasses must use `queueEvent(...)`
29-
- Load native libraries through `NativeLibraryLoader` only
30-
- Check `BuildConfig.CGE_USE_VIDEO_MODULE` before referencing FFmpeg classes
31-
32-
### JNI Bridge
33-
34-
- JNI function names: `Java_org_wysaid_nativePort_<Class>_<method>`
35-
- Always validate JNI parameters (null checks) before dereferencing
36-
- Never store JNI local references across calls
16+
- Detailed code style rules are automatically applied by file path — see `.github/instructions/`
3717

3818
## Compatibility Rules
3919

20+
These are **hard constraints** for the public API:
21+
4022
- **Do not change** method signatures in `org.wysaid.nativePort.*`
4123
- **Do not change** existing JNI function names
4224
- **Do not change** existing filter rule string syntax
4325
- New methods, filters, and syntax additions are welcome
4426

45-
## FFmpeg / Video Module
46-
47-
All FFmpeg-dependent code must be optional:
48-
49-
- C++: guard with `#ifdef CGE_USE_VIDEO_MODULE`
50-
- Java: check `BuildConfig.CGE_USE_VIDEO_MODULE`
51-
- Verify the project compiles with `--disable-video-module`
27+
## Key Constraints
5228

53-
## Dual Build System
29+
- **FFmpeg/Video Module**: All video-related code must be optional — verify builds work with `--disable-video-module`
30+
- **Dual Build**: When adding native files, CMake auto-discovers via `GLOB_RECURSE`, but `Android.mk` requires explicit listing
31+
- **Thread Safety**: GL operations must run on the GL thread (`queueEvent(...)` in Java)
5432

55-
When adding new native source files under `library/src/main/jni/`:
56-
57-
- **CMake**: auto-discovered via `GLOB_RECURSE` — usually no action needed
58-
- **ndk-build**: update `Android.mk` to explicitly list the new files
33+
See `copilot-instructions.md` for detailed project conventions.
5934

6035
## CI
6136

62-
Pull requests trigger CI on three platforms (macOS, Ubuntu, Windows). PRs run a reduced matrix (1 combination per platform); merges to `master` run the full 16-combination matrix.
63-
64-
Ensure all CI checks pass before requesting review.
37+
PRs trigger CI on three platforms (macOS, Ubuntu, Windows) with a reduced matrix. Merges to `master` run the full 16-combination matrix. Ensure all checks pass before requesting review.

.github/RELEASE.md

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,41 @@
11
# Release Process
22

3-
This project uses an automated release workflow triggered by version tags.
3+
Automated release triggered by version tags (`v*.*.*`).
44

55
## Creating a Release
66

7-
### 1. Update the Version
7+
1. **Update** `versionName` in [build.gradle](../build.gradle) (e.g., `"3.1.1"`)
8+
2. **Commit, tag, and push**:
89

9-
Edit `versionName` in `build.gradle`:
10+
```bash
11+
git add build.gradle
12+
git commit -m "chore: bump version to 3.1.1"
13+
git tag v3.1.1
14+
git push && git push origin v3.1.1
15+
```
1016

11-
```gradle
12-
ext {
13-
android = [
14-
...
15-
versionName: "3.1.1",
16-
...
17-
]
18-
}
19-
```
20-
21-
### 2. Commit and Push
22-
23-
```bash
24-
git add build.gradle
25-
git commit -m "chore: bump version to 3.1.1"
26-
git push
27-
```
28-
29-
### 3. Tag and Push
30-
31-
```bash
32-
git tag v3.1.1
33-
git push origin v3.1.1
34-
```
17+
**Important**: Tag version must exactly match `versionName` in `build.gradle`.
3518

3619
## Automated Workflow
3720

38-
When a tag matching `v*.*.*` is pushed, the [release workflow](../.github/workflows/release.yml) will:
21+
The [release workflow](../.github/workflows/release.yml) builds and publishes:
22+
23+
| Artifact | FFmpeg | Page Size |
24+
| --- | --- | --- |
25+
| `gpuimage-plus-{version}.aar` || 4KB |
26+
| `gpuimage-plus-{version}-16k.aar` || 16KB |
27+
| `gpuimage-plus-{version}-min.aar` || 4KB |
28+
| `gpuimage-plus-{version}-16k-min.aar` || 16KB |
3929

40-
1. **Validate** that the tag version matches `versionName` in `build.gradle`
41-
2. **Build** four AAR variants:
42-
- `gpuimage-plus-{version}.aar` — Full with FFmpeg, 4KB page size
43-
- `gpuimage-plus-{version}-16k.aar` — Full with FFmpeg, 16KB page size
44-
- `gpuimage-plus-{version}-min.aar` — Image-only, 4KB page size
45-
- `gpuimage-plus-{version}-16k-min.aar` — Image-only, 16KB page size
46-
3. **Build** the demo APK (with video module)
47-
4. **Create** a GitHub release with all artifacts and release notes
30+
Plus demo APK with video module enabled.
4831

4932
## Tag Format
5033

51-
- Official: `v3.1.1`
52-
- Beta: `v3.1.1-beta1`
53-
- Alpha: `v3.1.1-alpha1`
54-
- Release candidate: `v3.1.1-rc1`
34+
| Type | Format | Example |
35+
|------|--------|---------|
36+
| Official | `vX.Y.Z` | `v3.1.1` |
37+
| Beta | `vX.Y.Z-beta#` | `v3.1.1-beta1` |
38+
| Alpha | `vX.Y.Z-alpha#` | `v3.1.1-alpha1` |
39+
| RC | `vX.Y.Z-rc#` | `v3.1.1-rc1` |
5540

56-
The core `X.Y.Z` segments must be numeric. Prerelease suffixes (for example `-beta1`, `-alpha1`, `-rc1`) are allowed, and the full tag version (including any suffix) must exactly match `versionName` in `build.gradle`.
41+
`X.Y.Z` must be numeric; prerelease suffixes are optional.

.github/copilot-instructions.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,16 @@ Android GPU filter library (C++ & Java). Prefer **small, safe, backward-compatib
2323

2424
Use `tasks.sh` for all operations (`bash tasks.sh --help`). Key `local.properties` flags: `usingCMakeCompile`, `disableVideoModule`, `enable16kPageSizes`. See `docs/build.md` for details.
2525

26-
**Important**: CMake uses `GLOB_RECURSE`; ndk-build (`Android.mk`) lists sources **explicitly** — update both when adding native files.
27-
2826
## Code Conventions
2927

30-
Language-specific rules live in `.github/instructions/` and are auto-applied by file path — see `cpp.instructions.md`, `java.instructions.md`, `jni-bridge.instructions.md`.
31-
32-
For detailed standards, see `.github/CONTRIBUTING.md`.
28+
Language-specific rules live in `.github/instructions/code-conventions.instructions.md` and are auto-applied by file path.
3329

3430
## Documentation
3531

3632
- `docs/build.md` — Full build guide and configuration options
3733
- `README.md` — API usage, custom filters, and code samples
3834
- `.github/RELEASE.md` — Release process and versioning
39-
- `.github/CONTRIBUTING.md` — Contributing guidelines and code standards
35+
- `.github/CONTRIBUTING.md` — Contributing workflow and compatibility rules
4036

4137
## Skills
4238

@@ -46,7 +42,7 @@ For detailed standards, see `.github/CONTRIBUTING.md`.
4642
## Behavior Constraints
4743

4844
- **Validation:** After native code changes, ALWAYS run `bash tasks.sh --enable-cmake --build`.
45+
- **Dual Build:** CMake uses `GLOB_RECURSE` (auto-discovers); `Android.mk` lists files **explicitly** — update both when adding native sources.
4946
- **Commit Policy:** Only commit to feature branches, never force-push to `master`.
5047
- **Completeness:** Implement fully or request clarification — no TODOs in committed code.
51-
- **Dual Build:** When adding native files, update both `CMakeLists.txt` and `Android.mk`.
5248
- **Thread Safety:** Never call OpenGL ES functions outside the GL thread.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: "Code conventions for C++, Java, and JNI bridge layers. Covers naming, safety patterns, and resource management."
3+
applyTo: "library/src/main/jni/**/*.cpp,library/src/main/jni/**/*.h,library/src/main/jni/**/*.c,library/src/main/java/**/*.java,cgeDemo/src/main/java/**/*.java"
4+
---
5+
6+
# C++ / Native
7+
8+
- Follow `.clang-format` (Allman braces, 4 spaces). All code in `namespace CGE {}`.
9+
- No C++ exceptions (`-fno-exceptions`). Return error codes; never `throw`.
10+
- Logging: `CGE_LOG_INFO` / `CGE_LOG_ERROR` / `CGE_LOG_KEEP` — never raw `__android_log_print`.
11+
- Inline GLSL via `CGE_SHADER_STRING_PRECISION_H()` / `CGE_SHADER_STRING_PRECISION_M()`.
12+
- GL resources (programs, textures, FBOs) must be released along the handler lifecycle; shader compile failures must be logged, not crash.
13+
14+
# JNI Bridge (`interface/`)
15+
16+
- JNI function names follow `Java_org_wysaid_nativePort_<Class>_<method>`.
17+
- Always validate JNI params (null bitmap, null env, invalid handler pointer) before dereferencing.
18+
- **Never** store JNI local refs across calls.
19+
- Respect `NativeLibraryLoader`'s library loading order.
20+
- Any new JNI method needs a corresponding Java `native` declaration in `org.wysaid.nativePort.*`.
21+
22+
# Java / Android
23+
24+
- Native methods are loaded through `NativeLibraryLoader` — don't add direct `System.loadLibrary` calls.

.github/instructions/cpp.instructions.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/instructions/java.instructions.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/instructions/jni-bridge.instructions.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)