diff --git a/.github/actions/generate/action.yml b/.github/actions/generate/action.yml index 3c2f91e4..79d3d5e9 100644 --- a/.github/actions/generate/action.yml +++ b/.github/actions/generate/action.yml @@ -49,7 +49,7 @@ runs: - name: Run conan shell: bash env: - BUILD_OPTION: "${{ inputs.conan_cache_hit == 'true' && 'missing' || '' }}" + BUILD_OPTION: "${{ inputs.conan_cache_hit == 'true' && 'missing' || '*' }}" CODE_COVERAGE: "${{ inputs.code_coverage == 'true' && 'True' || 'False' }}" STATIC_OPTION: "${{ inputs.static == 'true' && 'True' || 'False' }}" INTEGRATION_TESTS_OPTION: "${{ inputs.build_integration_tests == 'true' && 'True' || 'False' }}" @@ -59,15 +59,15 @@ runs: conan \ install .. \ -of . \ - -b $BUILD_OPTION \ - -s build_type="${{ inputs.build_type }}" \ - -o clio:static="${STATIC_OPTION}" \ - -o clio:tests=True \ - -o clio:integration_tests="${INTEGRATION_TESTS_OPTION}" \ - -o clio:lint=False \ - -o clio:coverage="${CODE_COVERAGE}" \ - -o clio:time_trace="${TIME_TRACE}" \ - --profile "${{ inputs.conan_profile }}" + -b "$BUILD_OPTION" \ + -s "build_type=${{ inputs.build_type }}" \ + -o "&:static=${STATIC_OPTION}" \ + -o "&:tests=True" \ + -o "&:integration_tests=${INTEGRATION_TESTS_OPTION}" \ + -o "&:lint=False" \ + -o "&:coverage=${CODE_COVERAGE}" \ + -o "&:time_trace=${TIME_TRACE}" \ + --profile:all "${{ inputs.conan_profile }}" - name: Run cmake shell: bash diff --git a/.github/actions/prepare_runner/action.yml b/.github/actions/prepare_runner/action.yml index 5a202483..be00a020 100644 --- a/.github/actions/prepare_runner/action.yml +++ b/.github/actions/prepare_runner/action.yml @@ -18,13 +18,13 @@ runs: ca-certificates \ ccache \ clang-build-analyzer \ - conan@1 \ + conan \ gh \ jq \ llvm@14 \ ninja \ pkg-config - echo "/opt/homebrew/opt/conan@1/bin" >> $GITHUB_PATH + echo "/opt/homebrew/opt/conan@2/bin" >> $GITHUB_PATH - name: Install CMake 3.31.6 on mac if: ${{ runner.os == 'macOS' }} @@ -55,14 +55,14 @@ runs: shell: bash run: | echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV - echo "CONAN_USER_HOME=${{ github.workspace }}" >> $GITHUB_ENV + echo "CONAN_HOME=${{ github.workspace }}/.conan2" >> $GITHUB_ENV - name: Set env variables for Linux if: ${{ runner.os == 'Linux' }} shell: bash run: | echo "CCACHE_DIR=/root/.ccache" >> $GITHUB_ENV - echo "CONAN_USER_HOME=/root/" >> $GITHUB_ENV + echo "CONAN_HOME=/root/.conan2" >> $GITHUB_ENV - name: Set CCACHE_DISABLE=1 if: ${{ inputs.disable_ccache == 'true' }} @@ -74,4 +74,4 @@ runs: shell: bash run: | mkdir -p "$CCACHE_DIR" - mkdir -p "$CONAN_USER_HOME/.conan" + mkdir -p "$CONAN_HOME" diff --git a/.github/actions/restore_cache/action.yml b/.github/actions/restore_cache/action.yml index 6032e7e8..dfcd1500 100644 --- a/.github/actions/restore_cache/action.yml +++ b/.github/actions/restore_cache/action.yml @@ -3,7 +3,7 @@ description: Find and restores conan and ccache cache inputs: conan_dir: - description: Path to .conan directory + description: Path to Conan directory required: true conan_profile: description: Conan profile name @@ -41,8 +41,8 @@ runs: id: conan_hash shell: bash run: | - conan info . -j info.json -o clio:tests=True - packages_info="$(cat info.json | jq '.[] | "\(.display_name): \(.id)"' | grep -v 'clio')" + conan graph info . --format json --out-file info.json -o '&:tests=True' --profile:all ${{ inputs.conan_profile }} + packages_info="$(cat info.json | jq -r '.graph.nodes[]?.ref' | grep -v 'clio')" echo "$packages_info" hash="$(echo "$packages_info" | shasum -a 256 | cut -d ' ' -f 1)" rm info.json @@ -52,7 +52,7 @@ runs: uses: actions/cache/restore@v4 id: conan_cache with: - path: ${{ inputs.conan_dir }}/data + path: ${{ inputs.conan_dir }}/p key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.conan_profile }}-develop-${{ steps.conan_hash.outputs.hash }} - name: Restore ccache cache diff --git a/.github/actions/save_cache/action.yml b/.github/actions/save_cache/action.yml index 51e320ab..9898def5 100644 --- a/.github/actions/save_cache/action.yml +++ b/.github/actions/save_cache/action.yml @@ -42,13 +42,13 @@ runs: if: ${{ inputs.conan_cache_hit != 'true' }} shell: bash run: | - conan remove "*" -s -b -f + conan cache clean --source --build --temp - name: Save conan cache if: ${{ inputs.conan_cache_hit != 'true' }} uses: actions/cache/save@v4 with: - path: ${{ inputs.conan_dir }}/data + path: ${{ inputs.conan_dir }}/p key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.conan_profile }}-develop-${{ inputs.conan_hash }} - name: Save ccache cache diff --git a/.github/actions/setup_conan/action.yml b/.github/actions/setup_conan/action.yml index 47f34a8f..c3417637 100644 --- a/.github/actions/setup_conan/action.yml +++ b/.github/actions/setup_conan/action.yml @@ -12,22 +12,11 @@ runs: - name: Create conan profile on macOS if: ${{ runner.os == 'macOS' }} shell: bash - env: - CONAN_PROFILE: ${{ inputs.conan_profile }} run: | - echo "Creating \"$CONAN_PROFILE\" conan profile" - conan profile new "$CONAN_PROFILE" --detect --force - conan profile update settings.compiler.libcxx=libc++ "$CONAN_PROFILE" - conan profile update settings.compiler.cppstd=20 "$CONAN_PROFILE" - conan profile update env.CXXFLAGS=-DBOOST_ASIO_DISABLE_CONCEPTS "$CONAN_PROFILE" - conan profile update "conf.tools.build:cxxflags+=[\"-DBOOST_ASIO_DISABLE_CONCEPTS\"]" "$CONAN_PROFILE" + conan profile detect --name "${{ inputs.conan_profile }}" --force + sed -i '' 's/compiler.cppstd=[^ ]*/compiler.cppstd=20/' "${{ env.CONAN_HOME }}/profiles/${{ inputs.conan_profile }}" - - name: Add conan-non-prod artifactory + - name: Add artifactory remote shell: bash run: | - if [[ -z "$(conan remote list | grep conan-non-prod)" ]]; then - echo "Adding conan-non-prod" - conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod - else - echo "Conan-non-prod is available" - fi + conan remote add --index 0 --force ripple http://18.143.149.228:8081/artifactory/api/conan/dev diff --git a/.github/workflows/build_impl.yml b/.github/workflows/build_impl.yml index f3471ec7..12493eeb 100644 --- a/.github/workflows/build_impl.yml +++ b/.github/workflows/build_impl.yml @@ -92,7 +92,7 @@ jobs: uses: ./.github/actions/restore_cache id: restore_cache with: - conan_dir: ${{ env.CONAN_USER_HOME }}/.conan + conan_dir: ${{ env.CONAN_HOME }} conan_profile: ${{ inputs.conan_profile }} ccache_dir: ${{ env.CCACHE_DIR }} build_type: ${{ inputs.build_type }} @@ -172,7 +172,7 @@ jobs: if: ${{ !inputs.disable_cache && github.ref == 'refs/heads/develop' }} uses: ./.github/actions/save_cache with: - conan_dir: ${{ env.CONAN_USER_HOME }}/.conan + conan_dir: ${{ env.CONAN_HOME }} conan_hash: ${{ steps.restore_cache.outputs.conan_hash }} conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }} ccache_dir: ${{ env.CCACHE_DIR }} diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 00646dbe..60239f1b 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -49,7 +49,7 @@ jobs: uses: ./.github/actions/restore_cache id: restore_cache with: - conan_dir: ${{ env.CONAN_USER_HOME }}/.conan + conan_dir: ${{ env.CONAN_HOME }} ccache_dir: ${{ env.CCACHE_DIR }} conan_profile: ${{ env.CONAN_PROFILE }} diff --git a/conanfile.py b/conanfile.py index c3fd03bb..5e346baf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -2,10 +2,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -class Clio(ConanFile): +class ClioConan(ConanFile): name = 'clio' license = 'ISC' - author = 'Alex Kremer , John Freeman ' + author = 'Alex Kremer , John Freeman , Ayaz Salikhov ' url = 'https://github.com/xrplf/clio' description = 'Clio RPC server' settings = 'os', 'compiler', 'build_type', 'arch' @@ -28,7 +28,7 @@ class Clio(ConanFile): 'boost/1.83.0', 'cassandra-cpp-driver/2.17.0', 'fmt/10.1.1', - 'protobuf/3.21.9', + 'protobuf/3.21.12', 'grpc/1.50.1', 'openssl/1.1.1v', 'xrpl/2.5.0-rc1', @@ -100,6 +100,10 @@ class Clio(ConanFile): tc.variables['benchmark'] = self.options.benchmark tc.variables['snapshot'] = self.options.snapshot tc.variables['time_trace'] = self.options.time_trace + + if self.settings.compiler == 'clang' and self.settings.compiler.version == 16: + tc.extra_cxxflags = ["-DBOOST_ASIO_DISABLE_CONCEPTS"] + tc.generate() def build(self): diff --git a/docs/build-clio.md b/docs/build-clio.md index 5e725c42..a8c07bfd 100644 --- a/docs/build-clio.md +++ b/docs/build-clio.md @@ -24,36 +24,36 @@ Clio requires `compiler.cppstd=20` in your Conan profile (`~/.conan/profiles/def > [!NOTE] > Although Clio is built using C++23, it's required to set `compiler.cppstd=20` for the time being as some of Clio's dependencies are not yet capable of building under C++23. -**Mac example**: +**Mac apple-clang 16 example**: ```text [settings] -os=Macos -os_build=Macos arch=armv8 -arch_build=armv8 -compiler=apple-clang -compiler.version=15 -compiler.libcxx=libc++ build_type=Release +compiler=apple-clang compiler.cppstd=20 +compiler.libcxx=libc++ +compiler.version=16 +os=Macos + [conf] -tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"] +tools.build:cxxflags+=["-Wno-missing-template-arg-list-after-template-kw"] ``` -**Linux example**: +**Linux gcc-12 example**: ```text [settings] -os=Linux -os_build=Linux arch=x86_64 -arch_build=x86_64 -compiler=gcc -compiler.version=12 -compiler.libcxx=libstdc++11 build_type=Release +compiler=gcc compiler.cppstd=20 +compiler.libcxx=libstdc++11 +compiler.version=12 +os=Linux + +[conf] +tools.build:compiler_executables={'c': '/usr/bin/gcc-12', 'cpp': '/usr/bin/g++-12'} ``` #### Artifactory @@ -61,7 +61,7 @@ compiler.cppstd=20 Make sure artifactory is setup with Conan. ```sh -conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod +conan remote add --index 0 ripple http://18.143.149.228:8081/artifactory/api/conan/dev ``` Now you should be able to download the prebuilt `xrpl` package on some platforms. @@ -81,19 +81,21 @@ Navigate to Clio's root directory and run: ```sh mkdir build && cd build -conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True +conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' # You can also add -GNinja to use Ninja build system instead of Make cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release .. cmake --build . --parallel 8 # or without the number if you feel extra adventurous ``` > [!TIP] -> You can omit the `-o tests=True` if you don't want to build `clio_tests`. +> You can omit the `-o '&:tests=True'` if you don't want to build `clio_tests`. If successful, `conan install` will find the required packages and `cmake` will do the rest. You should see `clio_server` and `clio_tests` in the `build` directory (the current directory). > [!TIP] -> To generate a Code Coverage report, include `-o coverage=True` in the `conan install` command above, along with `-o tests=True` to enable tests. After running the `cmake` commands, execute `make clio_tests-ccov`. The coverage report will be found at `clio_tests-llvm-cov/index.html`. +> To generate a Code Coverage report, include `-o '&:coverage=True'` in the `conan install` command above, along with `-o '&:tests=True'` to enable tests. +> After running the `cmake` commands, execute `make clio_tests-ccov`. +> The coverage report will be found at `clio_tests-llvm-cov/index.html`. @@ -106,11 +108,11 @@ The API documentation for Clio is generated by [Doxygen](https://www.doxygen.nl/ To generate the API docs: -1. First, include `-o docs=True` in the conan install command. For example: +1. First, include `-o '&:docs=True'` in the conan install command. For example: ```sh mkdir build && cd build - conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True -o docs=True + conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:docs=True' ``` 2. Once that has completed successfully, run the `cmake` command and add the `--target docs` option: @@ -134,7 +136,7 @@ It is also possible to build Clio using [Docker](https://www.docker.com/) if you docker run -it ghcr.io/xrplf/clio-ci:latest git clone https://github.com/XRPLF/clio mkdir build && cd build -conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True +conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release .. cmake --build . --parallel 8 # or without the number if you feel extra adventurous ``` @@ -192,10 +194,11 @@ Sometimes, during development, you need to build against a custom version of `li The minimum [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) version required is 19.0. -Clang-tidy can be run by CMake when building the project. To achieve this, you just need to provide the option `-o lint=True` for the `conan install` command: +Clang-tidy can be run by CMake when building the project. +To achieve this, you just need to provide the option `-o '&:lint=True'` for the `conan install` command: ```sh -conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True -o lint=True +conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:lint=True' ``` By default CMake will try to find `clang-tidy` automatically in your system.