Skip to content

Reusable CI: Allow specifying targets, defines, link and variant for B2 builds#338

Open
Flamefire wants to merge 2 commits into
masterfrom
set-b2-vars
Open

Reusable CI: Allow specifying targets, defines, link and variant for B2 builds#338
Flamefire wants to merge 2 commits into
masterfrom
set-b2-vars

Conversation

@Flamefire
Copy link
Copy Markdown
Collaborator

Previously it was possible to specify all the B2_* variables, but now we'd always build at least the 4 combinations of static/shared & debug/release

This PR brings that feature back as inputs like b2_variant for B2_VARIANT

Example run: https://github.com/boostorg/boost-ci/actions/runs/25934255926/job/76381752610

+ ./b2 libs/boost-ci/test//test_def toolset=gcc cxxstd=11,17 link=shared,static variant=debug -j5 'define=FOO="Hello world"' define=BAR=2

And Windows:

b2 --abbreviate-paths libs/boost-ci/test//test_def toolset=msvc-14.5 cxxstd=17,latest address-model=64 link=shared,static variant=debug -j5 define=FOO="Hello world" define=BAR=2

This shows correct argument parsing also on Windows. It's just a B2 bug now not allowing this, see https://cpplang.slack.com/archives/C27KZLB0X/p1778846649331049
I don't know why it stops at ...found 1 target... there, but probably due to or related to that.

Flamefire added 2 commits May 15, 2026 12:45
Windows CMD is not powerful enough for the correct translation of quoted
B2 input variables like `B2_DEFINE`
@Flamefire Flamefire requested review from jeking3 and sdarwin May 19, 2026 17:02
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d304e0e) to head (a6168c6).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #338   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           24        24           
  Branches        11        11           
=========================================
  Hits            24        24           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d304e0e...a6168c6. Read the comment docs.

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

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented May 20, 2026

There are a wide variety of CI scripts running.
Drone, appveyor, etc. The CI systems are leveraging boost-ci.
This PR modifies core functionality in enforce.sh and build.bat. Most likely, it is fine, but I don't follow all the details here. If you have a high level of confidence in the changes, then probably it is ok.

@Flamefire
Copy link
Copy Markdown
Collaborator Author

This PR modifies core functionality in enforce.sh and build.bat. Most likely, it is fine, but I don't follow all the details her

Quick summary:

build.bat

  • move cd BOOST_ROOT, setting B2_TARGETS further up -> no change
  • Handle new variable B2_FULL_ARGS if set -> No change unless someone happened to use that somehow

enforce.sh

  • fallback if Python is not found at all instead of hard error
  • Don't set cxxstd if B2_CXXSTD is not set
  • handle B2_TARGET_OS (usually only set in Windows)
  • move B2_DEFINES/B2_INCLUDE handling to get a single B2_ARGS (initial) array
  • handle the clang-win toolset there, similar to what is in build.bat
  • add B2_FLAGS at the very end, not before possible define= & include= entries. (allow overwrites)

So I'm very sure this does not cause any regressions as it is mostly refactoring and making things more consistent & robust.

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.

2 participants