Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dart pub global activate to use dart build exe #4313

Open
dcharkes opened this issue Jun 20, 2024 · 3 comments
Open

Change dart pub global activate to use dart build exe #4313

dcharkes opened this issue Jun 20, 2024 · 3 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@dcharkes
Copy link
Contributor

We should change dart pub global to use AOT instead of JIT.

Also, we should not let pub need to worry about how dart is compiled and run, dart should be responsible for that.

@jonasfj suggested that dart pub global activate should use dart build exe.

Subsequently, $PUB_CACHE/bin/ could contain symlinks to the executables in $PUB_CACHE/global_packages/<package_name>/outputdir/<package_name>.exe.

This would

  1. remove logic from pub-global about how Dart is compiled,
  2. speedup startup of pub-global activated packages, and
  3. make native assets work ([native_assets] Support dart pub global run sdk#56044).

Since the executables would include a dart precompiled runtime. The Dart version which is running would be the one that was used to run dart pub global activate. If we ever want to re-activate a package with a different Dart SDK version, we might need some way to detect what version of the Dart SDK was used to compile the executable.

@jonasfj and @sigurdm probably know much more constraints and considerations. I'm filing an issue so that we have something to point to.

@sigurdm
Copy link
Contributor

sigurdm commented Jun 20, 2024

One stumbling block is the lack of dart:mirrors support in AOT compilation

@sigurdm sigurdm added the type-enhancement A request for a change that isn't a bug label Jun 27, 2024
@gryznar
Copy link

gryznar commented Sep 19, 2024

+1. One step towards this could be to use existing binary (if it was compiled before manually). It is strange, that Dart uses .snapshot file from .dart-tool instead of executable from bin/, especially since manual edit of .bat script in cache and pointing there to .exe works well. @sigurdm is support for this feature dart:mirror going to be implemented in some subsequent release?

@jonasfj
Copy link
Member

jonasfj commented Sep 24, 2024

I don't think dart:mirrors will be supported in AOT-mode (See dart-lang/sdk#44489).

I think that we should consider overhauling everything to do with global activation. Ideally, it shouldn't have to be a two-step process, but something more akin to npx. But that's just like my opinion (at this point in time; not fully conceived).

But I do think we should consider changing from JIT to AOT along with a minor overhaul of global activation in general. Both things will affect PUB_CACHE and cause pain for people switching between SDK versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants