Skip to content

[native_assets_cli] HookOutput dependencies should not have to include any Dart files #1256

Closed
@dcharkes

Description

@dcharkes

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:

  1. Manually compiling to kernel first, and having that output a .d file (not preferred, I'd rather not depend on SDK internals.).
  2. Adding a --dependencies=path/to/deps.d to dart. 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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions