Skip to content

[webdev] Cleanup unused null-safety options #2657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion webdev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 3.8.0-wip
## 4.0.0-wip
- Remove deprecated `--null-safety` flag. Dart 3 only supports [sound null safety](https://dart.dev/null-safety).

## 3.7.2

Expand Down
20 changes: 0 additions & 20 deletions webdev/lib/src/command/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ const releaseFlag = 'release';
const requireBuildWebCompilersFlag = 'build-web-compilers';
const enableExpressionEvaluationFlag = 'enable-expression-evaluation';
const verboseFlag = 'verbose';
const nullSafetyFlag = 'null-safety';
const nullSafetySound = 'sound';
const nullSafetyUnsound = 'unsound';
const nullSafetyAuto = 'auto';
const disableDdsFlag = 'disable-dds';
const enableExperimentOption = 'enable-experiment';
const canaryFeaturesFlag = 'canary';
Expand Down Expand Up @@ -105,7 +101,6 @@ class Configuration {
final bool? _enableExpressionEvaluation;
final bool? _verbose;
final bool? _disableDds;
final String? _nullSafety;
final List<String>? _experiments;
final bool? _canaryFeatures;
final bool? _offline;
Expand All @@ -132,7 +127,6 @@ class Configuration {
bool? enableExpressionEvaluation,
bool? verbose,
bool? disableDds,
String? nullSafety,
List<String>? experiments,
bool? canaryFeatures,
bool? offline,
Expand All @@ -155,7 +149,6 @@ class Configuration {
_disableDds = disableDds,
_enableExpressionEvaluation = enableExpressionEvaluation,
_verbose = verbose,
_nullSafety = nullSafety,
_experiments = experiments,
_canaryFeatures = canaryFeatures,
_offline = offline {
Expand Down Expand Up @@ -231,7 +224,6 @@ class Configuration {
enableExpressionEvaluation:
other._enableExpressionEvaluation ?? _enableExpressionEvaluation,
verbose: other._verbose ?? _verbose,
nullSafety: other._nullSafety ?? _nullSafety,
experiments: other._experiments ?? _experiments,
canaryFeatures: other._canaryFeatures ?? _canaryFeatures,
offline: other._offline ?? _offline);
Expand Down Expand Up @@ -278,13 +270,6 @@ class Configuration {

bool get verbose => _verbose ?? false;

/// Null safety mode:
///
/// 'sound', 'unsound', or 'auto'.
/// 'auto' indicates that the default `package:build_web_compilers`
/// behavior should be used.
String get nullSafety => _nullSafety ?? 'auto';

List<String> get experiments => _experiments ?? [];

bool get canaryFeatures => _canaryFeatures ?? false;
Expand Down Expand Up @@ -398,10 +383,6 @@ class Configuration {
? argResults[verboseFlag] as bool?
: defaultConfiguration.verbose;

final nullSafety = argResults.options.contains(nullSafetyFlag)
? argResults[nullSafetyFlag] as String?
: defaultConfiguration.nullSafety;

final disableDds = argResults.options.contains(disableDdsFlag)
? argResults[disableDdsFlag] as bool?
: defaultConfiguration.disableDds;
Expand Down Expand Up @@ -441,7 +422,6 @@ class Configuration {
disableDds: disableDds,
enableExpressionEvaluation: enableExpressionEvaluation,
verbose: verbose,
nullSafety: nullSafety,
experiments: experiments,
canaryFeatures: canaryFeatures,
offline: offline,
Expand Down
12 changes: 0 additions & 12 deletions webdev/lib/src/command/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ void addSharedArgs(ArgParser argParser,
'A value of "NONE" indicates that no "--output" value should be '
'passed to `build_runner`.',
)
..addOption(nullSafetyFlag,
abbr: 'n',
defaultsTo: nullSafetyAuto,
allowed: [nullSafetySound, nullSafetyUnsound, nullSafetyAuto],
help:
'DEPRECATED: If "sound", `package:build_web_compilers` will be run '
'with sound null safety support. '
'If "unsound", `package:build_web_compilers` will be run without '
'sound null safety support. '
'If "auto", the default `package:build_web_compilers` '
'behavior is used.',
hide: true)
..addFlag(releaseFlag,
abbr: 'r',
defaultsTo: releaseDefault,
Expand Down
7 changes: 0 additions & 7 deletions webdev/test/configuration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ void main() {
argParser = ArgParser()
..addFlag('release')
..addFlag(launchInChromeFlag, defaultsTo: false)
..addOption(nullSafetyFlag, defaultsTo: nullSafetyAuto)
..addOption(userDataDirFlag, defaultsTo: null);
});

Expand Down Expand Up @@ -71,12 +70,6 @@ void main() {
throwsA(isA<InvalidConfiguration>()));
});

test('nullSafety defaults to auto', () {
final argResults = argParser.parse(['']);
final defaultConfiguration = Configuration.fromArgs(argResults);
expect(defaultConfiguration.nullSafety, equals(nullSafetyAuto));
});

test(
'must not provide debug related configuration when enableInjectedClient '
'is false', () {
Expand Down
25 changes: 0 additions & 25 deletions webdev/test/e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,30 +153,6 @@ void main() {
skip: Platform.isWindows,
);
}
test(
'and --null-safety=sound',
() async {
final args = [
'build',
'-o',
'web:${d.sandbox}',
'--no-release',
'--null-safety=sound'
];

final process = await testRunner.runWebDev(args,
workingDirectory: soundExampleDirectory);

final expectedItems = <Object>['Built with build_runner'];

await checkProcessStdout(process, expectedItems);
await process.shouldExit(0);

await d.file('main.ddc.js', isNotEmpty).validate();
},
// https://github.com/dart-lang/webdev/issues/2489
skip: Platform.isWindows,
);
});

group('should build with --output=NONE', () {
Expand Down Expand Up @@ -281,7 +257,6 @@ void main() {
'daemon',
'web:$openPort',
'--enable-expression-evaluation',
'--null-safety=sound',
'--verbose',
];
final process = await testRunner.runWebDev(args,
Expand Down