Skip to content

Commit a18b30b

Browse files
authored
docs: Update instructions how to (re)generate conan.lock file (#6070)
This change updates the instructions for how to generate a Conan lockfile that is compatible with Linux, macOS, and Windows. Whenever Conan dependencies change, the Conan lock file needs to be regenerated. However, different OSes have slightly different requirements, and thus require slightly different dependencies. Luckily a single `conan.lock` file can be used, as long as the union of dependencies is included. The current instructions in the `BUILD.md` file are insufficient to regenerate the lock file such that it is compatible with all OSes, which this change addresses. The three profiles contain the bare minimum needed to generate the lockfile; it does not particularly matter whether the build type is Debug or Release, for instance.
1 parent 8564702 commit a18b30b

File tree

5 files changed

+74
-27
lines changed

5 files changed

+74
-27
lines changed

BUILD.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ These instructions assume a basic familiarity with Conan and CMake. If you are
8888
unfamiliar with Conan, then please read [this crash course](./docs/build/conan.md) or the official
8989
[Getting Started][3] walkthrough.
9090

91+
#### Conan lockfile
92+
93+
To achieve reproducible dependencies, we use a [Conan lockfile](https://docs.conan.io/2/tutorial/versioning/lockfiles.html),
94+
which has to be updated every time dependencies change.
95+
96+
Please see the [instructions on how to regenerate the lockfile](conan/lockfile/README.md).
97+
9198
#### Default profile
9299

93100
We recommend that you import the provided `conan/profiles/default` profile:
@@ -450,33 +457,6 @@ tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS']
450457
The location of `rippled` binary in your build directory depends on your
451458
CMake generator. Pass `--help` to see the rest of the command line options.
452459
453-
#### Conan lockfile
454-
455-
To achieve reproducible dependencies, we use [Conan lockfile](https://docs.conan.io/2/tutorial/versioning/lockfiles.html).
456-
457-
The `conan.lock` file in the repository contains a "snapshot" of the current dependencies.
458-
It is implicitly used when running `conan` commands, you don't need to specify it.
459-
460-
You have to update this file every time you add a new dependency or change a revision or version of an existing dependency.
461-
462-
> [!NOTE]
463-
> Conan uses local cache by default when creating a lockfile.
464-
>
465-
> To ensure, that lockfile creation works the same way on all developer machines, you should clear the local cache before creating a new lockfile.
466-
467-
To create a new lockfile, run the following commands in the repository root:
468-
469-
```bash
470-
conan remove '*' --confirm
471-
rm conan.lock
472-
# This ensure that xrplf remote is the first to be consulted
473-
conan remote add --force --index 0 xrplf https://conan.ripplex.io
474-
conan lock create . -o '&:jemalloc=True' -o '&:rocksdb=True'
475-
```
476-
477-
> [!NOTE]
478-
> If some dependencies are exclusive for some OS, you may need to run the last command for them adding `--profile:all <PROFILE>`.
479-
480460
## Coverage report
481461
482462
The coverage report is intended for developers using compilers GCC

conan/lockfile/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Conan lockfile
2+
3+
To achieve reproducible dependencies, we use a [Conan lockfile](https://docs.conan.io/2/tutorial/versioning/lockfiles.html).
4+
5+
The `conan.lock` file in the repository contains a "snapshot" of the current
6+
dependencies. It is implicitly used when running `conan` commands, so you don't
7+
need to specify it.
8+
9+
You have to update this file every time you add a new dependency or change a
10+
revision or version of an existing dependency.
11+
12+
## Updating the lockfile
13+
14+
To update a lockfile, run the following commands from the repository root:
15+
16+
```bash
17+
# Ensure that the xrplf remote is the first to be consulted, so any recipes we
18+
# patched are used. We also add it there to not created huge diff when the
19+
# official Conan Center Index is updated.
20+
conan remote add --force --index 0 xrplf https://conan.ripplex.io
21+
22+
# Remove all local packages to prevent the local cache from influencing the
23+
# lockfile.
24+
conan remove '*' --confirm
25+
26+
# Create a new lockfile that is compatible with Linux, macOS, and Windows. The
27+
# first create command will create a new lockfile, while the subsequent create
28+
# commands will merge any additional dependencies into the created lockfile.
29+
rm conan.lock
30+
conan lock create . \
31+
--options '&:jemalloc=True' \
32+
--options '&:rocksdb=True' \
33+
--profile:all=conan/lockfile/linux.profile
34+
conan lock create . \
35+
--options '&:jemalloc=True' \
36+
--options '&:rocksdb=True' \
37+
--profile:all=conan/lockfile/macos.profile
38+
conan lock create . \
39+
--options '&:jemalloc=True' \
40+
--options '&:rocksdb=True' \
41+
--profile:all=conan/lockfile/windows.profile
42+
```

conan/lockfile/linux.profile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[settings]
2+
arch=x86_64
3+
build_type=Release
4+
compiler=gcc
5+
compiler.cppstd=20
6+
compiler.libcxx=libstdc++11
7+
compiler.version=13
8+
os=Linux

conan/lockfile/macos.profile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[settings]
2+
arch=armv8
3+
build_type=Release
4+
compiler=apple-clang
5+
compiler.cppstd=20
6+
compiler.libcxx=libc++
7+
compiler.version=17.0
8+
os=Macos

conan/lockfile/windows.profile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[settings]
2+
arch=x86_64
3+
build_type=Release
4+
compiler=msvc
5+
compiler.cppstd=20
6+
compiler.runtime=dynamic
7+
compiler.runtime_type=Release
8+
compiler.version=194
9+
os=Windows

0 commit comments

Comments
 (0)