Skip to content

[ffigen] Support running as a standalone AOT executable - #3746

Open
sigurdm wants to merge 1 commit into
dart-lang:mainfrom
sigurdm:ffigen-aot-executable
Open

sigurdm wants to merge 1 commit into
dart-lang:mainfrom
sigurdm:ffigen-aot-executable

Conversation

@sigurdm

@sigurdm sigurdm commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Declare ffigen under executables in pubspec.yaml and resolve the dart executable via package:cli_util (cli_util: ^0.6.0) instead of walking parent directories of Platform.resolvedExecutable.

When ffigen is compiled to a standalone AOT executable (for example via dart install ffigen or dart run ffigen@), Platform.resolvedExecutable is the ffigen binary itself rather than <sdk>/bin/dart, which previously caused dartExecutable discovery for dart format to fail. Also updates findPackageRoot in overrideable_utils.dart to handle non-.dart/.dill Platform.script URIs and filesystem root traversal safely.

Declare ffigen under executables in pubspec.yaml and resolve the Dart executable via package:cli_util so dart format works when ffigen is compiled to AOT (e.g. via dart install or dart run ffigen@).
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.02%. Comparing base (3cbe319) to head (987224c).

Files with missing lines Patch % Lines
pkgs/ffigen/lib/src/code_generator/utils.dart 50.00% 2 Missing ⚠️
...en/lib/src/config_provider/overrideable_utils.dart 92.30% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3746      +/-   ##
==========================================
+ Coverage   87.94%   88.02%   +0.07%     
==========================================
  Files         310      310              
  Lines       19848    19842       -6     
==========================================
+ Hits        17456    17465       +9     
+ Misses       2392     2377      -15     
Flag Coverage Δ
ffigen 91.55% <82.35%> (+0.19%) ⬆️
native_pkgs_macos 86.47% <ø> (ø)
native_pkgs_ubuntu 72.14% <ø> (ø)
native_pkgs_windows 75.47% <ø> (ø)
objective_c 62.91% <0.00%> (+0.04%) ⬆️
swiftgen 80.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
code_assets 94.96% <ø> (ø)
data_assets 91.56% <ø> (ø)
ffi 100.00% <ø> (ø)
ffigen 91.65% <82.35%> (+0.19%) ⬆️
hooks 86.40% <ø> (ø)
hooks_runner 90.52% <ø> (ø)
jni 66.34% <ø> (ø)
jni_flutter ∅ <ø> (∅)
jni_util 25.00% <ø> (ø)
jnigen 82.85% <ø> (ø)
json_syntax_generator ∅ <ø> (∅)
native_test_helpers 85.71% <ø> (ø)
native_toolchain_c 95.97% <ø> (ø)
objective_c 79.53% <ø> (ø)
pub_formats ∅ <ø> (∅)
record_use 81.48% <ø> (ø)
snippet_tool 66.23% <ø> (ø)
swift2objc 92.95% <ø> (ø)
swiftgen 80.41% <ø> (ø)
test_case_selector 97.28% <ø> (ø)
Files with missing lines Coverage Δ
...en/lib/src/config_provider/overrideable_utils.dart 86.48% <92.30%> (+28.15%) ⬆️
pkgs/ffigen/lib/src/code_generator/utils.dart 94.87% <50.00%> (+10.08%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dcharkes
dcharkes requested a review from liamappelbe October 14, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant