##// END OF EJS Templates
packaging: add support for PyOxidizer...
packaging: add support for PyOxidizer I've successfully built Mercurial on the development tip of PyOxidizer on Linux and Windows. It mostly "just works" on Linux. Windows is a bit more finicky. In-memory resource files are probably not all working correctly due to bugs in PyOxidizer's naming of modules. PyOxidizer now now supports installing files next to the produced binary. (We do this for templates in the added file.) So a workaround should be available. Also, since the last time I submitted support for PyOxidizer, PyOxidizer gained the ability to auto-generate Rust projects to build executables. So we don't need to worry about vendoring any Rust code to initially support PyOxidizer. However, at some point we will likely want to write our own command line driver that embeds a Python interpreter via PyOxidizer so we can run Rust code outside the confines of a Python interpreter. But that will be a follow-up. I would also like to add packaging.py CLI commands to build PyOxidizer distributions. This can come later, if ever. PyOxidizer's new "targets" feature makes it really easy to define packaging tasks in its Starlark configuration file. While not much is implemented yet, eventually we should be able to produce MSIs, etc using a `pyoxidizer build` one-liner. We'll get there... Differential Revision: https://phab.mercurial-scm.org/D7450

File last commit:

r44574:e1b8b4e4 default
r44697:281b6690 default
Show More
README.rst
52 lines | 1.7 KiB | text/x-rst | RstLexer
Gregory Szorc
rust: implementation of `hg`...
r35587 ===================
Mercurial Rust Code
===================
This directory contains various Rust code for the Mercurial project.
Valentin Gatien-Baron
rust: add a README...
r44574 Rust is not required to use (or build) Mercurial, but using it
improves performance in some areas.
Gregory Szorc
rust: implementation of `hg`...
r35587
Valentin Gatien-Baron
rust: add a README...
r44574 There are currently three independent rust projects:
- chg. An implementation of chg, in rust instead of C.
- hgcli. A experiment for starting hg in rust rather than in python,
by linking with the python runtime. Probably meant to be replaced by
PyOxidizer at some point.
- hg-core (and hg-cpython/hg-directffi): implementation of some
functionality of mercurial in rust, e.g. ancestry computations in
revision graphs or pull discovery. The top-level ``Cargo.toml`` file
defines a workspace containing these crates.
Using hg-core
=============
Gregory Szorc
rust: implementation of `hg`...
r35587
Valentin Gatien-Baron
rust: add a README...
r44574 Local use (you need to clean previous build artifacts if you have
built without rust previously)::
Gregory Szorc
rust: implementation of `hg`...
r35587
Valentin Gatien-Baron
rust: add a README...
r44574 $ HGWITHRUSTEXT=cpython make local # to use ./hg
$ HGWITHRUSTEXT=cpython make tests # to run all tests
$ (cd tests; HGWITHRUSTEXT=cpython ./run-tests.py) # only the .t
$ ./hg debuginstall | grep rust # to validate rust is in use
checking module policy (rust+c-allow)
Gregory Szorc
rust: implementation of `hg`...
r35587
Valentin Gatien-Baron
rust: add a README...
r44574 Setting ``HGWITHRUSTEXT`` to other values like ``true`` is deprecated
and enables only a fraction of the rust code.
Gregory Szorc
rust: implementation of `hg`...
r35587
Valentin Gatien-Baron
rust: add a README...
r44574 Developing hg-core
==================
Simply run::
Gregory Szorc
rust: implementation of `hg`...
r35587
$ cargo build --release
Valentin Gatien-Baron
rust: add a README...
r44574
It is possible to build without ``--release``, but it is not
recommended if performance is of any interest: there can be an order
of magnitude of degradation when removing ``--release``.
For faster builds, you may want to skip code generation::
$ cargo check
You can run only the rust-specific tests (as opposed to tests of
mercurial as a whole) with::
$ cargo test --all