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

feat: migrate fuchsia/application_package.dart to null-safe (#88095)

parent 4bd8b288
...@@ -2,10 +2,6 @@ ...@@ -2,10 +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:meta/meta.dart';
import '../application_package.dart'; import '../application_package.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../build_info.dart'; import '../build_info.dart';
...@@ -13,10 +9,10 @@ import '../globals_null_migrated.dart' as globals; ...@@ -13,10 +9,10 @@ import '../globals_null_migrated.dart' as globals;
import '../project.dart'; import '../project.dart';
abstract class FuchsiaApp extends ApplicationPackage { abstract class FuchsiaApp extends ApplicationPackage {
FuchsiaApp({@required String projectBundleId}) : super(id: projectBundleId); FuchsiaApp({required String projectBundleId}) : super(id: projectBundleId);
/// Creates a new [FuchsiaApp] from a fuchsia sub project. /// Creates a new [FuchsiaApp] from a fuchsia sub project.
factory FuchsiaApp.fromFuchsiaProject(FuchsiaProject project) { static FuchsiaApp? fromFuchsiaProject(FuchsiaProject project) {
if (!project.existsSync()) { if (!project.existsSync()) {
// If the project doesn't exist at all the current hint to run flutter // If the project doesn't exist at all the current hint to run flutter
// create is accurate. // create is accurate.
...@@ -30,7 +26,7 @@ abstract class FuchsiaApp extends ApplicationPackage { ...@@ -30,7 +26,7 @@ abstract class FuchsiaApp extends ApplicationPackage {
/// Creates a new [FuchsiaApp] from an existing .far archive. /// Creates a new [FuchsiaApp] from an existing .far archive.
/// ///
/// [applicationBinary] is the path to the .far archive. /// [applicationBinary] is the path to the .far archive.
factory FuchsiaApp.fromPrebuiltApp(FileSystemEntity applicationBinary) { static FuchsiaApp? fromPrebuiltApp(FileSystemEntity applicationBinary) {
final FileSystemEntityType entityType = globals.fs.typeSync(applicationBinary.path); final FileSystemEntityType entityType = globals.fs.typeSync(applicationBinary.path);
if (entityType != FileSystemEntityType.file) { if (entityType != FileSystemEntityType.file) {
globals.printError('File "${applicationBinary.path}" does not exist or is not a .far file. Use far archive.'); globals.printError('File "${applicationBinary.path}" does not exist or is not a .far file. Use far archive.');
...@@ -50,7 +46,7 @@ abstract class FuchsiaApp extends ApplicationPackage { ...@@ -50,7 +46,7 @@ abstract class FuchsiaApp extends ApplicationPackage {
class PrebuiltFuchsiaApp extends FuchsiaApp { class PrebuiltFuchsiaApp extends FuchsiaApp {
PrebuiltFuchsiaApp({ PrebuiltFuchsiaApp({
@required String farArchive, required String farArchive,
}) : _farArchive = farArchive, }) : _farArchive = farArchive,
// TODO(zra): Extract the archive and extract the id from meta/package. // TODO(zra): Extract the archive and extract the id from meta/package.
super(projectBundleId: farArchive); super(projectBundleId: farArchive);
...@@ -65,7 +61,7 @@ class PrebuiltFuchsiaApp extends FuchsiaApp { ...@@ -65,7 +61,7 @@ class PrebuiltFuchsiaApp extends FuchsiaApp {
} }
class BuildableFuchsiaApp extends FuchsiaApp { class BuildableFuchsiaApp extends FuchsiaApp {
BuildableFuchsiaApp({this.project}) : BuildableFuchsiaApp({required this.project}) :
super(projectBundleId: project.project.manifest.appName); super(projectBundleId: project.project.manifest.appName);
final FuchsiaProject project; final FuchsiaProject project;
......
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