Unverified Commit cbc7ce08 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Clean up null assumptions for Xcode and CocoaPods classes (#83442)

parent 883cb3e8
...@@ -397,7 +397,7 @@ enum EnvironmentType { ...@@ -397,7 +397,7 @@ enum EnvironmentType {
simulator, simulator,
} }
String? validatedBuildNumberForPlatform(TargetPlatform targetPlatform, String buildNumber, Logger logger) { String? validatedBuildNumberForPlatform(TargetPlatform targetPlatform, String? buildNumber, Logger logger) {
if (buildNumber == null) { if (buildNumber == null) {
return null; return null;
} }
...@@ -444,7 +444,7 @@ String? validatedBuildNumberForPlatform(TargetPlatform targetPlatform, String bu ...@@ -444,7 +444,7 @@ String? validatedBuildNumberForPlatform(TargetPlatform targetPlatform, String bu
return buildNumber; return buildNumber;
} }
String? validatedBuildNameForPlatform(TargetPlatform targetPlatform, String buildName, Logger logger) { String? validatedBuildNameForPlatform(TargetPlatform targetPlatform, String? buildName, Logger logger) {
if (buildName == null) { if (buildName == null) {
return null; return null;
} }
......
...@@ -109,7 +109,7 @@ void _updateGeneratedEnvironmentVariablesScript({ ...@@ -109,7 +109,7 @@ void _updateGeneratedEnvironmentVariablesScript({
/// Build name parsed and validated from build info and manifest. Used for CFBundleShortVersionString. /// Build name parsed and validated from build info and manifest. Used for CFBundleShortVersionString.
String parsedBuildName({ String parsedBuildName({
@required FlutterManifest manifest, @required FlutterManifest manifest,
@required BuildInfo buildInfo, BuildInfo buildInfo,
}) { }) {
final String buildNameToParse = buildInfo?.buildName ?? manifest.buildName; final String buildNameToParse = buildInfo?.buildName ?? manifest.buildName;
return validatedBuildNameForPlatform(TargetPlatform.ios, buildNameToParse, globals.logger); return validatedBuildNameForPlatform(TargetPlatform.ios, buildNameToParse, globals.logger);
...@@ -118,7 +118,7 @@ String parsedBuildName({ ...@@ -118,7 +118,7 @@ String parsedBuildName({
/// Build number parsed and validated from build info and manifest. Used for CFBundleVersion. /// Build number parsed and validated from build info and manifest. Used for CFBundleVersion.
String parsedBuildNumber({ String parsedBuildNumber({
@required FlutterManifest manifest, @required FlutterManifest manifest,
@required BuildInfo buildInfo, BuildInfo buildInfo,
}) { }) {
String buildNumberToParse = buildInfo?.buildNumber ?? manifest.buildNumber; String buildNumberToParse = buildInfo?.buildNumber ?? manifest.buildNumber;
final String buildNumber = validatedBuildNumberForPlatform( final String buildNumber = validatedBuildNumberForPlatform(
...@@ -173,8 +173,9 @@ List<String> _xcodeBuildSettingsLines({ ...@@ -173,8 +173,9 @@ List<String> _xcodeBuildSettingsLines({
final String buildNumber = parsedBuildNumber(manifest: project.manifest, buildInfo: buildInfo) ?? '1'; final String buildNumber = parsedBuildNumber(manifest: project.manifest, buildInfo: buildInfo) ?? '1';
xcodeBuildSettings.add('FLUTTER_BUILD_NUMBER=$buildNumber'); xcodeBuildSettings.add('FLUTTER_BUILD_NUMBER=$buildNumber');
if (globals.artifacts is LocalEngineArtifacts) { final Artifacts artifacts = globals.artifacts;
final LocalEngineArtifacts localEngineArtifacts = globals.artifacts as LocalEngineArtifacts; if (artifacts is LocalEngineArtifacts) {
final LocalEngineArtifacts localEngineArtifacts = artifacts;
final String engineOutPath = localEngineArtifacts.engineOutPath; final String engineOutPath = localEngineArtifacts.engineOutPath;
xcodeBuildSettings.add('FLUTTER_ENGINE=${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}'); xcodeBuildSettings.add('FLUTTER_ENGINE=${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}');
......
...@@ -389,7 +389,7 @@ class XcodeProjectInfo { ...@@ -389,7 +389,7 @@ class XcodeProjectInfo {
} }
/// Returns unique scheme matching [buildInfo], or null, if there is no unique /// Returns unique scheme matching [buildInfo], or null, if there is no unique
/// best match. /// best match.
String? schemeFor(BuildInfo buildInfo) { String? schemeFor(BuildInfo? buildInfo) {
final String expectedScheme = expectedSchemeFor(buildInfo); final String expectedScheme = expectedSchemeFor(buildInfo);
if (schemes.contains(expectedScheme)) { if (schemes.contains(expectedScheme)) {
return expectedScheme; return expectedScheme;
......
...@@ -71,8 +71,8 @@ enum CocoaPodsStatus { ...@@ -71,8 +71,8 @@ enum CocoaPodsStatus {
brokenInstall, brokenInstall,
} }
String get cocoaPodsMinimumVersion => '1.9.0'; const Version cocoaPodsMinimumVersion = Version.withText(1, 9, 0, '1.9.0');
String get cocoaPodsRecommendedVersion => '1.10.0'; const Version cocoaPodsRecommendedVersion = Version.withText(1, 10, 0, '1.10.0');
/// Cocoapods is a dependency management solution for iOS and macOS applications. /// Cocoapods is a dependency management solution for iOS and macOS applications.
/// ///
...@@ -142,10 +142,10 @@ class CocoaPods { ...@@ -142,10 +142,10 @@ class CocoaPods {
if (installedVersion == null) { if (installedVersion == null) {
return CocoaPodsStatus.unknownVersion; return CocoaPodsStatus.unknownVersion;
} }
if (installedVersion < Version.parse(cocoaPodsMinimumVersion)) { if (installedVersion < cocoaPodsMinimumVersion) {
return CocoaPodsStatus.belowMinimumVersion; return CocoaPodsStatus.belowMinimumVersion;
} }
if (installedVersion < Version.parse(cocoaPodsRecommendedVersion)) { if (installedVersion < cocoaPodsRecommendedVersion) {
return CocoaPodsStatus.belowRecommendedVersion; return CocoaPodsStatus.belowRecommendedVersion;
} }
return CocoaPodsStatus.recommended; return CocoaPodsStatus.recommended;
......
...@@ -52,7 +52,7 @@ class CocoaPodsValidator extends DoctorValidator { ...@@ -52,7 +52,7 @@ class CocoaPodsValidator extends DoctorValidator {
status = ValidationType.partial; status = ValidationType.partial;
final String currentVersionText = await _cocoaPods.cocoaPodsVersionText; final String currentVersionText = await _cocoaPods.cocoaPodsVersionText;
messages.add(ValidationMessage.hint( messages.add(ValidationMessage.hint(
_userMessages.cocoaPodsOutdated(currentVersionText, cocoaPodsRecommendedVersion, noCocoaPodsConsequence, cocoaPodsInstallInstructions))); _userMessages.cocoaPodsOutdated(currentVersionText, cocoaPodsRecommendedVersion.toString(), noCocoaPodsConsequence, cocoaPodsInstallInstructions)));
} }
} }
......
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