DCli Compile
The compile command will compile your DCli script(s) into a native executable and optionally install it into your PATH.
The resulting native application can be copied to any binary compatible OS and run without requiring Dart or DCli to be installed.
Dart compiled applications are also super fast.
Usage: dcli compile [-nc, -i, -o] [<script path.dart>, <script path.dart>,...]
Example:
You may specify one or more scripts and DCli will compile each of them.
If you don't specify any scripts then DCli will compile all scripts in the current directory.
If you use the --install option the compiled exe will be added to your path.
DCli copies the executable into ~/.dcli/bin which is added to your path when you run dcli install.
Compile a package
DCli can also compile a globally activated package.
The compiled package will be automatically copied into the ~/.dcli/bin directory which is on your PATH.
Compiling a globally activated package has a number of uses:
faster startup time
you are able to copy the resulting executable to any binary compatible machine and run it without installing Dart
If you switch Dart versions then the executable will still run even if the package isn't compatible with the installed Dart version. This can be useful if you need to run an old version of dart but want access to the latest version of a Dart CLI package.
When compiling a package DCli will create an executable for each of the scripts listed in the packages pubspec.yaml executables
section.
Ensure that ~/.dcli/bin is on your PATH and is before ~/.pub-cache or the globally activate version will run rather than you compiled version.
Flags:
--noprepare | -nc :
stop DCli from running prepare before doing a compile. Use this option if you know that you script's dependencies haven't changed since the last compile resulting in a faster compile.
--install | -i :
install the compiled script into the ~/.dcli/bin directory which is on your path. -
--overwrite | -o :
if the target script has already been compiled and installed, you must specify the -o flag to allow DCli to overwrite it.
--package | -p
compiles a globally activated package and installs it into the !/.dcli/bin directory.
Last updated