Also, the stripping does not change correctly when switching between build modes. If you do
flutter build ios --debug
otool -l /path/to/my_app/build/native_assets/ios/my_ffi_plugin.framework/my_ffi_plugin -> LC_DYSYMTAB nlocalsym > 1 as expected
then do
flutter build ios --release
otool -l /path/to/my_app/build/native_assets/ios/my_ffi_plugin.framework/my_ffi_plugin -> LC_DYSYMTAB nlocalsym == 1 as expected
then do
flutter build ios --debug
otool -l /path/to/my_app/build/native_assets/ios/my_ffi_plugin.framework/my_ffi_plugin -> LC_DYSYMTAB nlocalsym is NOT > 1 as expected ❌
Originally posted by @vashworth in #181533 (comment)
The root cause is a Target writing to a directory outside .dart_tool/flutter_build/<hash>/, while the Targets assume that if their inputs don't change their outputs don't have to be rewritten. This is most likely also an issue for code assets for all OSes.
// The second `flutter build ios --debug -v`:
[ ] Skipping target: dart_build
[ ] Skipping target: install_code_assets
And, Android has the same issue:
flutter build apk --profile -v
-rwxr-xr-x@ 1 dacoharkes primarygroup 5.2K Jan 30 13:55 /Users/dacoharkes/src/dacoharkes/playground/my_package/example/.dart_tool/hooks_runner/shared/my_package/build/16a46ad652892aace39acf5234912532/libmy_package.so
-rwxr-xr-x@ 1 dacoharkes primarygroup 5.2K Jan 30 13:55 /Users/dacoharkes/src/dacoharkes/playground/my_package/example/build/native_assets/android/jniLibs/lib/arm64-v8a/libmy_package.so
flutter build apk --debug -v
-rwxr-xr-x@ 1 dacoharkes primarygroup 5.2K Jan 30 14:00 /Users/dacoharkes/src/dacoharkes/playground/my_package/example/.dart_tool/hooks_runner/shared/my_package/build/48df710ce179958291528f1ec25cad14/libmy_package.so
-rwxr-xr-x@ 1 dacoharkes primarygroup 5.2K Jan 30 14:00 /Users/dacoharkes/src/dacoharkes/playground/my_package/example/build/native_assets/android/jniLibs/lib/arm64-v8a/libmy_package.so
flutter build apk --profile -v
[ ] [ +2 ms] Skipping target: install_code_assets
-rwxr-xr-x@ 1 dacoharkes primarygroup 5.2K Jan 30 13:55 /Users/dacoharkes/src/dacoharkes/playground/my_package/example/.dart_tool/hooks_runner/shared/my_package/build/16a46ad652892aace39acf5234912532/libmy_package.so
-rwxr-xr-x@ 1 dacoharkes primarygroup 5.2K Jan 30 14:00 /Users/dacoharkes/src/dacoharkes/playground/my_package/example/build/native_assets/android/jniLibs/lib/arm64-v8a/libmy_package.so
Initial analysis on how the flutter framework is correctly shipped for the various build-modes (and target SDKs):
- MacOS/Android - has debug/release/profile in the directory structure.
- iOS - has debug/release/profile and device/simulator in the directory structure.
- Linux/Windows - the
Target is forcably executed overwriting the files.
=> apparently we care less about caching for Linux/Windows. The caching behavior is worse.
We can model the code assets in the same way by using nested directories for iOS/MacOS/Linux and force rerun for Linux/Windows.
Also, the stripping does not change correctly when switching between build modes. If you do
flutter build ios --debugotool -l /path/to/my_app/build/native_assets/ios/my_ffi_plugin.framework/my_ffi_plugin-> LC_DYSYMTAB nlocalsym > 1 as expectedthen do
flutter build ios --releaseotool -l /path/to/my_app/build/native_assets/ios/my_ffi_plugin.framework/my_ffi_plugin-> LC_DYSYMTAB nlocalsym == 1 as expectedthen do
flutter build ios --debugotool -l /path/to/my_app/build/native_assets/ios/my_ffi_plugin.framework/my_ffi_plugin-> LC_DYSYMTAB nlocalsym is NOT > 1 as expected ❌Originally posted by @vashworth in #181533 (comment)
The root cause is a
Targetwriting to a directory outside.dart_tool/flutter_build/<hash>/, while theTargets assume that if their inputs don't change their outputs don't have to be rewritten. This is most likely also an issue for code assets for all OSes.And, Android has the same issue:
Initial analysis on how the flutter framework is correctly shipped for the various build-modes (and target SDKs):
Targetis forcably executed overwriting the files.=> apparently we care less about caching for Linux/Windows. The caching behavior is worse.
We can model the code assets in the same way by using nested directories for iOS/MacOS/Linux and force rerun for Linux/Windows.