Repository: flutter
Issue: [flutter_tools] When running `build ipa`, the step to calculate the app size fails
Labels: platform-ios,tool,a: build,has reproducible steps,P2,team-tool,triaged-tool,found in release: 3.22

### Steps to reproduce

Build as follows.

```sh
flutter build ipa --release --flavor prod --export-options-plist configs/AppStoreExportOptions.plist
--obfuscate --split-debug-info build/app/outputs
```

`AppStoreExportOptions.plist` should be like this, with `destination` set to `upload`.

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>destination</key>
	<string>upload</string>
	<key>manageAppVersionAndBuildNumber</key>
	<false/>
	<key>method</key>
	<string>app-store</string>
	<key>signingStyle</key>
	<string>automatic</string>
	<key>stripSwiftSymbols</key>
	<true/>
	<key>teamID</key>
	<string>4XBP3H82S7</string>
	<key>uploadSymbols</key>
	<true/>
</dict>
</plist>
```


### Actual results

If destination is set to upload, it seems that the `build/ios/ipa/` directory is not being created.
As a result, a PathNotFoundException is being thrown.
https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/commands/build_ios.dart#L528

<img width="1212" alt="スクリーンショット 2024-05-14 10 45 29" src="https://github.com/flutter/flutter/assets/6175794/4899b0b1-c0cc-442e-b309-f546a05d57b5">

Only the step to calculate the app size is failing, so the upload to the App Store is successful.


### Logs

<details open>
<summary>Logs</summary>

```
PathNotFoundException: PathNotFoundException: Directory listing failed, path = '/Users/kingu/Develop/garage/packages/obento/build/ios/ipa/' (OS Error: No such file or directory, errno = 2)
```

```console

#0      _Directory._fillWithDirectoryListing (dart:io-patch/directory_patch.dart:42:24)
#1      _Directory.listSync (dart:io/directory_impl.dart:228:5)
#2      ForwardingDirectory.listSync (package:file/src/forwarding/forwarding_directory.dart:43:12)
#3      ForwardingDirectory.listSync (package:file/src/forwarding/forwarding_directory.dart:43:12)
#4      OperatingSystemUtils.getDirectorySize (package:flutter_tools/src/base/os.dart:111:53)
#5      BuildIOSArchiveCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:528:43)
<asynchronous suspension>
#6      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#9      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#11     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
<asynchronous suspension>
#12     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#14     main (package:flutter_tools/executable.dart:93:3)
<asynchronous suspension>

```

</details>


### Flutter Doctor output

<details open>
<summary>Doctor output</summary>

```console

[✓] Flutter (Channel beta, 3.22.0-0.3.pre, on macOS 14.4.1 23E224 darwin-arm64, locale ja-JP)
    • Flutter version 3.22.0-0.3.pre on channel beta at /Users/kingu/fvm/versions/beta
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 87b652410d (3 weeks ago), 2024-04-23 21:41:18 -0500
    • Engine revision b4bfd45986
    • Dart version 3.4.0 (build 3.4.0-282.3.beta)
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/kingu/Library/Android/sdk
    • Platform android-34-ext8, build-tools 34.0.0
    • ANDROID_HOME = /Users/kingu/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/kingu/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode-15.2.0.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /Users/kingu/Develop/global/dotfiles/google-chrome-unsafe.sh

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.90.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.88.0

[✓] Connected device (9 available)
    • KingPad K10 (mobile)            • VKK104GJP0000443                     • android-arm64  • Android 10 (API 29)
    • sdk gphone64 arm64 (mobile)     • emulator-5554                        • android-arm64  • Android 13 (API 33) (emulator)
    • KiPhone 11 Pro (mobile)         • 00008030-00111C983630802E            • ios            • iOS 17.4.1 21E236
    • KiPhone 14 Pro (mobile)         • 00008120-001159C40CEB401E            • ios            • iOS 17.5 21F79
    • Ks iPad Pro (mobile)            • 00008103-000661393CD9001E            • ios            • iOS 17.5 21F79
    • iPhone 14 Plus (mobile)         • 0B93D85B-74A5-4AD7-836B-C883C8680F60 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 124.0.6367.207

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>