Skip to content

Commit

Permalink
Merge pull request #2122 from fzyzcjy/feat/12365
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy authored Jun 20, 2024
2 parents 99c2738 + 93b668c commit d699cdb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions frb_dart/lib/src/cli/build_web/executor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,21 @@ Future<void> _executeWasmPack(BuildWebArgs args,
// if (config.cliOpts.features != null) '--features=${config.cliOpts.features}'
], env: {
'RUSTUP_TOOLCHAIN': args.wasmPackRustupToolchain ?? 'nightly',
'RUSTFLAGS': args.wasmPackRustflags ??
'-C target-feature=+atomics,+bulk-memory,+mutable-globals',
'RUSTFLAGS': _computeRustflags(argsOverride: args.wasmPackRustflags),
if (stdout.supportsAnsiEscapes) 'CARGO_TERM_COLOR': 'always',
});
}

String _computeRustflags({required String? argsOverride}) {
const kDefault = '-C target-feature=+atomics,+bulk-memory,+mutable-globals';
if (argsOverride == null) return kDefault;
if (!argsOverride.contains(kDefault)) {
print(
'WARN: RUSTFLAGS will be `$argsOverride`, which does not contain the default one `$kDefault`');
}
return argsOverride;
}

Future<void> _executeWasmBindgen(BuildWebArgs args,
{required String rustCrateName}) async {
await runCommand('wasm-bindgen', [
Expand Down

0 comments on commit d699cdb

Please sign in to comment.