Repository: flutter
Issue: `--build-name` is ignored on linux
Labels: tool,platform-linux,a: build,has reproducible steps,P2,team-tool,triaged-tool,found in release: 3.22,found in release: 3.24

### Steps to reproduce

The `--build-name` argument of `flutter build` seems to have no effect on linux. When passing e.g., `--build-name=4.5.6`, I expect the generated `version.json` to contain `... "version":"4.5.6" ...`. Instead it contains `"1.0.0"` which is the default value from `pubspec.yaml`. Steps to reproduce:

```bash
flutter create foo --platforms linux
cd foo
flutter build linux --build-name=4.5.6
cat build/linux/x64/release/bundle/data/flutter_assets/version.json
``` 

### Expected results

```json
{"app_name":"foo","version":"4.5.6","build_number":"1","package_name":"foo"}
```

### Actual results

```json
{"app_name":"foo","version":"1.0.0","build_number":"1","package_name":"foo"}
```

### Code sample

<details open><summary>Code sample</summary>

```dart
// This can be reproduced on the initial app generated with flutter create with no further modification
```

</details>

### Logs

<details open><summary>Logs</summary>

```console
> flutter --verbose build linux --build-name=4.5.6

[  +13 ms] executing: uname -m
[  +10 ms] Exit code 0 from: uname -m
[        ] x86_64
[  +41 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +38 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +64 ms] Skipping pub get: version match.
[ +146 ms] Building Linux application...
[   +3 ms] executing: [build/linux/x64/release/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/adam/projects/equalit.ie/sandbox/flutter/foo/linux
[  +32 ms] -- Configuring done (0.0s)
[        ] -- Generating done (0.0s)
[   +7 ms] -- Build files have been written to: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release
[   +7 ms] executing: ninja -C build/linux/x64/release install
[   +5 ms] ninja: Entering directory `build/linux/x64/release'
[+1061 ms] [1/5] Generating /home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/home/adam/projects/equalit.ie/sandbox/flutter/foo/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[   +7 ms] [  +10 ms] executing: uname -m
[        ] [   +9 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [  +33 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +70 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +18 ms] Initializing file store
[        ] [   +8 ms] Done initializing file store
[        ] [  +36 ms] Skipping target: native_assets
[        ] [   +1 ms] Skipping target: gen_localizations
[        ] [   +1 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +188 ms] Skipping target: unpack_linux
[        ] [ +258 ms] Skipping target: kernel_snapshot
[        ] [  +21 ms] Skipping target: aot_elf_release
[        ] [  +20 ms] Skipping target: linux_aot_bundle
[        ] [  +33 ms] Skipping target: release_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +6 ms] Done persisting file store
[        ] [   +4 ms] build succeeded.
[        ] [   +6 ms] "flutter assemble" took 688ms.
[        ] [   +2 ms] Running 0 shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[ +262 ms] [2/5] Building CXX object CMakeFiles/foo.dir/flutter/generated_plugin_registrant.cc.o
[  +34 ms] [3/5] Building CXX object CMakeFiles/foo.dir/my_application.cc.o
[  +25 ms] [4/5] Linking CXX executable intermediates_do_not_run/foo
[        ] [4/5] Install the project...
[   +3 ms] -- Install configuration: "Release"
[   +4 ms] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/foo
[        ] -- Set non-toolchain portion of runtime path of "/home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/foo" to "$ORIGIN/lib"
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/icudtl.dat
[   +1 ms] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/lib/libflutter_linux_gtk.so
[  +15 ms] -- Up-to-date: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/lib
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/fonts
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/fonts/MaterialIcons-Regular.otf
[   +1 ms] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/NOTICES.Z
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/version.json
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/FontManifest.json
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/packages
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/packages/cupertino_icons
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/packages/cupertino_icons/assets
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/shaders
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/shaders/ink_sparkle.frag
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/AssetManifest.bin
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/data/flutter_assets/AssetManifest.json
[        ] -- Installing: /home/adam/projects/equalit.ie/sandbox/flutter/foo/build/linux/x64/release/bundle/lib/libapp.so
[  +12 ms] Building Linux application... (completed in 1,488ms)
[   +3 ms] ✓ Built build/linux/x64/release/bundle/foo
[        ] "flutter linux" took 1,772ms.
[   +2 ms] Running 0 shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 0

```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.3, on Ubuntu 22.04.4 LTS 5.15.0-113-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.
```

</details>