Sponsored Content
Skip to content

chore: Restore unity builds - #6328

Merged
bthomee merged 7 commits into
developfrom
bthomee/unity
Feb 6, 2026
Merged

chore: Restore unity builds#6328
bthomee merged 7 commits into
developfrom
bthomee/unity

Conversation

@bthomee

@bthomee bthomee commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

High Level Overview of Change

This change restores the ability to do unity builds, while only having a single configuration use it. It also fixes an issue with the coverage target.

Context of Change

In certain cases, such as when modifying headers used by many compilation units, performing a unity build is slower than when performing a regular build with ccache enabled. There is also a benefit to a unity build in that it can detect things such as macro redefinitions within the group of files that are compiled together as a unit. This PR therefore restores the ability to perform unity builds. However, instead of running every configuration with and without unity enabled, it is now only enabled for a single configuration to maintain lower computational use.

As part of restoring the code, it became clear that currently two configurations have coverage enabled, since the check doesn't focus specifically on Debian Bookworm so it also applies to Debian Trixie. This has been fixed too in this PR.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

Copilot AI review requested due to automatic review settings February 4, 2026 18:53
@bthomee
bthomee requested review from a1q123456 and ximinez February 4, 2026 18:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores unity build support to the project while maintaining lower computational overhead by enabling it for only a single CI configuration (Ubuntu Jammy with GCC 12 Debug on linux/amd64). It also fixes a bug where coverage was being enabled for both Debian Bookworm and Debian Trixie instead of just Debian Bookworm.

Changes:

  • Added unity option to Conan and CMake configuration systems
  • Configured specific files and targets to be excluded from unity builds (protobuf generated files, specific test files)
  • Fixed coverage configuration to only apply to Debian Bookworm with GCC 15
  • Updated documentation to describe the unity build option

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/libxrpl/net/RegisterSSLCerts.cpp Updated comment to reflect that unity builds are now being used again
conanfile.py Added unity option with default value of False and passed it to CMake
cmake/XrplSettings.cmake Implemented unity build configuration with conditional batch size setting
cmake/XrplCore.cmake Excluded protobuf library from unity builds and marked specific test files for exclusion
cmake/XrplAddTest.cmake Configured test targets to disable unity builds
BUILD.md Added documentation for the unity build option with explanation of tradeoffs
.github/scripts/strategy-matrix/generate.py Fixed coverage to only apply to Debian Bookworm and added unity build for Ubuntu Jammy configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmake/XrplAddTest.cmake Outdated

isolate_headers(${target} "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/${name}" PRIVATE)

# Make sure the test isn't optimized away in unity builds

Copilot AI Feb 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment "Make sure the test isn't optimized away in unity builds" is misleading. Setting UNITY_BUILD_BATCH_SIZE to 0 effectively disables unity builds for the test target by placing each source file in its own unity group. A more accurate comment would be "Disable unity build for test targets to avoid potential conflicts between test sources" or "Prevent test source files from being combined in unity builds".

Suggested change
# Make sure the test isn't optimized away in unity builds
# Disable unity build for test targets to avoid potential conflicts between test sources

Copilot uses AI. Check for mistakes.
Comment thread cmake/XrplCore.cmake Outdated
@codecov

codecov Bot commented Feb 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.9%. Comparing base (0a626d9) to head (08a7347).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6328     +/-   ##
=========================================
- Coverage     79.9%   79.9%   -0.0%     
=========================================
  Files          840     840             
  Lines        65549   65549             
  Branches      7267    7264      -3     
=========================================
- Hits         52355   52353      -2     
- Misses       13194   13196      +2     
Files with missing lines Coverage Δ
src/libxrpl/net/RegisterSSLCerts.cpp 100.0% <ø> (ø)

... and 2 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@a1q123456

Copy link
Copy Markdown
Contributor

Thank you so much, Bart! This will make rebuilding faster.

Copilot AI review requested due to automatic review settings February 4, 2026 22:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread BUILD.md
Comment thread .github/scripts/strategy-matrix/generate.py Outdated
Comment thread cmake/XrplAddTest.cmake Outdated
Copilot AI review requested due to automatic review settings February 5, 2026 00:09
@bthomee

bthomee commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator Author

@ximinez The unity builds succeeded without the exceptions for the RPC and Invariant test files using configurations on all three platforms. While this is no guarantee it will work for all configurations - we will find out during a nightly run after merging - it is a good indicator that it may be that way.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread BUILD.md
@bthomee
bthomee enabled auto-merge (squash) February 6, 2026 13:37
@bthomee
bthomee merged commit 25d7c2c into develop Feb 6, 2026
1 check passed
@bthomee
bthomee deleted the bthomee/unity branch February 6, 2026 14:12
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
In certain cases, such as when modifying headers used by many compilation units, performing a unity build is slower than when performing a regular build with `ccache` enabled. There is also a benefit to a unity build in that it can detect things such as macro redefinitions within the group of files that are compiled together as a unit. This change therefore restores the ability to perform unity builds. However, instead of running every configuration with and without unity enabled, it is now only enabled for a single configuration to maintain lower computational use.

As part of restoring the code, it became clear that currently two configurations have coverage enabled, since the check doesn't focus specifically on Debian Bookworm so it also applies to Debian Trixie. This has been fixed too in this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants