0

I am currently working on some research on Reproducible Builds and considering the Pub ecosystem.

How does Pub compile/pack packages into to-be distributed binaries?

Oreofe Solarin
  • 286
  • 5
  • 13
  • Essentially what pub does is it downloads the source code for your given dependencies to your [pub cache folder](https://dart.dev/tools/pub/environment-variables) which you can find at `$HOME/.pub-cache` on macos or `%LOCALAPPDATA%\Pub\Cache` for windows. The compiler can then take all the code and compile it to an exe, or compile it to JavaScript, or it can be run on the Dart VM. – mmcdon20 Jul 25 '23 at 22:13
  • @mmcdon20 When a package is to be published, does Pub archive the package into a tarball or something? And then, doing pub get, does it fetch the archive and extract it as a source code? – Oreofe Solarin Jul 26 '23 at 13:47
  • It looks like the `_publish` function calls `createTarGz` (https://github.com/dart-lang/pub/blob/master/lib/src/command/lish.dart#L194C1-L299C4), and the `_download` function calls `extractTarGz` (https://github.com/dart-lang/pub/blob/master/lib/src/source/hosted.dart#L1084C1-L1216C4). So yes, it would seem so. – mmcdon20 Jul 26 '23 at 14:39

0 Answers0