Skip to content

fix: Android release: Flutter args after -- are not consistently forwarded when combined with Shorebird build options on Windows #547

Description

@pedro-felic

I am trying to integrate Shorebird into an existing Flutter Android app build pipeline on Windows.

My existing Flutter build command requires the following Flutter build arguments:

--obfuscate
--split-debug-info=...
--dart-define-from-file=...
--no-tree-shake-icons

The app uses the Flutter rfw package, which dynamically creates IconData, so --no-tree-shake-icons is required. Without it, the Flutter build fails because icon tree-shaking cannot safely process the dynamic icon usage.

I am seeing inconsistent behaviour when combining Shorebird-recognised options with Flutter passthrough arguments after --.

Environment
OS: Windows
Shell: cmd.exe
Shorebird version: Shorebird 1.6.105
Flutter version used by Shorebird: 3.41.8
Command: shorebird release android
Project type: Flutter Android appbundle / Android release build
Commands tested

This command works and successfully passes --no-tree-shake-icons to the underlying Flutter build:

shorebird release android --flutter-version=3.41.8 -- --no-tree-shake-icons

This command also works:

shorebird release android --flutter-version=3.41.8 --obfuscate --dart-define-from-file=../resources/config.env --split-debug-info=C:/xxx/177995769/symbols

However, when I combine both requirements, --no-tree-shake-icons does not appear to be passed to the underlying Flutter build:

shorebird release android --flutter-version=3.41.8 --obfuscate --dart-define-from-file=../resources/config.env --split-debug-info=C:/xxx/177995769/symbols -- --no-tree-shake-icons

I also tried quoting the separator, as I had seen in some examples/issues:

shorebird release android --flutter-version=3.41.8 --obfuscate --dart-define-from-file=../resources/config.env --split-debug-info=C:/xxx/177995769/symbols '--' --no-tree-shake-icons

Same result: the --no-tree-shake-icons option does not seem to reach Flutter when combined with the other options.

Additional strange behaviour

I also noticed that adding --verbose changes argument parsing behaviour.

This works:

shorebird release android --flutter-version=3.41.8 --obfuscate --dart-define-from-file=../resources/config.env --split-debug-info=C:/xxx/177995769/symbols

But this does not:

shorebird release android --verbose --flutter-version=3.41.8 --obfuscate --dart-define-from-file=../resources/config.env --split-debug-info=C:/xxx/177995769/symbols

With --verbose, Shorebird appears to stop recognising/parsing --split-debug-info correctly.

Expected behaviour

I expected all arguments after -- to be forwarded to the underlying flutter build command.

So this command:

shorebird release android --flutter-version=3.41.8 --obfuscate --dart-define-from-file=../resources/config.env --split-debug-info=C:/xxx/177995769/symbols -- --no-tree-shake-icons

should result in Flutter receiving:

--obfuscate
--dart-define-from-file=../resources/config.env
--split-debug-info=C:/Work/PublishOutputFolder/0/177995769/symbols
--no-tree-shake-icons
Actual behaviour

--no-tree-shake-icons is passed correctly when it is the only passthrough argument:

shorebird release android --flutter-version=3.41.8 -- --no-tree-shake-icons

But when combined with Shorebird options such as --obfuscate, --dart-define-from-file, and --split-debug-info, the --no-tree-shake-icons flag is not passed through to Flutter.

What is the correct Shorebird CLI syntax on Windows for this combination?

shorebird release android
--flutter-version=3.41.8
--obfuscate
--dart-define-from-file=../resources/config.env
--split-debug-info=C:/xxx/177995769/symbols
--no-tree-shake-icons

If this is a bug, it seems related to argument parsing/forwarding when Shorebird-recognised options are combined with passthrough Flutter options after --.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions