Skip to content

libraries specification supports composition #47998

Closed
@sigmundch

Description

@sigmundch

@johnniwinther and I were discussing this yesterday:

We'd like to support easier composition of declarations in libraries.json files. This will make it easier to share declarations of library UIRs and patch URIs across configurations and across repos and reduce the risk of common configurations going stale accidentally.

As an example, we've recently noticed that the flutter web configuration is missing entries required by dart2js because the entries are simply copied & pasted from a point in time long ago.

We foresee this feature to be used by the flutter target (reusing most settings from the vm target), dart2js and dart2js_server targets (which share some common definitions), and the wasm target (that also reuses bits from the vm target).

So far our inclination is to support cross-file references of this form:

target_name:
   inherit_from:
       uri: ../../libraries.json
       target: boo
   library_name:
        uri: bar.dart

@johnniwinther - dart2js_server and dart2js have a lot in common, but neither is a subset of the other. Because of that, we likely need a mechanism to express only the common pieces. This could be:

  • allow artificial "targets" that are only there to specify commonalities (e.g. dart2js_common)
  • allow hide directives to exclude what you don't need. I worry about show directives because they are not typically future compatible

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions