903eea6bfb
The same bundling that is used for `dart build` is now also used for `dart test` and `dart run`, except that the output directory is `.dart_tool/native_assets`. This way all native code assets are placed next to each other in the `lib` directory, and loaded from there instead of loading them in place from where the build/link hooks placed them. By standardizing on this layout the different modes of running dart code that support native assets can use the same mechanisms to support dynamic linking between libraries. On macOS, install names of dylibs are rewritten to support dynamic linking, similar to the changes in https://github.com/flutter/flutter/pull/153054. On Windows, loading of DLLs is altered so that the directory of the DLL that is being loaded is considered when loading dependent DLLs. Tests are added to verify that dynamic linking works as expected. TEST=pkg/dartdev/test/native_assets/{build,run,test}_test.dart R=mosum@google.com Related: https://github.com/dart-lang/native/issues/190 Fixes: https://github.com/dart-lang/sdk/issues/56459 Change-Id: Ie4a41e5b7382ab1cea39e93d29d085bf9986828b Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381580 Reviewed-by: Moritz Sümmermann <mosum@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>