diff --git a/build_web_compilers/CHANGELOG.md b/build_web_compilers/CHANGELOG.md index 0a5c3ad169..c36c7518ca 100644 --- a/build_web_compilers/CHANGELOG.md +++ b/build_web_compilers/CHANGELOG.md @@ -1,5 +1,8 @@ -## 3.2.1-dev +## 3.2.1 +- Fix enable-experiment flag support for dartdevc to also pass experiment flags + to dartdevc as well as kernel. +- Add deprecation warning for the old `experiments` config. - Update `pub run` references to `dart run`. - Fix `doctor` command warnings for this package. diff --git a/build_web_compilers/lib/builders.dart b/build_web_compilers/lib/builders.dart index c096ea9049..5eb6584c51 100644 --- a/build_web_compilers/lib/builders.dart +++ b/build_web_compilers/lib/builders.dart @@ -27,7 +27,8 @@ Builder ddcBuilderUnsound(BuilderOptions options) => ddcBuilder(options, soundNullSafety: false); Builder ddcBuilder(BuilderOptions options, {bool soundNullSafety = false}) { - validateOptions(options.config, _supportedOptions, 'build_web_compilers:ddc'); + validateOptions(options.config, _supportedOptions, 'build_web_compilers:ddc', + deprecatedOptions: _deprecatedOptions); _ensureSameDdcOptions(options); return DevCompilerBuilder( @@ -50,7 +51,8 @@ Builder ddcKernelBuilderSound(BuilderOptions options) => Builder ddcKernelBuilder(BuilderOptions options, {bool soundNullSafety = false}) { - validateOptions(options.config, _supportedOptions, 'build_web_compilers:ddc'); + validateOptions(options.config, _supportedOptions, 'build_web_compilers:ddc', + deprecatedOptions: _deprecatedOptions); _ensureSameDdcOptions(options); return KernelBuilder( @@ -135,9 +137,11 @@ const _emitDebugSymbolsOption = 'emit-debug-symbols'; const _trackUnusedInputsCompilerOption = 'track-unused-inputs'; const _environmentOption = 'environment'; const _experimentOption = 'experiments'; +const _deprecatedOptions = [ + _experimentOption, +]; const _supportedOptions = [ _environmentOption, - _experimentOption, _useIncrementalCompilerOption, _generateFullDillOption, _emitDebugSymbolsOption, diff --git a/build_web_compilers/lib/src/dev_compiler_builder.dart b/build_web_compilers/lib/src/dev_compiler_builder.dart index 4bb52230c5..cc910aeb47 100644 --- a/build_web_compilers/lib/src/dev_compiler_builder.dart +++ b/build_web_compilers/lib/src/dev_compiler_builder.dart @@ -8,6 +8,7 @@ import 'dart:io'; import 'package:bazel_worker/bazel_worker.dart'; import 'package:build/build.dart'; +import 'package:build/experiments.dart'; import 'package:build_modules/build_modules.dart'; import 'package:path/path.dart' as p; import 'package:scratch_space/scratch_space.dart'; @@ -76,9 +77,6 @@ class DevCompilerBuilder implements Builder { /// Environment defines to pass to ddc (as -D variables). final Map environment; - /// Experiments to pass to ddc (as --enable-experiment= args). - final Iterable experiments; - /// Whether or not strong null safety should be enabled. final bool soundNullSafety; @@ -92,7 +90,6 @@ class DevCompilerBuilder implements Builder { String? librariesPath, String? platformSdk, this.environment = const {}, - this.experiments = const [], this.soundNullSafety = false}) : platformSdk = platformSdk ?? sdkDir, librariesPath = librariesPath ?? @@ -144,7 +141,6 @@ class DevCompilerBuilder implements Builder { sdkKernelPath, librariesPath, environment, - experiments, soundNullSafety); } on DartDevcCompilationException catch (e) { await handleError(e); @@ -166,7 +162,6 @@ Future _createDevCompilerModule( String sdkKernelPath, String librariesPath, Map environment, - Iterable experiments, bool soundNullSafety, {bool debugMode = true}) async { var transitiveDeps = await buildStep.trackStage('CollectTransitiveDeps', @@ -228,7 +223,8 @@ Future _createDevCompilerModule( '--used-inputs-file=${usedInputsFile.uri.toFilePath()}', for (var source in module.sources) _sourceArg(source), for (var define in environment.entries) '-D${define.key}=${define.value}', - for (var experiment in experiments) '--enable-experiment=$experiment', + for (var experiment in enabledExperiments) + '--enable-experiment=$experiment', '--${soundNullSafety ? '' : 'no-'}sound-null-safety', ]) ..inputs.add(Input() diff --git a/build_web_compilers/pubspec.yaml b/build_web_compilers/pubspec.yaml index 4a15d334f6..24b63ab7f0 100644 --- a/build_web_compilers/pubspec.yaml +++ b/build_web_compilers/pubspec.yaml @@ -1,5 +1,5 @@ name: build_web_compilers -version: 3.2.1-dev +version: 3.2.1 description: Builder implementations wrapping Dart compilers. repository: https://github.com/dart-lang/build/tree/master/build_web_compilers