diff --git a/packages/_flutter_web_build_script/lib/build_script.dart b/packages/_flutter_web_build_script/lib/build_script.dart index d0c4f5d807..3635df9f2d 100644 --- a/packages/_flutter_web_build_script/lib/build_script.dart +++ b/packages/_flutter_web_build_script/lib/build_script.dart @@ -5,9 +5,6 @@ // ignore_for_file: implementation_imports import 'dart:isolate'; -import 'package:analyzer/dart/analysis/results.dart'; -import 'package:analyzer/dart/analysis/utilities.dart'; -import 'package:analyzer/dart/ast/ast.dart'; import 'package:build/build.dart'; import 'package:build_config/build_config.dart'; import 'package:build_modules/build_modules.dart'; @@ -75,27 +72,6 @@ final List builders = [ ], ), ), - core.apply( - 'flutter_tools:shell', - [ - (BuilderOptions options) { - final bool hasPlugins = options.config['hasPlugins'] == true; - final bool initializePlatform = options.config['initializePlatform'] == true; - return FlutterWebShellBuilder( - hasPlugins: hasPlugins, - initializePlatform: initializePlatform, - ); - }, - ], - core.toRoot(), - hideOutput: true, - defaultGenerateFor: const InputSet( - include: [ - 'lib/**', - 'web/**', - ], - ), - ), core.apply( 'flutter_tools:module_library', [moduleLibraryBuilder], @@ -127,6 +103,7 @@ final List builders = [ kernelTargetName: 'ddc', useIncrementalCompiler: true, trackUnusedInputs: true, + experiments: ['non-nullable'], // ignore: deprecated_member_use ), (BuilderOptions builderOptions) => DevCompilerBuilder( useIncrementalCompiler: true, @@ -134,6 +111,7 @@ final List builders = [ platform: flutterWebPlatform, platformSdk: builderOptions.config['flutterWebSdk'] as String, sdkKernelPath: path.url.join('kernel', 'flutter_ddc_sdk.dill'), + experiments: ['non-nullable'], librariesPath: path.absolute(path.join(builderOptions.config['flutterWebSdk'] as String, 'libraries.json')), ), ], @@ -141,23 +119,6 @@ final List builders = [ isOptional: true, hideOutput: true, appliesBuilders: ['flutter_tools:ddc_modules']), - core.apply( - 'flutter_tools:entrypoint', - [ - (BuilderOptions options) => FlutterWebEntrypointBuilder( - options.config[kReleaseFlag] as bool ?? false, - options.config[kProfileFlag] as bool ?? false, - options.config['flutterWebSdk'] as String, - ), - ], - core.toRoot(), - hideOutput: true, - defaultGenerateFor: const InputSet( - include: [ - 'lib/**_web_entrypoint.dart', - ], - ), - ), core.apply( 'flutter_tools:test_entrypoint', [ @@ -208,35 +169,6 @@ class FlutterWebTestEntrypointBuilder implements Builder { } } -/// A ddc-only entry point builder that respects the Flutter target flag. -class FlutterWebEntrypointBuilder implements Builder { - const FlutterWebEntrypointBuilder(this.release, this.profile, this.flutterWebSdk); - - final bool release; - final bool profile; - final String flutterWebSdk; - - @override - Map> get buildExtensions => const >{ - '.dart': [ - ddcBootstrapExtension, - jsEntrypointExtension, - jsEntrypointSourceMapExtension, - jsEntrypointArchiveExtension, - digestsEntrypointExtension, - ], - }; - - @override - Future build(BuildStep buildStep) async { - await bootstrapDdc( - buildStep, - platform: flutterWebPlatform, - skipPlatformCheck: true, - ); - } -} - /// Bootstraps the test entry point. class FlutterWebTestBootstrapBuilder implements Builder { const FlutterWebTestBootstrapBuilder(); @@ -334,86 +266,3 @@ StreamChannel postMessageChannel() { } } } - -/// A shell builder which generates the web specific entry point. -class FlutterWebShellBuilder implements Builder { - const FlutterWebShellBuilder({this.hasPlugins = false, this.initializePlatform = true}); - - final bool hasPlugins; - - /// Whether to call webOnlyInitializePlatform. - final bool initializePlatform; - - @override - Future build(BuildStep buildStep) async { - final AssetId dartEntrypointId = buildStep.inputId; - final bool isAppEntrypoint = await _isAppEntryPoint(dartEntrypointId, buildStep); - if (!isAppEntrypoint) { - return; - } - final AssetId outputId = buildStep.inputId.changeExtension('_web_entrypoint.dart'); - final String pluginRegistrantPath = _getPluginRegistrantPath(dartEntrypointId.path); - if (hasPlugins) { - await buildStep.writeAsString(outputId, ''' -import 'dart:ui' as ui; - -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -import '$pluginRegistrantPath'; -import "${path.url.basename(buildStep.inputId.path)}" as entrypoint; - -Future main() async { - registerPlugins(webPluginRegistry); - if ($initializePlatform) { - await ui.webOnlyInitializePlatform(); - } - entrypoint.main(); -} -'''); - } else { - await buildStep.writeAsString(outputId, ''' -import 'dart:ui' as ui; - -import "${path.url.basename(buildStep.inputId.path)}" as entrypoint; - -Future main() async { - if ($initializePlatform) { - await ui.webOnlyInitializePlatform(); - } - entrypoint.main(); -} -'''); - } - } - - /// Gets the relative path to the generated plugin registrant from the app - /// app entrypoint. - String _getPluginRegistrantPath(String entrypoint) { - return path.url.relative('lib/generated_plugin_registrant.dart', - from: path.url.dirname(entrypoint)); - } - - @override - Map> get buildExtensions => const >{ - '.dart': ['_web_entrypoint.dart'], - }; -} - -/// Returns whether or not [dartId] is an app entry point (basically, whether -/// or not it has a `main` function). -Future _isAppEntryPoint(AssetId dartId, AssetReader reader) async { - assert(dartId.extension == '.dart'); - // Skip reporting errors here, dartdevc will report them later with nicer - // formatting. - final ParseStringResult result = parseString( - content: await reader.readAsString(dartId), - throwIfDiagnostics: false, - ); - // Allow two or fewer arguments so that entrypoints intended for use with - // [spawnUri] get counted. - return result.unit.declarations.any((CompilationUnitMember node) { - return node is FunctionDeclaration && - node.name.name == 'main' && - node.functionExpression.parameters.parameters.length <= 2; - }); -} diff --git a/packages/flutter/test/foundation/print_test.dart b/packages/flutter/test/foundation/print_test.dart index efbcb453c2..e20e8edce2 100644 --- a/packages/flutter/test/foundation/print_test.dart +++ b/packages/flutter/test/foundation/print_test.dart @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 - +// @dart = 2.10 import 'package:flutter/foundation.dart'; import 'package:fake_async/fake_async.dart'; import '../flutter_test_alternative.dart'; import 'capture_output.dart'; +String? foo; + void main() { test('debugPrint', () { expect( diff --git a/packages/flutter_driver/test/common.dart b/packages/flutter_driver/test/common.dart index e5987b02b1..8e7845825a 100644 --- a/packages/flutter_driver/test/common.dart +++ b/packages/flutter_driver/test/common.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:io'; import 'package:flutter_driver/src/common/error.dart'; diff --git a/packages/flutter_driver/test/flutter_driver_test.dart b/packages/flutter_driver/test/flutter_driver_test.dart index 95bfba7e53..339e562587 100644 --- a/packages/flutter_driver/test/flutter_driver_test.dart +++ b/packages/flutter_driver/test/flutter_driver_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:async'; import 'dart:convert'; diff --git a/packages/flutter_driver/test/src/web_tests/web_extension_test.dart b/packages/flutter_driver/test/src/web_tests/web_extension_test.dart index 4da772ea23..6cdb0c8571 100644 --- a/packages/flutter_driver/test/src/web_tests/web_extension_test.dart +++ b/packages/flutter_driver/test/src/web_tests/web_extension_test.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 import 'dart:js' as js; import 'package:flutter_driver/src/extension/_extension_web.dart'; diff --git a/packages/flutter_driver/test_driver/failure.dart b/packages/flutter_driver/test_driver/failure.dart index c2d413142a..a0c717efe1 100644 --- a/packages/flutter_driver/test_driver/failure.dart +++ b/packages/flutter_driver/test_driver/failure.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + void main() { // Dummy. Only needed because driver needs an entry point. } diff --git a/packages/flutter_driver/test_driver/failure_test.dart b/packages/flutter_driver/test_driver/failure_test.dart index 07012847dc..919bbb3d57 100644 --- a/packages/flutter_driver/test_driver/failure_test.dart +++ b/packages/flutter_driver/test_driver/failure_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + void main() { // Intentionally fail the test. We want to see driver return a non-zero exit // code when this happens. diff --git a/packages/flutter_tools/lib/src/isolated/web_compilation_delegate.dart b/packages/flutter_tools/lib/src/isolated/web_compilation_delegate.dart index fe5b734b91..5e226fa634 100644 --- a/packages/flutter_tools/lib/src/isolated/web_compilation_delegate.dart +++ b/packages/flutter_tools/lib/src/isolated/web_compilation_delegate.dart @@ -226,12 +226,6 @@ class BuildDaemonCreator { '--enable-experiment=non-nullable', '--skip-build-script-check', '--define', 'flutter_tools:ddc=flutterWebSdk=$flutterWebSdk', - '--define', 'flutter_tools:entrypoint=flutterWebSdk=$flutterWebSdk', - '--define', 'flutter_tools:entrypoint=release=$release', - '--define', 'flutter_tools:entrypoint=profile=$profile', - '--define', 'flutter_tools:shell=flutterWebSdk=$flutterWebSdk', - '--define', 'flutter_tools:shell=hasPlugins=$hasPlugins', - '--define', 'flutter_tools:shell=initializePlatform=$initializePlatform', // The following will cause build runner to only build tests that were requested. if (testTargets != null && testTargets.hasBuildFilters) for (final String buildFilter in testTargets.buildFilters) diff --git a/packages/flutter_web_plugins/lib/flutter_web_plugins.dart b/packages/flutter_web_plugins/lib/flutter_web_plugins.dart index f6bad0da9a..9459dfceac 100644 --- a/packages/flutter_web_plugins/lib/flutter_web_plugins.dart +++ b/packages/flutter_web_plugins/lib/flutter_web_plugins.dart @@ -2,5 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + export 'src/plugin_event_channel.dart'; export 'src/plugin_registry.dart'; diff --git a/packages/flutter_web_plugins/lib/src/plugin_event_channel.dart b/packages/flutter_web_plugins/lib/src/plugin_event_channel.dart index 86497fe7bf..d52d2496c6 100644 --- a/packages/flutter_web_plugins/lib/src/plugin_event_channel.dart +++ b/packages/flutter_web_plugins/lib/src/plugin_event_channel.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:async'; import 'package:flutter/services.dart'; diff --git a/packages/flutter_web_plugins/lib/src/plugin_registry.dart b/packages/flutter_web_plugins/lib/src/plugin_registry.dart index 88bac5e940..00eaf85783 100644 --- a/packages/flutter_web_plugins/lib/src/plugin_registry.dart +++ b/packages/flutter_web_plugins/lib/src/plugin_registry.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:async'; import 'dart:ui' as ui; diff --git a/packages/flutter_web_plugins/test/plugin_event_channel_test.dart b/packages/flutter_web_plugins/test/plugin_event_channel_test.dart index 35eeb3e621..6d62b1271f 100644 --- a/packages/flutter_web_plugins/test/plugin_event_channel_test.dart +++ b/packages/flutter_web_plugins/test/plugin_event_channel_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + @TestOn('chrome') // Uses web-only Flutter SDK import 'dart:async'; diff --git a/packages/flutter_web_plugins/test/plugin_registry_test.dart b/packages/flutter_web_plugins/test/plugin_registry_test.dart index ac6016f5ec..1088e28164 100644 --- a/packages/flutter_web_plugins/test/plugin_registry_test.dart +++ b/packages/flutter_web_plugins/test/plugin_registry_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + @TestOn('chrome') // Uses web-only Flutter SDK import 'dart:ui' as ui;