Closed mnordine closed 1 year ago
I see from https://github.com/dart-lang/sdk/blob/master/docs/process/experimental-flags.md that you can enable them easily from the analysis_options.yaml
file, but I'm not sure how to run DDC or Dart2JS with them
dart2js accepts --enable-experiment=experiment_name
on the command-line, I believe DDC does too, but I'm not familiar with how to adjust the launch commands in webstorm to provide it.
@jwren do you have pointers to guide our users on this?
I think you can set up a build.yaml
file, and have something like:
targets:
$default:
sources:
{"exclude" : ["bin/**"]}
builders:
build_web_compilers|entrypoint:
generate_for:
- web/main.dart
dev_options:
compiler: dartdevc
release_options:
compiler: dart2js
dart2js_args:
# See https://webdev.dartlang.org/tools/dart2js#size-and-speed-options
# - --dump-info
- --fast-startup
- --minify
- --no-frequency-based-minification
- --no-source-maps
- --show-package-warnings
- --trust-primitives
- --omit-implicit-checks
Maybe experiment flags work there for dart2js_args
? What is the key for DDC? ddc_args
?
Or maybe there's a better way to set this up, but I'm not seeing it?
This is correct, the Dart plugin doesn't know anything about dart2js or ddc, it simply knows how to start webdev serve.
@kevmoo for directions on appropriate files/ build.yaml
file needed changes for webdev flags.
There is no way AFAIK to provide flags to DDC via `build.yaml.
@jakemac53 @natebosch ?
Might be worth filing an issue https://github.com/dart-lang/build/issues/new
There is no way currently to pass args to DDC. We could consider allowing arguments, but the UX will not be great because they can't be passed to the entrypoint
builder, they'd need to be configured in a different place with global options.
How does the Dart team test new language features with DDC and dart2js?
@kevmoo - can you please move this issue to package:build?
How does the Dart team test new language features with DDC and dart2js?
Within the SDK we don't typically run through build_runner
or webdev
- we use much more static and manually configured builds.
We have avoided something like ddc_args
because such an option would need to be global, but we don't have a nice way to enforcing that and the UX when you get it wrong is terrible.
How badly is this needed?
Within the SDK we don't typically run through build_runner or webdev
Are you guaranteed when testing language features on these manually configured builds, issues won't show up in ddc or dart2js?
Are you guaranteed when testing
No test can offer a 100% guarantee. We also run tests in the build system repo against bleeding edge SDKs to catch issues quickly.
We do support --enable-experiment
as a bulid_runner flag now, and builders can read that configuration. The web builders do read it, and the analyzer will be configured with them.
How do you pass in flags to enable language experiments?