From 54a19a0e8de442af1cfbcdccfefafe682005f52d Mon Sep 17 00:00:00 2001 From: Bart <11445373+bthomee@users.noreply.github.com> Date: Fri, 7 Nov 2025 11:02:05 +0000 Subject: [PATCH] refactor: Rename `rippled` binary to `xrpld` --- .github/scripts/rename/README.md | 4 ++ .github/scripts/rename/binary.sh | 42 +++++++++++++++++++ .github/workflows/reusable-build.yml | 8 ++-- .../workflows/reusable-check-levelization.yml | 2 +- .github/workflows/reusable-check-rename.yml | 2 + .github/workflows/reusable-test.yml | 16 +++---- cmake/XrplCore.cmake | 2 - 7 files changed, 61 insertions(+), 15 deletions(-) create mode 100755 .github/scripts/rename/binary.sh diff --git a/.github/scripts/rename/README.md b/.github/scripts/rename/README.md index 7df661609b..f16ea3fccb 100644 --- a/.github/scripts/rename/README.md +++ b/.github/scripts/rename/README.md @@ -26,6 +26,9 @@ run from the repository root. references to `ripple` and `rippled` (with or without capital letters) to `xrpl` and `xrpld`, respectively. The name of the binary will remain as-is, and will only be renamed to `xrpld` by a later script. +4. `.github/scripts/rename/binary.sh`: This script will rename the binary from + `rippled` to `xrpld`, and create a symlink named `rippled` that points to the + `xrpld` binary. You can run all these scripts from the repository root as follows: @@ -33,4 +36,5 @@ You can run all these scripts from the repository root as follows: ./.github/scripts/rename/definitions.sh . ./.github/scripts/rename/copyright.sh . ./.github/scripts/rename/cmake.sh . +./.github/scripts/rename/binary.sh . ``` diff --git a/.github/scripts/rename/binary.sh b/.github/scripts/rename/binary.sh new file mode 100755 index 0000000000..3152f4abc6 --- /dev/null +++ b/.github/scripts/rename/binary.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Exit the script as soon as an error occurs. +set -e + +# On MacOS, ensure that GNU sed is installed and available as `gsed`. +SED_COMMAND=sed +if [[ "${OSTYPE}" == 'darwin'* ]]; then + if ! command -v gsed &> /dev/null; then + echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'." + exit 1 + fi + SED_COMMAND=gsed +fi + +# This script changes the binary name from `rippled` to `xrpld`, and reverse the +# symlink that currently points from `xrpld` to `rippled` so that it points from +# `rippled` to `xrpld` instead. +# Usage: .github/scripts/rename/binary.sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIRECTORY=$1 +echo "Processing directory: ${DIRECTORY}" +if [ ! -d "${DIRECTORY}" ]; then + echo "Error: Directory '${DIRECTORY}' does not exist." + exit 1 +fi +pushd ${DIRECTORY} + +# Remove the binary name override added by the cmake.sh script. +${SED_COMMAND} -z -i -E 's@\s+# For the time being.+"rippled"\)@@' cmake/XrplCore.cmake + +# Reverse the symlink. +${SED_COMMAND} -i -E 's@create_symbolic_link\(rippled@create_symbolic_link(xrpld@' cmake/XrplInstall.cmake +${SED_COMMAND} -i -E 's@/xrpld\$\{suffix\}@/rippled${suffix}@' cmake/XrplInstall.cmake + +popd +echo "Processing complete." diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index a9d5fd7f7c..6ddeeff35a 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -1,4 +1,4 @@ -name: Build rippled +name: Build xrpld on: workflow_call: @@ -126,17 +126,17 @@ jobs: run: | mkdir -p ./binaries/doctest/ - cp ./${BUILD_TYPE_DIR}/rippled* ./binaries/ + cp ./${BUILD_TYPE_DIR}/xrpld* ./binaries/ if [ "${CMAKE_TARGET}" != 'coverage' ]; then cp ./src/tests/libxrpl/${BUILD_TYPE_DIR}/xrpl.test.* ./binaries/doctest/ fi - - name: Upload rippled artifact + - name: Upload xrpld artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 env: BUILD_DIR: ${{ inputs.build_dir }} with: - name: rippled-${{ inputs.config_name }} + name: xrpld-${{ inputs.config_name }} path: ${{ env.BUILD_DIR }}/binaries/ retention-days: 3 if-no-files-found: error diff --git a/.github/workflows/reusable-check-levelization.yml b/.github/workflows/reusable-check-levelization.yml index 3430ca28a2..29a1dc1480 100644 --- a/.github/workflows/reusable-check-levelization.yml +++ b/.github/workflows/reusable-check-levelization.yml @@ -25,7 +25,7 @@ jobs: env: MESSAGE: | - The dependency relationships between the modules in rippled have + The dependency relationships between the modules in xrpld have changed, which may be an improvement or a regression. A rule of thumb is that if your changes caused something to be diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml index 0e42dc55ab..00ef7c6f14 100644 --- a/.github/workflows/reusable-check-rename.yml +++ b/.github/workflows/reusable-check-rename.yml @@ -25,6 +25,8 @@ jobs: run: .github/scripts/rename/copyright.sh . - name: Check CMake configs run: .github/scripts/rename/cmake.sh . + - name: Check binary name + run: .github/scripts/rename/binary.sh . - name: Check for differences env: MESSAGE: | diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml index 8d4a4a8d33..1a47fab181 100644 --- a/.github/workflows/reusable-test.yml +++ b/.github/workflows/reusable-test.yml @@ -1,4 +1,4 @@ -name: Test rippled +name: Test xrpld on: workflow_call: @@ -48,23 +48,23 @@ jobs: with: subtract: ${{ inputs.nproc_subtract }} - - name: Download rippled artifact + - name: Download xrpld artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: - name: rippled-${{ inputs.config_name }} + name: xrpld-${{ inputs.config_name }} - name: Make binary executable (Linux and macOS) shell: bash if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} run: | - chmod +x ./rippled + chmod +x ./xrpld - name: Check linking (Linux) if: ${{ runner.os == 'Linux' }} shell: bash run: | - ldd ./rippled - if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then + ldd ./xrpld + if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then echo 'The binary is statically linked.' else echo 'The binary is dynamically linked.' @@ -75,7 +75,7 @@ jobs: if: ${{ inputs.verify_voidstar }} shell: bash run: | - ./rippled --version | grep libvoidstar + ./xrpld --version | grep libvoidstar - name: Run the embedded tests if: ${{ inputs.run_tests }} @@ -83,7 +83,7 @@ jobs: env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} run: | - ./rippled --unittest --unittest-jobs ${BUILD_NPROC} + ./xrpld --unittest --unittest-jobs ${BUILD_NPROC} - name: Run the separate tests if: ${{ inputs.run_tests }} diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 164fc8523f..73b3ca244f 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -226,6 +226,4 @@ if(xrpld) src/test/ledger/Invariants_test.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE) endif() - # For the time being, we will keep the name of the binary as it was. - set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled") endif()