-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Was debugging #160289 with @camsim99 and @jonahwilliams the Flutter historian.
The tl;dr is if you enable flutter config --explicit-package-dependencies, and try using flutter build aar, an error is always thrown:
$ flutter config --explicit-package-dependencies
# Create and navigate to a project that uses `flutter build aar`
# An example is the `build_aar_module_test.dart` in dev/devicelab
$ flutter build aarWith this flag, you will always see the following output:
flutter build aar
Only one of "--debug", "--profile", "--jit-release", or "--release" can be specified.
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.The reason for this error is because we check the build mode as part of --explicit-package-dependencies:
flutter/packages/flutter_tools/lib/src/runner/flutter_command.dart
Lines 1903 to 1906 in 53e7e99
| await project.regeneratePlatformSpecificTooling( | |
| allowedPlugins: allowedPlugins, | |
| releaseMode: featureFlags.isExplicitPackageDependenciesEnabled && getBuildMode().isRelease, | |
| ); |
Unfortunately, flutter build aar (and we suspect, flutter build ios-framework and flutter build macos-framework?) don't work like a typical flutter build, instead of specifying the build mode (or having it inferred based on the context, i.e. run means --debug and build means --release), these commands build all three outputs unless specified otherwise (i.e. flutter build aar --no-profile --no-debug will only build a release mode artifact).
We have a few options for "working around" this:
- Never apply plugin optimizations to these scenarios. That is,
flutter build aar, even the release artifact, includes dev plugins. - Change the behavior of
flutter build aar(and similar commands) to build three outputs in serial instead of re-using the build configurations - Change the behavior of
flutter build aar(and similar commands) to build a single output, with the same semantics asflutter buildnormally.
We could do (1) as a placeholder until it is feasible to write and test (2), but either way we need a resolution ASAP to unblock this set of features.