Show More
@@ -1,78 +1,19 b'' | |||||
1 | =================== |
|
1 | =================== | |
2 | Mercurial Rust Code |
|
2 | Mercurial Rust Code | |
3 | =================== |
|
3 | =================== | |
4 |
|
4 | |||
5 | This directory contains various Rust code for the Mercurial project. |
|
5 | This directory contains various Rust code for the Mercurial project. | |
6 |
|
6 | |||
7 | The top-level ``Cargo.toml`` file defines a workspace containing |
|
7 | The top-level ``Cargo.toml`` file defines a workspace containing | |
8 | all primary Mercurial crates. |
|
8 | all primary Mercurial crates. | |
9 |
|
9 | |||
10 | Building |
|
10 | Building | |
11 | ======== |
|
11 | ======== | |
12 |
|
12 | |||
13 | To build the Rust components:: |
|
13 | To build the Rust components:: | |
14 |
|
14 | |||
15 | $ cargo build |
|
15 | $ cargo build | |
16 |
|
16 | |||
17 | If you prefer a non-debug / release configuration:: |
|
17 | If you prefer a non-debug / release configuration:: | |
18 |
|
18 | |||
19 | $ cargo build --release |
|
19 | $ cargo build --release | |
20 |
|
||||
21 | Features |
|
|||
22 | -------- |
|
|||
23 |
|
||||
24 | The following Cargo features are available: |
|
|||
25 |
|
||||
26 | localdev (default) |
|
|||
27 | Produce files that work with an in-source-tree build. |
|
|||
28 |
|
||||
29 | In this mode, the build finds and uses a ``python2.7`` binary from |
|
|||
30 | ``PATH``. The ``hg`` binary assumes it runs from ``rust/target/<target>hg`` |
|
|||
31 | and it finds Mercurial files at ``dirname($0)/../../../``. |
|
|||
32 |
|
||||
33 | Build Mechanism |
|
|||
34 | --------------- |
|
|||
35 |
|
||||
36 | The produced ``hg`` binary is *bound* to a CPython installation. The |
|
|||
37 | binary links against and loads a CPython library that is discovered |
|
|||
38 | at build time (by a ``build.rs`` Cargo build script). The Python |
|
|||
39 | standard library defined by this CPython installation is also used. |
|
|||
40 |
|
||||
41 | Finding the appropriate CPython installation to use is done by |
|
|||
42 | the ``python27-sys`` crate's ``build.rs``. Its search order is:: |
|
|||
43 |
|
||||
44 | 1. ``PYTHON_SYS_EXECUTABLE`` environment variable. |
|
|||
45 | 2. ``python`` executable on ``PATH`` |
|
|||
46 | 3. ``python2`` executable on ``PATH`` |
|
|||
47 | 4. ``python2.7`` executable on ``PATH`` |
|
|||
48 |
|
||||
49 | Additional verification of the found Python will be performed by our |
|
|||
50 | ``build.rs`` to ensure it meets Mercurial's requirements. |
|
|||
51 |
|
||||
52 | Details about the build-time configured Python are built into the |
|
|||
53 | produced ``hg`` binary. This means that a built ``hg`` binary is only |
|
|||
54 | suitable for a specific, well-defined role. These roles are controlled |
|
|||
55 | by Cargo features (see above). |
|
|||
56 |
|
||||
57 | Running |
|
|||
58 | ======= |
|
|||
59 |
|
||||
60 | The ``hgcli`` crate produces an ``hg`` binary. You can run this binary |
|
|||
61 | via ``cargo run``:: |
|
|||
62 |
|
||||
63 | $ cargo run --manifest-path hgcli/Cargo.toml |
|
|||
64 |
|
||||
65 | Or directly:: |
|
|||
66 |
|
||||
67 | $ target/debug/hg |
|
|||
68 | $ target/release/hg |
|
|||
69 |
|
||||
70 | You can also run the test harness with this binary:: |
|
|||
71 |
|
||||
72 | $ ./run-tests.py --with-hg ../rust/target/debug/hg |
|
|||
73 |
|
||||
74 | .. note:: |
|
|||
75 |
|
||||
76 | Integration with the test harness is still preliminary. Remember to |
|
|||
77 | ``cargo build`` after changes because the test harness doesn't yet |
|
|||
78 | automatically build Rust code. |
|
@@ -1,78 +1,58 b'' | |||||
1 | =================== |
|
|||
2 | Mercurial Rust Code |
|
|||
3 | =================== |
|
|||
4 |
|
||||
5 | This directory contains various Rust code for the Mercurial project. |
|
|||
6 |
|
||||
7 | The top-level ``Cargo.toml`` file defines a workspace containing |
|
|||
8 | all primary Mercurial crates. |
|
|||
9 |
|
||||
10 | Building |
|
|||
11 | ======== |
|
|||
12 |
|
||||
13 | To build the Rust components:: |
|
|||
14 |
|
||||
15 | $ cargo build |
|
|||
16 |
|
||||
17 | If you prefer a non-debug / release configuration:: |
|
|||
18 |
|
||||
19 | $ cargo build --release |
|
|||
20 |
|
||||
21 |
|
|
1 | Features | |
22 | -------- |
|
2 | -------- | |
23 |
|
3 | |||
24 | The following Cargo features are available: |
|
4 | The following Cargo features are available: | |
25 |
|
5 | |||
26 | localdev (default) |
|
6 | localdev (default) | |
27 | Produce files that work with an in-source-tree build. |
|
7 | Produce files that work with an in-source-tree build. | |
28 |
|
8 | |||
29 | In this mode, the build finds and uses a ``python2.7`` binary from |
|
9 | In this mode, the build finds and uses a ``python2.7`` binary from | |
30 | ``PATH``. The ``hg`` binary assumes it runs from ``rust/target/<target>hg`` |
|
10 | ``PATH``. The ``hg`` binary assumes it runs from ``rust/target/<target>hg`` | |
31 | and it finds Mercurial files at ``dirname($0)/../../../``. |
|
11 | and it finds Mercurial files at ``dirname($0)/../../../``. | |
32 |
|
12 | |||
33 | Build Mechanism |
|
13 | Build Mechanism | |
34 | --------------- |
|
14 | --------------- | |
35 |
|
15 | |||
36 | The produced ``hg`` binary is *bound* to a CPython installation. The |
|
16 | The produced ``hg`` binary is *bound* to a CPython installation. The | |
37 | binary links against and loads a CPython library that is discovered |
|
17 | binary links against and loads a CPython library that is discovered | |
38 | at build time (by a ``build.rs`` Cargo build script). The Python |
|
18 | at build time (by a ``build.rs`` Cargo build script). The Python | |
39 | standard library defined by this CPython installation is also used. |
|
19 | standard library defined by this CPython installation is also used. | |
40 |
|
20 | |||
41 | Finding the appropriate CPython installation to use is done by |
|
21 | Finding the appropriate CPython installation to use is done by | |
42 | the ``python27-sys`` crate's ``build.rs``. Its search order is:: |
|
22 | the ``python27-sys`` crate's ``build.rs``. Its search order is:: | |
43 |
|
23 | |||
44 | 1. ``PYTHON_SYS_EXECUTABLE`` environment variable. |
|
24 | 1. ``PYTHON_SYS_EXECUTABLE`` environment variable. | |
45 | 2. ``python`` executable on ``PATH`` |
|
25 | 2. ``python`` executable on ``PATH`` | |
46 | 3. ``python2`` executable on ``PATH`` |
|
26 | 3. ``python2`` executable on ``PATH`` | |
47 | 4. ``python2.7`` executable on ``PATH`` |
|
27 | 4. ``python2.7`` executable on ``PATH`` | |
48 |
|
28 | |||
49 | Additional verification of the found Python will be performed by our |
|
29 | Additional verification of the found Python will be performed by our | |
50 | ``build.rs`` to ensure it meets Mercurial's requirements. |
|
30 | ``build.rs`` to ensure it meets Mercurial's requirements. | |
51 |
|
31 | |||
52 | Details about the build-time configured Python are built into the |
|
32 | Details about the build-time configured Python are built into the | |
53 | produced ``hg`` binary. This means that a built ``hg`` binary is only |
|
33 | produced ``hg`` binary. This means that a built ``hg`` binary is only | |
54 | suitable for a specific, well-defined role. These roles are controlled |
|
34 | suitable for a specific, well-defined role. These roles are controlled | |
55 | by Cargo features (see above). |
|
35 | by Cargo features (see above). | |
56 |
|
36 | |||
57 | Running |
|
37 | Running | |
58 | ======= |
|
38 | ======= | |
59 |
|
39 | |||
60 | The ``hgcli`` crate produces an ``hg`` binary. You can run this binary |
|
40 | The ``hgcli`` crate produces an ``hg`` binary. You can run this binary | |
61 | via ``cargo run``:: |
|
41 | via ``cargo run``:: | |
62 |
|
42 | |||
63 | $ cargo run --manifest-path hgcli/Cargo.toml |
|
43 | $ cargo run --manifest-path hgcli/Cargo.toml | |
64 |
|
44 | |||
65 | Or directly:: |
|
45 | Or directly:: | |
66 |
|
46 | |||
67 | $ target/debug/hg |
|
47 | $ target/debug/hg | |
68 | $ target/release/hg |
|
48 | $ target/release/hg | |
69 |
|
49 | |||
70 | You can also run the test harness with this binary:: |
|
50 | You can also run the test harness with this binary:: | |
71 |
|
51 | |||
72 | $ ./run-tests.py --with-hg ../rust/target/debug/hg |
|
52 | $ ./run-tests.py --with-hg ../rust/target/debug/hg | |
73 |
|
53 | |||
74 | .. note:: |
|
54 | .. note:: | |
75 |
|
55 | |||
76 | Integration with the test harness is still preliminary. Remember to |
|
56 | Integration with the test harness is still preliminary. Remember to | |
77 | ``cargo build`` after changes because the test harness doesn't yet |
|
57 | ``cargo build`` after changes because the test harness doesn't yet | |
78 | automatically build Rust code. |
|
58 | automatically build Rust code. |
General Comments 0
You need to be logged in to leave comments.
Login now