Migrate iOS project migrations to null safety (#83855)
This commit is contained in:
@@ -21,7 +21,7 @@ abstract class ProjectMigrator {
|
||||
|
||||
/// Return null if the line should be deleted.
|
||||
@protected
|
||||
String migrateLine(String line) {
|
||||
String? migrateLine(String line) {
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ abstract class ProjectMigrator {
|
||||
|
||||
bool migrationRequired = false;
|
||||
for (final String line in lines) {
|
||||
final String newProjectLine = migrateLine(line);
|
||||
final String? newProjectLine = migrateLine(line);
|
||||
if (newProjectLine == null) {
|
||||
logger.printTrace('Migrating $basename, removing:');
|
||||
logger.printTrace(' $line');
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/logger.dart';
|
||||
import '../../base/project_migrator.dart';
|
||||
@@ -41,7 +39,7 @@ class ProjectBaseConfigurationMigration extends ProjectMigrator {
|
||||
multiLine: true,
|
||||
);
|
||||
|
||||
final RegExpMatch match = projectBuildConfigurationList.firstMatch(originalProjectContents);
|
||||
final RegExpMatch? match = projectBuildConfigurationList.firstMatch(originalProjectContents);
|
||||
|
||||
// If the PBXProject "Runner" build configuration identifiers can't be parsed, default to the generated template identifiers.
|
||||
final String debugIdentifier = match?.group(1) ?? '97C147031CF9000F007C117D';
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/logger.dart';
|
||||
import '../../base/project_migrator.dart';
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../../base/common.dart';
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/logger.dart';
|
||||
@@ -39,7 +37,7 @@ class RemoveFrameworkLinkAndEmbeddingMigration extends ProjectMigrator {
|
||||
}
|
||||
|
||||
@override
|
||||
String migrateLine(String line) {
|
||||
String? migrateLine(String line) {
|
||||
// App.framework Frameworks reference.
|
||||
// isa = PBXFrameworksBuildPhase;
|
||||
// files = (
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/logger.dart';
|
||||
import '../../base/project_migrator.dart';
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
@@ -14,14 +12,13 @@ import 'package:flutter_tools/src/ios/migrations/remove_framework_link_and_embed
|
||||
import 'package:flutter_tools/src/ios/migrations/xcode_build_system_migration.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:test/fake.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
|
||||
void main () {
|
||||
group('iOS migration', () {
|
||||
TestUsage testUsage;
|
||||
late TestUsage testUsage;
|
||||
|
||||
setUp(() {
|
||||
testUsage = TestUsage();
|
||||
@@ -40,10 +37,10 @@ void main () {
|
||||
});
|
||||
|
||||
group('remove framework linking and embedding migration', () {
|
||||
MemoryFileSystem memoryFileSystem;
|
||||
BufferLogger testLogger;
|
||||
FakeIosProject project;
|
||||
File xcodeProjectInfoFile;
|
||||
late MemoryFileSystem memoryFileSystem;
|
||||
late BufferLogger testLogger;
|
||||
late FakeIosProject project;
|
||||
late File xcodeProjectInfoFile;
|
||||
|
||||
setUp(() {
|
||||
memoryFileSystem = MemoryFileSystem.test();
|
||||
@@ -187,10 +184,10 @@ keep this 2
|
||||
});
|
||||
|
||||
group('new Xcode build system', () {
|
||||
MemoryFileSystem memoryFileSystem;
|
||||
BufferLogger testLogger;
|
||||
FakeIosProject project;
|
||||
File xcodeWorkspaceSharedSettings;
|
||||
late MemoryFileSystem memoryFileSystem;
|
||||
late BufferLogger testLogger;
|
||||
late FakeIosProject project;
|
||||
late File xcodeWorkspaceSharedSettings;
|
||||
|
||||
setUp(() {
|
||||
memoryFileSystem = MemoryFileSystem.test();
|
||||
@@ -259,10 +256,10 @@ keep this 2
|
||||
});
|
||||
|
||||
group('Xcode default build location', () {
|
||||
MemoryFileSystem memoryFileSystem;
|
||||
BufferLogger testLogger;
|
||||
FakeIosProject project;
|
||||
File xcodeProjectWorkspaceData;
|
||||
late MemoryFileSystem memoryFileSystem;
|
||||
late BufferLogger testLogger;
|
||||
late FakeIosProject project;
|
||||
late File xcodeProjectWorkspaceData;
|
||||
|
||||
setUp(() {
|
||||
memoryFileSystem = MemoryFileSystem();
|
||||
@@ -338,10 +335,10 @@ keep this 2
|
||||
});
|
||||
|
||||
group('remove Runner project base configuration', () {
|
||||
MemoryFileSystem memoryFileSystem;
|
||||
BufferLogger testLogger;
|
||||
FakeIosProject project;
|
||||
File xcodeProjectInfoFile;
|
||||
late MemoryFileSystem memoryFileSystem;
|
||||
late BufferLogger testLogger;
|
||||
late FakeIosProject project;
|
||||
late File xcodeProjectInfoFile;
|
||||
|
||||
setUp(() {
|
||||
memoryFileSystem = MemoryFileSystem();
|
||||
@@ -495,18 +492,18 @@ keep this 3
|
||||
|
||||
class FakeIosProject extends Fake implements IosProject {
|
||||
@override
|
||||
File xcodeProjectWorkspaceData;
|
||||
File xcodeProjectWorkspaceData = MemoryFileSystem.test().file('xcodeProjectWorkspaceData');
|
||||
|
||||
@override
|
||||
File xcodeWorkspaceSharedSettings;
|
||||
File xcodeWorkspaceSharedSettings = MemoryFileSystem.test().file('xcodeWorkspaceSharedSettings');
|
||||
|
||||
@override
|
||||
File xcodeProjectInfoFile;
|
||||
File xcodeProjectInfoFile = MemoryFileSystem.test().file('xcodeProjectInfoFile');
|
||||
}
|
||||
|
||||
class FakeIOSMigrator extends ProjectMigrator {
|
||||
FakeIOSMigrator({@required this.succeeds})
|
||||
: super(null);
|
||||
FakeIOSMigrator({required this.succeeds})
|
||||
: super(BufferLogger.test());
|
||||
|
||||
final bool succeeds;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user