Bump CargoKit to latest and update it for Android 16KB pages - #3170
Conversation
Point the integration template CargoKit submodules at the refreshed 16KB page size CargoKit PR commit and sync the checked-in CargoKit copies used by examples.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the cargokit build tool across multiple integration templates and examples. Specifically, it modifies android_environment.dart to conditionally append page size and hash style linker arguments (-Wl,--hash-style=both and -Wl,-z,max-page-size=16384) to rustFlags when targeting arm64-v8a or x86_64 on Android. Additionally, it applies extensive code formatting and style improvements across various Dart source files in the build tool, such as restructuring constructor parameters, formatting list literals, and simplifying enum declarations. There are no review comments to address, and I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Code Review
This pull request updates the cargokit subproject commits and applies formatting cleanups across the Dart build tool files. Notably, in android_environment.dart, it introduces target-specific linker flags for 64-bit Android architectures (arm64-v8a and x86_64) to configure the hash style and set the maximum page size to 16384. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the cargokit subproject commits and modifies the Android environment configuration across multiple examples and templates to append 16KB page size linker flags for arm64-v8a and x86_64 targets. The reviewer suggested simplifying the control flow to avoid duplicating the workaround directory flag and recommended using single quotes for string literals in Dart.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
| if (["arm64-v8a", "x86_64"].contains(target.android)) { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir\x1f'; | ||
|
|
||
| const pageSizeArgs = [ | ||
| "-C", | ||
| "link-arg=-Wl,--hash-style=both", | ||
| "-C", | ||
| "link-arg=-Wl,-z,max-page-size=16384" | ||
| ]; | ||
| final pageSizeArgsString = pageSizeArgs.join("\x1f"); | ||
|
|
||
| rustFlags = '$rustFlags$pageSizeArgsString'; | ||
| } else { | ||
| rustFlags = '$rustFlags-L\x1f$workaroundDir'; | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by unconditionally appending the workaround directory flag first, and then conditionally appending the 16KB page size flags if the target is arm64-v8a or x86_64. This avoids duplicating the -L\x1f$workaroundDir string and simplifies the control flow. Additionally, using single quotes for string literals is preferred in Dart.
rustFlags = '$rustFlags-L\\x1f$workaroundDir';
if (['arm64-v8a', 'x86_64'].contains(target.android)) {
const pageSizeArgs = [
'-C',
'link-arg=-Wl,--hash-style=both',
'-C',
'link-arg=-Wl,-z,max-page-size=16384',
];
rustFlags = '$rustFlags\\x1f${pageSizeArgs.join("\\x1f")}';
}References
- PREFER using single quotes for string literals. (link)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3170 +/- ##
==========================================
- Coverage 98.58% 98.55% -0.03%
==========================================
Files 477 477
Lines 20321 20610 +289
==========================================
+ Hits 20033 20313 +280
- Misses 288 297 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # frb_codegen/assets/integration_template/app/rust_builder/cargokit # frb_codegen/assets/integration_template/plugin/cargokit
Closes #3104.
Summary
fzyzcjy/cargokit@6f7144d192b04075acd73af2656cdebb1d3e4055CargoKit coordination:
rhttp prior art / changelog context
I checked how
package:rhttphandled the same Android 16KB page-size requirement through Tienisto/rhttp#88:package:rhttp's vendored CargoKit.sabin26/rhttp@android-16kbfork and confirmed that it passed Play Console validation.97dab4e8659f1ef239ec68a0b644114960b9fee4modifiesrhttp/cargokit/build_tool/lib/src/android_environment.dartwith the same approach used here: for Androidarm64-v8aandx86_64, append encoded Rust flags for-Wl,--hash-style=bothand-Wl,-z,max-page-size=16384; for other Android ABIs, keep only CargoKit's existing libgcc workaround flags.0.14.0changelog includesfeat: support Android 16 KB memory page alignment requirement @sabin26 (#89).Changelog-style explanation for FRB: this updates the CargoKit templates copied into generated FRB examples so Android builds emit 16KB-compatible native libraries on the ABIs that need it, matching the already-validated rhttp/CargoKit fix pattern.
Validation
generate-run-frb-codegen-command-integrateforflutter_via_create,flutter_via_integrate, andflutter_package./frb_internal sync-cargokit-copiesCARGO_BUILD_JOBS=1 ./frb_internal lint-rust./frb_internal lint-dartmaster:./frb_internal precommit-integratemaster:./frb_internal generate-internal --set-exit-if-changed --coverage./frb_internal precommit-integrate./frb_internal sync-cargokit-copies