This package is intended to be used as a development dependency for users of package:build
who want to run code in the Dart vm with precompiled kernel files. This allows you to share compilation of dependencies between multiple entrypoints, instead of doing a monolithic compile of each entrypoint like the Dart VM would normally do on each run.
Note: If you want to use this package for running tests with pub run build_runner test
you will also need a build_test
dev dependency.
This package creates a .vm.app.dill
file corresponding to each .dart
file that contains a main
function.
These files can be passed directly to the vm, instead of the dart script, and the vm will skip its initial parse and compile step.
You can find the output either by using the -o <dir>
option for build_runner, or by finding it in the generated cache directory, which is located at .dart_tool/build/generated/<your-package>
.
There are no configuration options available at this time.
If you are using a custom build script, you will need to add the following builder applications to what you already have, sometime after the build_modules
builder applications:
apply('build_vm_compilers|entrypoint', [vmKernelEntrypointBuilder], toRoot(), hideOutput: true, // These globs should match your entrypoints only. defaultGenerateFor: const InputSet( include: const ['bin/**', 'tool/**', 'test/**.vm_test.dart'])), ]