Sponsored Content
Skip to content

[dartdev] dart build cli support a separate aotruntime mode? #63435

Description

@dcharkes

We want to introduce build hooks into dart test -c exe (#63372).

However, if we build it on top of dart build cli, we would use dart compile exe under the hood.

This would lose us native profilers and symbolizers support

  /// Compiles [path] to a native shared library using
  /// `dart compile aot-snapshot`.
  ///
  /// Preferable to `dart compile exe` because embedded snapshots are invisible
  /// to native profilers and symbolizers. This should eventually be replaced
  /// with something that supports build hooks.

https://github.com/dart-lang/test/blob/fe9e65866919d28364f2c1bdd806a0a3d5cb101a/pkgs/test_core/lib/src/runner/vm/platform.dart#L248-L253

So, we should consider adding a "mode" to dart build cli that keeps the aot-snapshot separate from the dartaotruntime and generates a shim executable or shell script that makes the bin/my_app run ../bin_private/dartaotruntime ../bin_private/my_aot_snapshot.

Having such a setup would also help with keeping app-bundles with multiple executables smaller, because we'd only include a dartaotruntime in the bundle once.

(N.b. for dart test -c exe it is unnecessary to copy the dartaotruntime, because we have access to a dart sdk, so we can just use that. However, I'd also like to avoid exposing a new dart build subcommand or new dart build cli flags that are only used in package:test. If package:test works as an external package to the SDK it should only rely on well-tested public Dart CLI features. cc @jakemac53 @bkonyi)

@rmacnak-google If you have any other bright ideas, let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions