From 088fa24463bfa022a5e49ed8ee17b9abb3098ebb Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 2 Dec 2019 13:26:32 -0800 Subject: [PATCH] Set the LANG when invoking cocoapods (#45710) --- dev/bots/test.dart | 3 +++ .../bin/tasks/flutter_view_ios__start_up.dart | 8 +++++++- dev/devicelab/bin/tasks/module_test_ios.dart | 16 ++++++++++++++-- .../bin/tasks/platform_view_ios__start_up.dart | 8 +++++++- dev/devicelab/bin/tasks/plugin_lint_mac.dart | 6 ++++++ .../flutter_tools/lib/src/macos/cocoapods.dart | 8 +++++++- .../test/general.shard/macos/cocoapods_test.dart | 14 ++++++++++---- 7 files changed, 54 insertions(+), 9 deletions(-) diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 2c4f99afa5..a2b9bf1f6e 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -333,6 +333,9 @@ Future _flutterBuildIpa(String relativePathToApplication) async { await runCommand('pod', ['install'], workingDirectory: podfile.parent.path, + environment: { + 'LANG': 'en_US.UTF-8', + }, ); } await runCommand(flutter, diff --git a/dev/devicelab/bin/tasks/flutter_view_ios__start_up.dart b/dev/devicelab/bin/tasks/flutter_view_ios__start_up.dart index af925dbe77..21ec1e44b1 100644 --- a/dev/devicelab/bin/tasks/flutter_view_ios__start_up.dart +++ b/dev/devicelab/bin/tasks/flutter_view_ios__start_up.dart @@ -17,7 +17,13 @@ Future main() async { '${flutterDirectory.path}/examples/flutter_view/ios', ); await inDirectory(iosDirectory, () async { - await exec('pod', ['install']); + await exec( + 'pod', + ['install'], + environment: { + 'LANG': 'en_US.UTF-8', + }, + ); }); final TaskFunction taskFunction = createFlutterViewStartupTest(); diff --git a/dev/devicelab/bin/tasks/module_test_ios.dart b/dev/devicelab/bin/tasks/module_test_ios.dart index 5435f314e9..745614948a 100644 --- a/dev/devicelab/bin/tasks/module_test_ios.dart +++ b/dev/devicelab/bin/tasks/module_test_ios.dart @@ -242,7 +242,13 @@ Future main() async { final File objectiveCAnalyticsOutputFile = File(path.join(tempDir.path, 'analytics-objc.log')); final Directory objectiveCBuildDirectory = Directory(path.join(tempDir.path, 'build-objc')); await inDirectory(objectiveCHostApp, () async { - await exec('pod', ['install']); + await exec( + 'pod', + ['install'], + environment: { + 'LANG': 'en_US.UTF-8', + }, + ); await exec( 'xcodebuild', [ @@ -325,7 +331,13 @@ Future main() async { final Directory swiftBuildDirectory = Directory(path.join(tempDir.path, 'build-swift')); await inDirectory(swiftHostApp, () async { - await exec('pod', ['install']); + await exec( + 'pod', + ['install'], + environment: { + 'LANG': 'en_US.UTF-8', + }, + ); await exec( 'xcodebuild', [ diff --git a/dev/devicelab/bin/tasks/platform_view_ios__start_up.dart b/dev/devicelab/bin/tasks/platform_view_ios__start_up.dart index 77b7fae71f..f60e2d874f 100644 --- a/dev/devicelab/bin/tasks/platform_view_ios__start_up.dart +++ b/dev/devicelab/bin/tasks/platform_view_ios__start_up.dart @@ -24,7 +24,13 @@ Future main() async { '$platformViewDirectoryPath/ios', ); await inDirectory(iosDirectory, () async { - await exec('pod', ['install']); + await exec( + 'pod', + ['install'], + environment: { + 'LANG': 'en_US.UTF-8', + }, + ); }); final TaskFunction taskFunction = createPlatformViewStartupTest(); diff --git a/dev/devicelab/bin/tasks/plugin_lint_mac.dart b/dev/devicelab/bin/tasks/plugin_lint_mac.dart index 4f0420f9bc..dbb428c486 100644 --- a/dev/devicelab/bin/tasks/plugin_lint_mac.dart +++ b/dev/devicelab/bin/tasks/plugin_lint_mac.dart @@ -45,6 +45,9 @@ Future main() async { objcPodspecPath, '--allow-warnings', ], + environment: { + 'LANG': 'en_US.UTF-8', + }, ); }); @@ -60,6 +63,9 @@ Future main() async { '--allow-warnings', '--use-libraries', ], + environment: { + 'LANG': 'en_US.UTF-8', + }, ); }); diff --git a/packages/flutter_tools/lib/src/macos/cocoapods.dart b/packages/flutter_tools/lib/src/macos/cocoapods.dart index 3bfd940d1a..8fb1dd617e 100644 --- a/packages/flutter_tools/lib/src/macos/cocoapods.dart +++ b/packages/flutter_tools/lib/src/macos/cocoapods.dart @@ -77,7 +77,12 @@ class CocoaPods { processUtils.exitsHappy(['which', 'pod']); Future get cocoaPodsVersionText { - _versionText ??= processUtils.run(['pod', '--version']).then((RunResult result) { + _versionText ??= processUtils.run( + ['pod', '--version'], + environment: { + 'LANG': 'en_US.UTF-8', + }, + ).then((RunResult result) { return result.exitCode == 0 ? result.stdout.trim() : null; }, onError: (dynamic _) => null); return _versionText; @@ -305,6 +310,7 @@ class CocoaPods { // See https://github.com/flutter/flutter/issues/10873. // CocoaPods analytics adds a lot of latency. 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, ); status.stop(); diff --git a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart index 44ee1b5366..19ae134f7f 100644 --- a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart @@ -80,12 +80,12 @@ void main() { when(mockProcessManager.run( ['pod', 'install', '--verbose'], workingDirectory: 'project/ios', - environment: {'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'}, + environment: {'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'}, )).thenAnswer((_) async => exitsHappy()); when(mockProcessManager.run( ['pod', 'install', '--verbose'], workingDirectory: 'project/macos', - environment: {'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'}, + environment: {'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'}, )).thenAnswer((_) async => exitsHappy()); }); @@ -368,6 +368,7 @@ void main() { environment: { 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, )).thenAnswer((_) async => exitsWithError( ''' @@ -420,7 +421,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by verify(mockProcessManager.run( ['pod', 'install', '--verbose'], workingDirectory: 'project/ios', - environment: {'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'}, + environment: {'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'}, )); }, overrides: { FileSystem: () => fs, @@ -447,6 +448,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by environment: { 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, )); }, overrides: { @@ -477,6 +479,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by environment: { 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, )); }, overrides: { @@ -507,6 +510,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by environment: { 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, )); }, overrides: { @@ -539,6 +543,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by environment: { 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, )); }, overrides: { @@ -591,6 +596,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by environment: { 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', + 'LANG': 'en_US.UTF-8', }, )).thenAnswer( (_) async => exitsWithError() @@ -621,6 +627,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by 'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'CP_REPOS_DIR': cocoapodsRepoDir, + 'LANG': 'en_US.UTF8', }; }); @@ -629,7 +636,6 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by fs.file(fs.path.join('project', 'ios', 'Podfile')) ..createSync() ..writeAsStringSync('Existing Podfile'); - when(mockProcessManager.run( ['pod', 'install', '--verbose'], workingDirectory: 'project/ios',