-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
This tracker is for issues related to:
- Common Front End (CFE) and kernel
description
The flutter tool does the following invocation to compile the AOT app.dill:
/Users/aaclarke/dev/flutter/bin/cache/dart-sdk/bin/dart
--disable-dart-dev
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot
--sdk-root /Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/
--target=flutter
--no-print-incremental-dependencies
-DFLUTTER_WEB_AUTO_DETECT=true
-Ddart.vm.profile=false
-Ddart.vm.product=true
--aot
--tfa
--packages /Users/aaclarke/dev/flutter-examples/foo/.dart_tool/package_config.json
--output-dill /Users/aaclarke/dev/flutter-examples/foo/.dart_tool/flutter_build/e8a7daa1dfd64733ed9757f1817652a6/app.dill
--depfile /Users/aaclarke/dev/flutter-examples/foo/.dart_tool/flutter_build/e8a7daa1dfd64733ed9757f1817652a6/kernel_snapshot.d
package:foo/main.dart
When the Flutter team implemented the Dart plugin registrant the Flutter tool started generating Dart code to be compiled at build time. Flutter developers got the generated code incorporated into the app.dill by replacing the package:foo/main.dart argument with a path to the generated code. This worked, but messes up the behavior of Dart_RootLibrary so that it broke custom entry points (see flutter/flutter#91841).
proposal
Add the ability to specify additional files that will be compiled into the app.dill via a flag. For example:
/Users/aaclarke/dev/flutter/bin/cache/dart-sdk/bin/dart
--output-dill /foo/bar/app.dill
--aot
--depfile foo.d
--include /foo/bar/generated.dart
package:foo/main.dart
generated.dart will live in the package that is being compiled as if it were at lib/generated.dart.
alternatives considered
- Generated the code into the
lib/directory - We don't want to fiddle with users source code, they shouldn't have to see it or maintain it. We want it to be ephemeral and hidden in the build process.
cc @alexmarkov