mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
fix(bazel): ensure FTXUI is publicly accessible and add external smoke test (#1157)
- Set `visibility = ["//visibility:public"]` on the top-level `:ftxui` alias
so the library can be consumed from external Bazel workspaces.
- Add `bazel_integration/` minimal external workspace to validate
external usage via Bzlmod.
- Introduce `smoke` target that depends on `@ftxui//:ftxui`.
- Add CI job to build the smoke target using:
--enable_bzlmod
--override_module=ftxui=..
This prevents regressions in visibility or public API changes.
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
1
bazel/test/.bazelrc
Symbolic link
1
bazel/test/.bazelrc
Symbolic link
@@ -0,0 +1 @@
|
||||
../../.bazelrc
|
||||
23
bazel/test/BUILD.bazel
Normal file
23
bazel/test/BUILD.bazel
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
||||
# Use of this source code is governed by the MIT license that can be found in
|
||||
# the LICENSE file.
|
||||
|
||||
# Test using individual submodules
|
||||
cc_binary(
|
||||
name = "smoke",
|
||||
srcs = ["smoke.cpp"],
|
||||
deps = [
|
||||
"@ftxui//:component",
|
||||
"@ftxui//:dom",
|
||||
"@ftxui//:screen",
|
||||
],
|
||||
)
|
||||
|
||||
# Test using the single ftxui target
|
||||
cc_binary(
|
||||
name = "smoke_single_dependency",
|
||||
srcs = ["smoke.cpp"],
|
||||
deps = [
|
||||
"@ftxui",
|
||||
],
|
||||
)
|
||||
9
bazel/test/MODULE.bazel
Normal file
9
bazel/test/MODULE.bazel
Normal file
@@ -0,0 +1,9 @@
|
||||
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
||||
# Use of this source code is governed by the MIT license that can be found in
|
||||
# the LICENSE file.
|
||||
module(
|
||||
name = "ftxui_integration_test",
|
||||
version = "0.0.1",
|
||||
)
|
||||
|
||||
bazel_dep(name = "ftxui", version = "6.1.9")
|
||||
38
bazel/test/README.md
Normal file
38
bazel/test/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# FTXUI Bazel Integration Test
|
||||
|
||||
This directory contains integration tests to verify that FTXUI can be properly consumed as an external dependency using Bazel with Bzlmod.
|
||||
|
||||
## Purpose
|
||||
|
||||
These tests ensure that:
|
||||
- FTXUI's public API is correctly exposed to external projects
|
||||
- Both single-target (`@ftxui//:ftxui`) and submodule-based dependencies work correctly
|
||||
- Headers are properly re-exported and accessible from downstream projects
|
||||
|
||||
## Build Instructions
|
||||
|
||||
To build all targets:
|
||||
|
||||
```bash
|
||||
bazel build //... --enable_bzlmod --override_module=ftxui=../..
|
||||
```
|
||||
|
||||
To build individual targets:
|
||||
|
||||
```bash
|
||||
# Test using individual submodules
|
||||
bazel build //:smoke --enable_bzlmod --override_module=ftxui=../..
|
||||
|
||||
# Test using the single ftxui target
|
||||
bazel build //:smoke_single_dependency --enable_bzlmod --override_module=ftxui=../..
|
||||
```
|
||||
|
||||
## Run the Examples
|
||||
|
||||
```bash
|
||||
# Run the submodules version
|
||||
./bazel-bin/smoke
|
||||
|
||||
# Run the single-target version
|
||||
./bazel-bin/smoke_single_dependency
|
||||
```
|
||||
4
bazel/test/WORKSPACE.bazel
Normal file
4
bazel/test/WORKSPACE.bazel
Normal file
@@ -0,0 +1,4 @@
|
||||
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
||||
# Use of this source code is governed by the MIT license that can be found in
|
||||
# the LICENSE file.
|
||||
workspace(name = "ftxui_smoke_test")
|
||||
16
bazel/test/smoke.cpp
Normal file
16
bazel/test/smoke.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2025 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
#include <ftxui/dom/elements.hpp>
|
||||
#include <ftxui/screen/screen.hpp>
|
||||
#include <ftxui/component/component.hpp>
|
||||
#include <ftxui/component/screen_interactive.hpp>
|
||||
|
||||
int main() {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
auto component = Button("Quit", screen.ExitLoopClosure());
|
||||
screen.Loop(component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user