fix(mobile): rebuild buzz_secp256k1 when vendored headers change (#8664)

Follow-up to #8654, from [Kalvin's review
note](https://github.com/block/buzz/pull/8654#discussion_r4407146414).

`native_toolchain_c`'s `CBuilder` registers only the listed C sources
(and files under `includes`) as build-hook dependencies. The
`buzz_secp256k1` hook lists four sources and no headers, so after an
initial build a header-only vendor update (for example
`src/modules/schnorrsig/main_impl.h`) could reuse the old library in
incremental app and test builds. The hook now also registers every `.h`
file under the vendored tree. It does not add include paths, so
compilation is unchanged.

### Validation

- With the change, editing the content of
`third_party/secp256k1/src/modules/schnorrsig/main_impl.h` makes the
next `dart test` rebuild `libbuzz_secp256k1.dylib`. Without it, the
library is reused unchanged.
- The hook output now lists all 62 vendored headers as dependencies.
- Package tests pass (27).

buzz-review-completed (Codex and security review clean; agent
verification above; build-only change, no app behavior to test)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tom Brow
2026-10-28 18:56:35 -07:00
committed by GitHub
parent 713b864e2f
commit 82b2781376

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:code_assets/code_assets.dart';
import 'package:hooks/hooks.dart';
import 'package:native_toolchain_c/native_toolchain_c.dart';
@@ -31,5 +33,14 @@ void main(List<String> args) async {
'COMB_TEETH': '6',
},
).run(input: input, output: output);
// CBuilder tracks only the listed sources, so a header-only vendor update
// would otherwise reuse a stale library in incremental builds.
output.dependencies.addAll(
Directory.fromUri(input.packageRoot.resolve('$_vendor/'))
.listSync(recursive: true)
.whereType<File>()
.where((file) => file.path.endsWith('.h'))
.map((file) => file.uri),
);
});
}