-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable] [dart2wasm] Make
dart compile wasm
compiled apps disable `…
…dart.library.ffi` This is a follow-up to [0]. That CL changed dart2wasm's modular transformer to issue an error if `dart:ffi` is imported. Users of packages that have specialized code for the VM (which supports FFI) use conditional imports based on `dart.library.ffi`. We don't want the VM-specific code to be used for web in dart2wasm (as dart2wasm doesn't support the entirety of `dart:ffi`). As a result we're going to make `dart.library.ffi` be false in coditional imports (as well as in `const bool.fromEnvironment('dart.library.ffi')`). [0] https://dart-review.googlesource.com/c/sdk/+/368568 Bug: #55948 Bug: flutter/flutter#149984 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/370580 Cherry-pick-request: #55979 Change-Id: Ia968bacf92566d421606fc026c7f016fe5abff01 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370880 Reviewed-by: Slava Egorov <[email protected]>
- Loading branch information
1 parent
1a849f9
commit 153b668
Showing
14 changed files
with
86 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
String tryAccessFfi() => 'Have no dart:ffi support'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
import 'disabled_helper.dart' if (dart.library.ffi) 'enabled_helper.dart'; | ||
|
||
void main() { | ||
Expect.isFalse(const bool.fromEnvironment('dart.library.ffi')); | ||
Expect.equals('Have no dart:ffi support', tryAccessFfi()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:ffi'; | ||
|
||
String tryAccessFfi() => | ||
'Have dart:ffi support (${Pointer<Int8>.fromAddress(int.parse('10')).address})'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// dart2wasmOptions=--extra-compiler-option=--enable-experimental-ffi | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
import 'disabled_helper.dart' if (dart.library.ffi) 'enabled_helper.dart'; | ||
|
||
void main() { | ||
Expect.isTrue(const bool.fromEnvironment('dart.library.ffi')); | ||
Expect.equals('Have dart:ffi support (10)', tryAccessFfi()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters