-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Breaking Change Request] [vm] Deprecate and remove dart native extensions #45451
Comments
/cc @a-siva @mkustermann |
Adding the March milestone for the deprecation warning in 2.14 from analyzer and CFE when dart-ext import is seen. In 2.15 we should also remove |
Also added area-analyzer and area-front-end labels for the warning work in 2.13 |
A deprecation warning wouldn't be much work, but we probably want to discuss adding new work to a release a few working days before a branch cut. |
@devoncarew I have updated versions to 2.14 and 2.15 and moved the milestone. No intention to fall over ourselves with this. |
Does Dart SDK follow semver versioning? |
@blagoev Not really. |
Ping @vsmenon @matanlurey @Hixie for approval |
Fine by me since this doesn't affect Flutter anyway. :-) |
lgtm |
Approved |
@mraleph Please add a post to https://groups.google.com/a/dartlang.org/g/announce |
@devoncarew @johnniwinther does it sound reasonable to have analyzer produce deprecation warnings in 2.14? I want to get versions right in the announcement. |
SGTM Do you have wording to use in the deprecation warning? |
@johnniwinther I suggest "Dart native extensions are deprecated and will be removed in 2.15 release of Dart SDK. Migrate to using FFI instead (https://dart.dev/guides/libraries/c-interop)". @mit-mit any thoughts? |
What is the plan for moving internal code off of dart-ext? I see a few cases when I search |
I have reached to some of the internal owners and working on planning migration |
@mraleph - does this still need to be open? |
We still have samples/sample_extension in the repo, are we good to go on deleting it. I can submit a PR deleting the directory |
I believe we were going to deprecate in 2.14 (shipping soon) and remove in 2.15. |
Yes the removal will be in the first beta of 2.15 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@johnniwinther @srawlins could you make changes to CFE and analyzer to start rejecting |
At the time we remove this feature, we should also disallow using int systemRand() native "SystemRand"; should become a parsing error, not a run-time "native function 'SystemRand' (0 arguments) cannot be found" error. |
@lrhn yeah, I will do few separate changes to replace |
Per breaking change #45451 we are removing support for dart-ext: style native extensions from the Dart VM. This CL removes the associated VM code, tests and samples. It also ports a single test which used dart-ext: import to use FFI instead. TEST=ci Bug: #45451 Change-Id: Iae984bce32baf29a950b5de1323939006a217b94 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212050 Commit-Queue: Slava Egorov <[email protected]> Reviewed-by: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
#45451 Change-Id: Ieed7c4a200b0480975715a149596b1f5ea733814 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212002 Reviewed-by: Slava Egorov <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
VM and CFE has removed support for Removal of |
@mraleph - do you know what the remaining work here is for the stable release? If there is work remaining, perhaps track using sub-issues and update the first comment in this one to be a checklist / meta issue. |
The only missing piece is promotion of warning / info to error in the analyzer for |
This is done. |
The sample_extension has been deleted a while ago. Bug: #45451 Change-Id: I69400018345d47f3b078d563246f36412eb3472b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264840 Commit-Queue: Slava Egorov <[email protected]> Auto-Submit: Alexander Thomas <[email protected]> Reviewed-by: Slava Egorov <[email protected]>
Summary
Dart Native Extensions is a mechanism for loading native code into a running Dart program and binding Dart methods to native implementatations.
It consists of the following parts:
dart-ext:...
import scheme which instructs VM to load a native library;native
keyword which specifies that a function has a native implementation;runtime/include/dart_api.h
) which can be used to reflectively inspect and mutate the state of the Dart program;Currently native extensions only really work in a standalone Dart VM - Flutter embedder hides VM C API symbols and does not allow developers to interact with Dart through Dart VM APIs.
Relience on C API means that:
@pragma('vm:entry-point')
which in turn disables treeshaking).dart:ffi
was designed to not have these problems - be both more effecient and more AOT friendly.dart:ffi
works in standalone VM as well as Flutter.From our perspective it does not make sense to maintain two completely different approaches to binding Dart code to native especially given that one of them is obviously superior. We don't want more packages using native extensions to appear in the ecosystem and we want to push all new Dart users to use
dart:ffi
.We propose the following:
dart-ext:
import.dart-ext:
imports and hide Dart VM C API symbols from standalonedart
binary shipped with SDKImpact
All packages that use
dart-ext:
will be broken by the release. We will work to estimate the impact, but we consider it to be very small because none of the Flutter compatible packages will be affected, as Flutter does not support this mechanism in the first place.TODO
The text was updated successfully, but these errors were encountered: