Unverified Commit bd935e5d authored by 嘟囔's avatar 嘟囔 Committed by GitHub

feat: migrate test_data/project.dart to null safety (#92646)

parent 125545da
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'project.dart'; import 'project.dart';
class BasicProject extends Project { class BasicProject extends Project {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../../src/common.dart'; import '../../src/common.dart';
import 'deferred_components_config.dart'; import 'deferred_components_config.dart';
import 'project.dart'; import 'project.dart';
...@@ -84,7 +82,7 @@ class BasicDeferredComponentsConfig extends DeferredComponentsConfig { ...@@ -84,7 +82,7 @@ class BasicDeferredComponentsConfig extends DeferredComponentsConfig {
'''; ''';
@override @override
String get deferredComponentsGolden => r''' String? get deferredComponentsGolden => r'''
loading-units: loading-units:
- id: 2 - id: 2
libraries: libraries:
...@@ -604,7 +602,7 @@ class NoAndroidDynamicFeatureModuleDeferredComponentsConfig extends BasicDeferre ...@@ -604,7 +602,7 @@ class NoAndroidDynamicFeatureModuleDeferredComponentsConfig extends BasicDeferre
/// Missing golden /// Missing golden
class NoGoldenDeferredComponentsConfig extends BasicDeferredComponentsConfig { class NoGoldenDeferredComponentsConfig extends BasicDeferredComponentsConfig {
@override @override
String get deferredComponentsGolden => null; String? get deferredComponentsGolden => null;
} }
/// Missing golden /// Missing golden
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:meta/meta.dart';
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
...@@ -750,8 +747,8 @@ void main() { ...@@ -750,8 +747,8 @@ void main() {
'''; ''';
String l10nYaml({ String l10nYaml({
@required bool useDeferredLoading, required bool useDeferredLoading,
@required bool useSyntheticPackage, required bool useSyntheticPackage,
}) { }) {
String l10nYamlString = ''; String l10nYamlString = '';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import '../../src/common.dart'; import '../../src/common.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import '../test_utils.dart'; import '../test_utils.dart';
...@@ -21,31 +19,32 @@ const String _kDefaultHtml = ''' ...@@ -21,31 +19,32 @@ const String _kDefaultHtml = '''
'''; ''';
abstract class Project { abstract class Project {
Directory dir; late Directory dir;
String get pubspec; String get pubspec;
String get main; String? get main => null;
String get test => null; String? get test => null;
String get generatedFile => null; String? get generatedFile => null;
DeferredComponentsConfig get deferredComponents => null; DeferredComponentsConfig? get deferredComponents => null;
Uri get mainDart => Uri.parse('package:test/main.dart'); Uri get mainDart => Uri.parse('package:test/main.dart');
Future<void> setUpIn(Directory dir) async { Future<void> setUpIn(Directory dir) async {
this.dir = dir; this.dir = dir;
writeFile(fileSystem.path.join(dir.path, 'pubspec.yaml'), pubspec); writeFile(fileSystem.path.join(dir.path, 'pubspec.yaml'), pubspec);
final String? main = this.main;
if (main != null) { if (main != null) {
writeFile(fileSystem.path.join(dir.path, 'lib', 'main.dart'), main); writeFile(fileSystem.path.join(dir.path, 'lib', 'main.dart'), main);
} }
final String? test = this.test;
if (test != null) { if (test != null) {
writeFile(fileSystem.path.join(dir.path, 'test', 'test.dart'), test); writeFile(fileSystem.path.join(dir.path, 'test', 'test.dart'), test);
} }
final String? generatedFile = this.generatedFile;
if (generatedFile != null) { if (generatedFile != null) {
writeFile(fileSystem.path.join(dir.path, '.dart_tool', 'flutter_gen', 'flutter_gen.dart'), generatedFile); writeFile(fileSystem.path.join(dir.path, '.dart_tool', 'flutter_gen', 'flutter_gen.dart'), generatedFile);
} }
if (deferredComponents != null) { deferredComponents?.setUpIn(dir);
deferredComponents.setUpIn(dir);
}
writeFile(fileSystem.path.join(dir.path, 'web', 'index.html'), _kDefaultHtml); writeFile(fileSystem.path.join(dir.path, 'web', 'index.html'), _kDefaultHtml);
writePackages(dir.path); writePackages(dir.path);
await getPackages(dir.path); await getPackages(dir.path);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'project.dart'; import 'project.dart';
class ProjectWithEarlyError extends Project { class ProjectWithEarlyError extends Project {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import '../test_utils.dart'; import '../test_utils.dart';
import 'project.dart'; import 'project.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'project.dart'; import 'project.dart';
class SteppingProject extends Project { class SteppingProject extends Project {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'project.dart'; import 'project.dart';
class TestProject extends Project { class TestProject extends Project {
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment