dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
792 stars 208 forks source link

How to run language experiments with WebStorm? #2229

Closed mnordine closed 1 year ago

mnordine commented 5 years ago
Screen Shot 2019-04-14 at 6 42 47 PM

How do you pass in flags to enable language experiments?

mnordine commented 5 years 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

sigmundch commented 5 years ago

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?

mnordine commented 5 years ago

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?

jwren commented 5 years ago

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.

kevmoo commented 5 years ago

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

natebosch commented 5 years ago

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.

mnordine commented 5 years ago

How does the Dart team test new language features with DDC and dart2js?

vsmenon commented 5 years ago

@kevmoo - can you please move this issue to package:build?

natebosch commented 5 years ago

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?

mnordine commented 5 years ago

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?

natebosch commented 5 years ago

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.

jakemac53 commented 1 year ago

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.