Skip to content

Commit

Permalink
feat: module (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
0-Sacha authored Oct 27, 2024
1 parent e28d143 commit 4fb7981
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 88 deletions.
20 changes: 13 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@ common --incompatible_strict_action_env
common --toolchain_resolution_debug=all
common --show_timestamps
common --verbose_failures
test --test_output=errors
test --test_output=all

# clang format/tidy
common:clang_tidy --aspects @bazel_utilities//tools/clang_tidy:clang_tidy.bzl%clang_tidy
common:clang_tidy --output_groups=+report
common:clang_tidy --spawn_strategy=local
common:clang_tidy --aspects_parameters=skip_headers=True

#
common:clang_format --aspects @bazel_utilities//tools/clang_format:clang_format.bzl%clang_format
common:clang_format --output_groups=+report
common:clang_format --spawn_strategy=local

#
common:tidy_format_error --aspects_parameters=enable_error=True

# Winlibs
common:winlibs-gcc --extra_toolchains=@winlibs//:gcc-toolchain
common:winlibs-clang --extra_toolchains=@pthread-winlibs//:clang-toolchain

# BuildBuddy
common:linux --workspace_status_command=$(pwd)/.buildbuddy/workspace_status.sh
common:windows --workspace_status_command=.buildbuddy/workspace_status.bat

#
common:buildbuddy --build_metadata=ROLE=CI
common:buildbuddy --bes_results_url=https://sacha.buildbuddy.io/invocation/
common:buildbuddy --bes_backend=grpcs://sacha.buildbuddy.io
Expand All @@ -29,7 +34,8 @@ common:buildbuddy --remote_executor=grpcs://sacha.buildbuddy.io
common:buildbuddy --experimental_remote_cache_compression
common:buildbuddy --jobs=50
common:buildbuddy --nolegacy_important_outputs
common:buildbuddy --platforms=@toolchain_ci_buildbuddy//:buildbuddy_linux_x86_64
common:buildbuddy --extra_execution_platforms=@toolchain_ci_buildbuddy//:buildbuddy_linux_x86_64
common:buildbuddy --remote_instance_name=streamformat
common:buildbuddy --extra_toolchains=@toolchain_ci_buildbuddy//:toolchain_buildbuddy_gcc_12
#
common:buildbuddy --extra_execution_platforms=@buildbuddy//:platform
common:buildbuddy --extra_toolchains=@buildbuddy//:gcc-toolchain
common:buildbuddy --platforms=@buildbuddy//:platform
8 changes: 4 additions & 4 deletions .buildkite/linux_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ agents:
steps:
- label: ":bazel: Build and Test on gcc (W asan)"
commands:
- CC=gcc bazelisk build --features=asan //...
- CC=gcc bazelisk test --features=asan //...
- CC=gcc bazelisk build --features=asan //:StreamFormatTests
- CC=gcc bazelisk test --features=asan //:StreamFormatTests

- label: ":bazel: Build and Test on Clang (W asan)"
commands:
- CC=clang bazelisk build --features=asan //...
- CC=clang bazelisk test --features=asan //...
- CC=clang bazelisk build --features=asan //:StreamFormatTests
- CC=clang bazelisk test --features=asan //:StreamFormatTests
12 changes: 9 additions & 3 deletions .buildkite/windows_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ agents:
queue: "agent-runners-windows-amd64"

steps:
- label: ":bazel: Build"
- label: ":bazel: Build And Test MSVC"
commands:
- bazelisk build //...
- bazelisk test //...
- bazelisk test //:StreamFormatTests

- label: ":bazel: Build And Test Winlibs/clang"
commands:
- bazelisk build --config=winlibs-clang //:StreamFormatTests
- label: ":bazel: Build And Test Winlibs/gcc"
commands:
- bazelisk build --config=winlibs-gcc //:StreamFormatTests
2 changes: 1 addition & 1 deletion .github/workflows/CodeChecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: build & retreive compile_commands.json
run: |
bazelisk clean
bazelisk build //...
bazelisk build //:StreamFormatTests
bazelisk run //conf:compile_commands
- uses: whisperity/[email protected]
Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/StreamFormat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,25 @@ jobs:
path: "~/.cache/bazel"
key: bazel
- name: Building...
run: bazelisk build //...
run: bazelisk build //:StreamFormatTests
- name: Testing...
run: bazelisk test //...
run: bazelisk test //:StreamFormatTests

windows-latest-winlibs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- name: Mount bazel cache
uses: actions/cache@v4
with:
path: "~/.cache/bazel"
key: bazel
- name: Build Winlibs/clang...
run: bazelisk build --config=winlibs-clang //:StreamFormatTests
- name: Build Winlibs/gcc...
run: bazelisk build --config=winlibs-gcc //:StreamFormatTests

ubuntu-latest-gcc:
runs-on: ubuntu-latest
steps:
Expand All @@ -37,9 +52,9 @@ jobs:
- name: Version
run: gcc --version
- name: Building...
run: CC=gcc bazelisk build //...
run: CC=gcc bazelisk build //:StreamFormatTests
- name: Testing... (W asan)
run: CC=gcc bazelisk test --features=asan //...
run: CC=gcc bazelisk test --features=asan //:StreamFormatTests

ubuntu-latest-clang:
runs-on: ubuntu-latest
Expand All @@ -59,6 +74,6 @@ jobs:
- name: Version
run: clang++-17 --version
- name: Building...
run: CC=clang++-17 bazelisk build //...
run: CC=clang++-17 bazelisk build //:StreamFormatTests
- name: Testing... (W asan)
run: CC=clang++-17 bazelisk test --features=asan //...
run: CC=clang++-17 bazelisk test --features=asan //:StreamFormatTests
1 change: 0 additions & 1 deletion BUILD → BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ cc_library(

cc_test(
name = "StreamFormatTests",
includes = [ "src/" ],
srcs = glob([ "Tests/**/*.h", "Tests/**/*.cpp" ]),
copts = select({
"@rules_cc//cc/compiler:msvc-cl": ["/std:c++20"],
Expand Down
4 changes: 4 additions & 0 deletions Examples/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ common --incompatible_strict_action_env
common --show_timestamps
common --verbose_failures
test --test_output=errors

# Winlibs
common:winlibs-gcc --extra_toolchains=@ex_winlibs//:gcc-toolchain
common:winlibs-clang --extra_toolchains=@pthread-ex_winlibs//:clang-toolchain
File renamed without changes.
File renamed without changes.
22 changes: 17 additions & 5 deletions Examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
module(
name = "streamformat_examples",
version = "0.1",
repo_name = "com_sacha_streamformat_examples",
)


git_override(module_name="bazel_utilities", remote="https://github.com/0-Sacha/bazel_utilities.git", commit="7f6c3585c41278918428ed48d45b12413c197fc0")
git_override(module_name="bazel_buildbuddy", remote="https://github.com/0-Sacha/bazel_buildbuddy.git", commit="b60314cac7826edb87efe285b032b877ad725f84")
git_override(module_name="bazel_winlibs", remote="https://github.com/0-Sacha/bazel_winlibs.git", commit="e2cc97b61cb9115fbc2b7169dc9d1cb36b351935")
local_path_override(module_name = "streamformat", path = "../")

bazel_dep(name = "rules_cc", version = "0.0.10")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "bazel_utilities", version = "0.0.1")
bazel_dep(name = "bazel_winlibs", version = "0.0.1")
bazel_dep(name = "streamformat")
local_path_override(
module_name = "streamformat",
path = "../",
)

winlibs_toolchain_extension = use_extension("@bazel_winlibs//:rules.bzl", "winlibs_toolchain_extension")
inject_repo(winlibs_toolchain_extension, "platforms", "bazel_utilities")
winlibs_toolchain_extension.winlibs_toolchain(name = "ex_winlibs")
winlibs_toolchain_extension.winlibs_toolchain(name = "pthread-ex_winlibs", linklibs = [ "pthread" ])
use_repo(winlibs_toolchain_extension, "ex_winlibs")
use_repo(winlibs_toolchain_extension, "pthread-ex_winlibs")
21 changes: 0 additions & 21 deletions Examples/WORKSPACE

This file was deleted.

26 changes: 23 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,35 @@
module(
name = "streamformat",
version = "0.1",
repo_name = "com_sacha_streamformat",
)

# Deps
bazel_dep(name = "rules_cc", version = "0.0.9")
git_override(module_name="bazel_utilities", remote="https://github.com/0-Sacha/bazel_utilities.git", commit="7f6c3585c41278918428ed48d45b12413c197fc0")
git_override(module_name="bazel_buildbuddy", remote="https://github.com/0-Sacha/bazel_buildbuddy.git", commit="b60314cac7826edb87efe285b032b877ad725f84")
git_override(module_name="bazel_winlibs", remote="https://github.com/0-Sacha/bazel_winlibs.git", commit="e2cc97b61cb9115fbc2b7169dc9d1cb36b351935")

bazel_dep(name = "rules_cc", version = "0.0.10")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "bazel_utilities", version = "0.0.1")
bazel_dep(name = "bazel_buildbuddy", version = "0.0.1")
bazel_dep(name = "bazel_winlibs", version = "0.0.1")

bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
commit = "1e08f8e0507b6b6b1f4416a9a22cf5c28beaba93",
)

winlibs_toolchain_extension = use_extension("@bazel_winlibs//:rules.bzl", "winlibs_toolchain_extension")
inject_repo(winlibs_toolchain_extension, "platforms", "bazel_utilities")
winlibs_toolchain_extension.winlibs_toolchain(name = "winlibs")
winlibs_toolchain_extension.winlibs_toolchain(name = "pthread-winlibs", linklibs = [ "pthread" ])
use_repo(winlibs_toolchain_extension, "winlibs")
use_repo(winlibs_toolchain_extension, "pthread-winlibs")
# register_toolchains("@winlibs//:clang-toolchain")

buildbuddy_toolchain_extension = use_extension("@bazel_buildbuddy//:rules.bzl", "buildbuddy_toolchain_extension")
inject_repo(buildbuddy_toolchain_extension, "platforms", "bazel_utilities")
buildbuddy_toolchain_extension.buildbuddy_toolchain(name = "buildbuddy")
use_repo(buildbuddy_toolchain_extension, "buildbuddy")
# register_toolchains("@buildbuddy//:gcc-toolchain")
1 change: 1 addition & 0 deletions Tests/Tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "StreamFormat/Tester/TestSuite/AllTestSuite.h"
#include "StreamFormat/FLog/DefaultLogger.h"

int main()
{
Expand Down
36 changes: 0 additions & 36 deletions WORKSPACE

This file was deleted.

2 changes: 1 addition & 1 deletion buildbuddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ actions:
branches:
- "*"
bazel_commands:
- "test -s --config=buildbuddy --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_WINDOWS_WSL} //..."
- "test -s --config=buildbuddy --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_WINDOWS_WSL} //:StreamFormatTests"
File renamed without changes.

0 comments on commit 4fb7981

Please sign in to comment.