From 6c5738c19ec8ad4611d7763101c69adc9d021f2c Mon Sep 17 00:00:00 2001 From: BELLIER Sacha Date: Tue, 29 Oct 2024 18:35:38 +0100 Subject: [PATCH] wip: module --- .bazelrc | 16 +++++++---- .buildkite/windows_amd64.yml | 8 +++++- .github/workflows/LittleECS.yml | 15 ++++++++++ BUILD => BUILD.bazel | 0 Examples/MODULE.bazel | 26 ++++++++++-------- Examples/Workflow/{BUILD => BUILD.bazel} | 0 MODULE.bazel | 35 +++++++++++++++++++----- WORKSPACE | 24 ---------------- conf/BUILD.bazel | 13 +++++++++ 9 files changed, 88 insertions(+), 49 deletions(-) rename BUILD => BUILD.bazel (100%) rename Examples/Workflow/{BUILD => BUILD.bazel} (100%) delete mode 100644 WORKSPACE create mode 100644 conf/BUILD.bazel diff --git a/.bazelrc b/.bazelrc index 4d9baff..8675cb8 100644 --- a/.bazelrc +++ b/.bazelrc @@ -6,18 +6,24 @@ common --show_timestamps common --verbose_failures test --test_output=errors +# 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 common:buildbuddy --remote_cache=grpcs://sacha.buildbuddy.io 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=@buildbuddy_test//:buildbuddy_linux_x86_64 -common:buildbuddy --extra_execution_platforms=@buildbuddy_test//:buildbuddy_linux_x86_64 -common:buildbuddy --remote_instance_name=littleecs -common:buildbuddy --extra_toolchains=@buildbuddy_test//:toolchain_buildbuddy_gcc_12 +common:buildbuddy --remote_instance_name=streamformat +# +common:buildbuddy --extra_execution_platforms=@buildbuddy//:platform +common:buildbuddy --extra_toolchains=@buildbuddy//:gcc-toolchain +common:buildbuddy --platforms=@buildbuddy//:platform \ No newline at end of file diff --git a/.buildkite/windows_amd64.yml b/.buildkite/windows_amd64.yml index 105f89d..4e3c44e 100644 --- a/.buildkite/windows_amd64.yml +++ b/.buildkite/windows_amd64.yml @@ -4,5 +4,11 @@ agents: steps: - label: ":bazel: Build" commands: - - bazelisk build //:LittleECSTests - bazelisk test //:LittleECSTests + + - label: ":bazel: Build And Test Winlibs/clang" + commands: + - bazelisk build --config=winlibs-clang //:LittleECSTests + - label: ":bazel: Build And Test Winlibs/gcc" + commands: + - bazelisk build --config=winlibs-gcc //:LittleECSTests diff --git a/.github/workflows/LittleECS.yml b/.github/workflows/LittleECS.yml index f95598f..7b5be3e 100644 --- a/.github/workflows/LittleECS.yml +++ b/.github/workflows/LittleECS.yml @@ -23,6 +23,21 @@ jobs: run: bazelisk build //:LittleECSTests - name: Testing... run: bazelisk test //:LittleECSTests + + 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 diff --git a/BUILD b/BUILD.bazel similarity index 100% rename from BUILD rename to BUILD.bazel diff --git a/Examples/MODULE.bazel b/Examples/MODULE.bazel index d858191..7442c2c 100644 --- a/Examples/MODULE.bazel +++ b/Examples/MODULE.bazel @@ -4,20 +4,22 @@ module( name = "littleecs_examples", version = "0.1", - repo_name = "com_sacha_littleecs_examples", ) -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") +local_path_override(module_name = "littleecs", 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 = "littleecs") -local_path_override( - module_name = "littleecs", - path = "../", -) -http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "StreamFormat", - urls = [ "https://github.com/0-Sacha/StreamFormat/archive/refs/heads/dev.zip" ], - strip_prefix = "StreamFormat-dev" -) +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") diff --git a/Examples/Workflow/BUILD b/Examples/Workflow/BUILD.bazel similarity index 100% rename from Examples/Workflow/BUILD rename to Examples/Workflow/BUILD.bazel diff --git a/MODULE.bazel b/MODULE.bazel index c5bda94..8fab659 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,14 +4,35 @@ module( name = "littleecs", version = "0.1", - repo_name = "com_sacha_littleecs", ) -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") -http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "StreamFormat", - urls = [ "https://github.com/0-Sacha/StreamFormat/archive/refs/heads/dev.zip" ], - strip_prefix = "StreamFormat-dev", +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") diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index 8da11b2..0000000 --- a/WORKSPACE +++ /dev/null @@ -1,24 +0,0 @@ -"" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "bazel_utilities", - strip_prefix = "bazel_utilities-efe15a48c3b063436d6deecaa14b811083035993", - urls = [ "https://github.com/0-Sacha/bazel_utilities/archive/efe15a48c3b063436d6deecaa14b811083035993.zip" ], - integrity = "sha256-g1BUGaQFSLywkzTqixQdQTdrJ25TlcqG6PZXoCK7Jrw=", -) - -http_archive( - name = "bazel_buildbuddy", - strip_prefix = "bazel_buildbuddy-b0840cf378c4aef5750b5e8bc87aa2ad1aeb874f", - urls = [ "https://github.com/0-Sacha/bazel_buildbuddy/archive/b0840cf378c4aef5750b5e8bc87aa2ad1aeb874f.zip" ], - integrity = "sha256-Wvbu4LB7F3d42Xj/dQyaGjVEntf4U3DO+aku3zEZD4I=", -) - -load("@bazel_buildbuddy//:rules.bzl", "buildbuddy_toolchain") - -buildbuddy_toolchain( - name = "buildbuddy_test", - auto_register_toolchain = False -) diff --git a/conf/BUILD.bazel b/conf/BUILD.bazel new file mode 100644 index 0000000..3f993ea --- /dev/null +++ b/conf/BUILD.bazel @@ -0,0 +1,13 @@ +""" +""" + +load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands") + +refresh_compile_commands( + name = "compile_commands", + exclude_external_sources = True, + exclude_headers = "external", + targets = { + "//:LittleECS": "", + }, +)