Skip to content

Bazel: general improvements. #1043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 7, 2025
Merged

Bazel: general improvements. #1043

merged 6 commits into from
May 7, 2025

Conversation

ArthurSonzogni
Copy link
Owner

Bazel: general improvements.

Improve the Bazel build. Attempt to fix previous errors recorded while
trying to publish ftxui in the Bazel Central Registry:

Test against "recent" platforms

Previously, I got the error:

gcc: error: unrecognized command line option '-std-c++20'; did you mean '-std-c++2a'?

This was due to using old distribution like ubuntu 2004. Test against
newer platforms only to avoid GCC version<-9.x.y

Downgrade gtest version.

I suspect this caused the Bazel Central Registry error:

file:///workdir/modules/googletest/1.15.2/MODULE.bazel:68:20: name 'use_repo_rule' is not defined

I hoped using a lower version will fix the issue.

Tag gtest as dev_dependency

Presumably, this should avoid dependants to fetch it?

Enable --features-layering_check

Aka clang -Wprivate-header. Fix the encountered errors.

Use clang in the CI

The CI was defining clang/gcc in the matrix, but was not using it. Fix
the bug.

Improve the Bazel build. Attempt to fix previous errors recorded while
trying to publish ftxui in the Bazel Central Registry:
- bazelbuild/bazel-central-registry#4485
- https://buildkite.com/bazel/bcr-presubmit/builds/13601#01968b61-f5b2-4d16-94d0-c87a03a1a23b

Test against "recent" platforms
-------------------------------

Previously, I got the error:
```
gcc: error: unrecognized command line option '-std-c++20'; did you mean '-std-c++2a'?
```
This was due to using old distribution like ubuntu 2004. Test against
newer platforms only to avoid GCC version<-9.x.y

Downgrade gtest version.
------------------------

I suspect this caused the Bazel Central Registry error:
```
file:///workdir/modules/googletest/1.15.2/MODULE.bazel:68:20: name 'use_repo_rule' is not defined
```
I hoped using a lower version will fix the issue.

Tag gtest as dev_dependency
---------------------------

Presumably, this should avoid dependants to fetch it?

Enable --features-layering_check
--------------------------------

Aka clang `-Wprivate-header`. Fix the encountered errors.

Use clang in the CI
-------------------

The CI was defining clang/gcc in the matrix, but was not using it. Fix
the bug.
@ArthurSonzogni
Copy link
Owner Author

Hello @kcc and @robinlinden,

Would you have any additional comments / suggestion about FTXUI bazel build files? 1

Footnotes

  1. This is my first use of Bazel.

Copy link
Contributor

@robinlinden robinlinden left a comment

Choose a reason for hiding this comment

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

Looks great! Should allow me to drop the layering_check patch I have. :)

# Test deps.
bazel_dep(name = "googletest", version = "1.16.0.bcr.1")
# Test dependencies.
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", dev_dependency = True)
Copy link
Contributor

Choose a reason for hiding this comment

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

There was some discussion in bazelbuild/bazel about test-only deps as dev_dependencies: bazelbuild/bazel#22187
iirc there's some ongoing work on optional dependencies, but I don't think that's in a state where it's usable yet.

@ArthurSonzogni ArthurSonzogni merged commit b307a17 into main May 7, 2025
@ArthurSonzogni ArthurSonzogni deleted the fix-bazel branch May 7, 2025 20:41
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