Closed
Description
The compiler should know what Dart source files have been used running a Dart script. So we shouldn't request hook writers to list transitively all Dart files in HookOutput.dependencies
.
Currently the hook is run as dart path/to/some/hook/<hookname>.dart --config=path/to/config.json
.
In order to get a list of all Dart files used, we have multiple options:
- Manually compiling to kernel first, and having that output a
.d
file (not preferred, I'd rather not depend on SDK internals.). - Adding a
--dependencies=path/to/deps.d
todart
.dart --dependencies=path/to/deps.d path/to/some/hook/<hookname>.dart --config=path/to/config.json
. This could be used for other use cases as well. (preferred)
Then we can also get rid of the weird dartBuildFiles
for the CBuilder
:
final cbuilder = CBuilder.library(
sources: [addCUri.toFilePath()],
name: name,
assetName: name,
pic: pic,
dartBuildFiles: ['hook/build.dart'],
);
Thanks @kustermann!