From 3be0c9ef278e1d20b3ba8619a4fc4df07e32bf3a Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 17 Jan 2024 14:25:42 -0500 Subject: [PATCH] [ci] Work around Google Maps podspec lint issue https://github.com/flutter/packages/pull/5873 removed a plugin-level workaround for a `podspec-lint` issue, under the incorrect belief that it was no longer necessary. Rather than re-add that, which degrades the experience for plugin clients who are targeting iOS 13+ with their apps, this adds a hack in the CI tooling itself to modify the podspec to require iOS 13 before linting. This could in theory cause false-positive lints about deprecated APIs, but currently doesn't, and that could be addressed in the unlikely event that it comes up. See https://github.com/flutter/flutter/issues/94491 --- script/tool/lib/src/podspec_check_command.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/script/tool/lib/src/podspec_check_command.dart b/script/tool/lib/src/podspec_check_command.dart index b0982b7ee69..4ebcf858612 100644 --- a/script/tool/lib/src/podspec_check_command.dart +++ b/script/tool/lib/src/podspec_check_command.dart @@ -128,6 +128,19 @@ class PodspecCheckCommand extends PackageLoopingCommand { final String podspecBasename = podspec.basename; print('Linting $podspecBasename'); + // Hack the google_maps_flutter plugin's podspec to require iOS 13+, so that + // it gets a version of GoogleMaps that supports arm64 simulators, allowing + // linting to work on arm64 machines without forcing all plugin clients off + // of arm64 simulators. + // TODO(stuartmorgan): Remove this hack once + // https://github.com/flutter/flutter/issues/94491 is done. + String? originalPodspec; + if (podspecBasename == 'google_maps_flutter_ios.podspec') { + originalPodspec = podspec.readAsStringSync(); + podspec.writeAsStringSync( + originalPodspec.replaceAll(":ios, '12.0'", ":ios, '13.0'")); + } + // Lint plugin as framework (use_frameworks!). final ProcessResult frameworkResult = await _runPodLint(podspecPath, libraryLint: true); @@ -140,6 +153,10 @@ class PodspecCheckCommand extends PackageLoopingCommand { print(libraryResult.stdout); print(libraryResult.stderr); + if (originalPodspec != null) { + podspec.writeAsStringSync(originalPodspec); + } + return frameworkResult.exitCode == 0 && libraryResult.exitCode == 0; }