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
6 changes: 5 additions & 1 deletion .claude/skills/build-compilation-dependencies/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ Downloaded artifacts land in:

### Files
- `android/build.gradle` — Gradle library config
- `android/fix-prefab.gradle` — prefab publication workaround (ported from react-native-worklets)
- `android/CMakeLists.txt` — Android CMake root (SIMD detection, RN version flags, delegates to subdirectory)
- `android/src/main/cpp/audioapi/CMakeLists.txt` — actual build target (sources, prebuilt libs, include paths)
- `common/cpp/audioapi/EXTENSION_API.md` — stable C++ extension contract for dependent native modules
- `common/cpp/audioapi/compatibility/StableAPI.h` — single public C++ compatibility header for extensions

### Key behaviors
- Feature flags (`newArchEnabled`, `disableAudioapiFFmpeg`) are read from app's `gradle.properties` and forwarded to both CMake and Kotlin `BuildConfig`
- DSP sources always compiled with `-O3` regardless of overall build type
- Sources gathered with `GLOB_RECURSE CONFIGURE_DEPENDS` — CMake re-runs automatically when files are added/removed
- Worklets must be merged before the audio API CMake build starts (explicit Gradle task dependency)
- 16KB page size alignment enabled for Android 15+
- **Extension API (prefab)**: single public C++ header `<audioapi/compatibility/StableAPI.h>`; prefab publishes transitive headers needed to compile it (`prepareAudioApiHeadersForPrefabs`); `fix-prefab.gradle` ensures the `.so` is in prefab metadata. Contract: `EXTENSION_API.md`
- CMake exposes `COMMON_CPP_DIR` and `ANDROID_CPP_DIR` as **PUBLIC** include dirs so prefab consumers resolve `<audioapi/...>`

For full per-line analysis see [build-details.md](build-details.md#android-androidcmakeliststxt-root--detailed-analysis).

Expand Down
27 changes: 23 additions & 4 deletions .claude/skills/build-compilation-dependencies/build-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,31 @@ packagingOptions {
}
```

### Worklets dependency ordering

Worklets must be merged before the audio API's CMake build starts. Gradle task dependency is wired explicitly:
### Prefab extension API

```groovy
tasks.getByName("buildCMakeDebug").dependsOn(rnWorkletsProject.tasks.getByName("mergeDebugNativeLibs"))
buildFeatures {
prefab true
prefabPublishing true
}

prefab {
"react-native-audio-api" {
headers audioApiPrefabHeadersDir.absolutePath
}
}
```

`prepareAudioApiHeadersForPrefabs` copies `audioapi/**/*.{h,hpp}` (include-only, no
excludes — same approach as react-native-worklets). `fix-prefab.gradle` makes
`prefab*ConfigurePackage` depend on `externalNativeBuild*` and touches dependents'
`prefab_config.json`.

Consumers:

```cmake
find_package(react-native-audio-api REQUIRED CONFIG)
target_link_libraries(my-ext react-native-audio-api::react-native-audio-api)
```

### Minimum RN version enforcement
Expand Down
16 changes: 16 additions & 0 deletions .claude/skills/turbo-modules/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,22 @@ The JSI injection itself (`AudioAPIModuleInstaller`) is identical for both archi

---

## Pure C++ TurboModule library (`react-native-audio-worklets`)

Extension packages that expose a **C++-only** TurboModule (no JNI implementation) use a hybrid Android setup:

| Piece | Role |
|---|---|
| `react-native.config.js` `cxxModule*` fields | Registers `NativeAudioWorkletsModule` in app autolinking (`autolinking_cxxModuleProvider`) |
| `android/build.gradle` + `com.facebook.react` | Runs Codegen → `react_codegen_rnaudioworklets` (JSI spec headers) |
| `AudioWorkletsPackage.kt` | Stub `BaseReactPackage` so Gradle autolinking includes the library project |
| Root `CMakeLists.txt` | Static `react-native-audio-worklets` target; linked into `libappmodules.so` via autolinking |
| `common/cpp/NativeAudioWorkletsModule.h` | Forwarding header — autolinking includes `<NativeAudioWorkletsModule.h>` |

iOS uses `NativeAudioWorkletsModuleProvider.mm` + `codegenConfig.ios.modulesProvider` instead.

RN guide: https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules

---

*Maintenance: see [maintenance.md](maintenance.md).*
29 changes: 22 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,37 @@ jobs:
name: Format check
run: yarn format:check

lint:
lint-audio-api:
uses: ./.github/workflows/ci-check.yml
with:
name: Lint and typecheck
name: Lint and typecheck (react-native-audio-api)
run: |
yarn lint
yarn typecheck
yarn workspace react-native-audio-api run lint
yarn workspace react-native-audio-api run typecheck

lint-worklets:
uses: ./.github/workflows/ci-check.yml
with:
name: Lint and typecheck (react-native-audio-worklets)
run: |
yarn workspace react-native-audio-api build
yarn workspace react-native-audio-worklets run lint
yarn workspace react-native-audio-worklets run typecheck

check-audio-enum-sync:
uses: ./.github/workflows/ci-check.yml
with:
name: Check AudioEvent enum sync
run: yarn check-audio-enum-sync

build-library:
build-audio-api:
uses: ./.github/workflows/ci-check.yml
with:
name: Build (react-native-audio-api)
run: yarn workspace react-native-audio-api build

build-worklets:
uses: ./.github/workflows/ci-check.yml
with:
name: Build package
run: yarn build
name: Build (react-native-audio-worklets)
run: yarn workspace react-native-audio-worklets build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ android/keystores/debug.keystore
.turbo/

packages/react-native-audio-api/lib
packages/react-native-audio-worklets/lib
react-native-audio-api*.tgz

# Android
Expand Down
5 changes: 3 additions & 2 deletions apps/common-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
"@shopify/react-native-skia": "2.6.2",
"lucide-react-native": "^0.555.0",
"react-native-audio-api": "workspace:*",
"react-native-audio-worklets": "workspace:*",
"react-native-background-timer": "2.4.1",
"react-native-gesture-handler": "2.31.1",
"react-native-reanimated": "4.3.0",
"react-native-reanimated": "4.5.1",
"react-native-safe-area-context": "5.7.0",
"react-native-screens": "4.24.0",
"react-native-svg": "15.15.4",
"react-native-worklets": "0.8.1"
"react-native-worklets": "0.10.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
Loading
Loading