Skip to content

Commit dee1e89

Browse files
authored
feat: bzlmodify (#78)
1 parent b614711 commit dee1e89

27 files changed

+298
-317
lines changed

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
test
12
compile_commands.json

.bazelrc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
startup --windows_enable_symlinks
2-
build --enable_platform_specific_config
3-
build --incompatible_use_platforms_repo_for_constraints
4-
build --incompatible_enable_cc_toolchain_resolution
5-
build --incompatible_strict_action_env
6-
build --enable_runfiles
7-
8-
build:windows --platforms=//bazel/platforms:windows
9-
build:windows --host_platform=//bazel/platforms:windows
10-
11-
build:linux --platforms=//bazel/platforms:linux
12-
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
13-
14-
build:no-warnings --per_file_copt=//.*@-Werror
1+
import %workspace%/bazel/common.bazelrc
152

163
try-import %workspace%/user.bazelrc

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.3.2

.github/workflows/bzlmod-archive.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is maintained by ecsact-dev/ecsact_common
2+
# If changes are required please make them there
3+
4+
name: bzlmod archive
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
bzlmod-archive:
12+
uses: ecsact-dev/bazel_registry/.github/workflows/bzlmod-archive.yml@main
13+
secrets: inherit
14+
permissions:
15+
contents: write

.github/workflows/ci-windows.bazelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/ci.bazelrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This file is maintained by ecsact-dev/ecsact_common
2+
# If changes are required please make them there
3+
4+
name: main
5+
6+
on:
7+
push:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
formatting-check:
13+
name: Formatting Check
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: jidicula/[email protected]
18+
with: { clang-format-version: "16" }
19+
20+
test-windows:
21+
runs-on: windows-latest
22+
steps:
23+
- uses: ecsact-dev/[email protected]
24+
- uses: actions/cache@v3
25+
with:
26+
path: |
27+
/Users/runneradmin/AppData/Local/bazelisk
28+
/Users/runneradmin/.cache/bazel-disk-cache
29+
key: ${{runner.os}}-bazel-cache
30+
- uses: actions/checkout@v4
31+
- run: bazelisk --output_user_root=C:/tmp build --config=ci //...
32+
- if: ${{ hashfiles('test/MODULE.bazel') != '' }}
33+
run: bazelisk --output_user_root=C:/tmp test --config=ci ...
34+
working-directory: test
35+
36+
test-linux:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: ecsact-dev/[email protected]
40+
- uses: actions/cache@v3
41+
with:
42+
path: |
43+
~/.cache/bazelisk
44+
~/.cache/bazel-disk-cache
45+
key: ${{runner.os}}-bazel-cache
46+
- uses: actions/checkout@v4
47+
- run: bazelisk build --config=ci //...
48+
- if: ${{ hashfiles('test/MODULE.bazel') != '' }}
49+
run: bazelisk test --config=ci ...
50+
working-directory: test

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/bazel-*
2-
/user.bazelrc
3-
/compile_commands.json
4-
/external
5-
/.cache/
1+
bazel-*
2+
user.bazelrc
3+
compile_commands.json
4+
external
5+
.cache

BUILD.bazel

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
load("@rules_cc//cc:defs.bzl", "cc_library")
2-
load("@rules_ecsact//ecsact:toolchain.bzl", "ecsact_toolchain")
32
load("//bazel:copts.bzl", "copts")
43

54
package(default_visibility = ["//visibility:public"])
@@ -14,35 +13,3 @@ cc_library(
1413
hdrs = glob(["ecsact/**/*.hh"]),
1514
copts = copts,
1615
)
17-
18-
#### ECSACT TOOLCHAIN STUFF FOR TESTS BELOW HERE ####
19-
20-
ecsact_toolchain(
21-
name = "ecsact_cli_windows",
22-
target_tool = "@ecsact_cli_windows//file",
23-
)
24-
25-
ecsact_toolchain(
26-
name = "ecsact_cli_linux",
27-
target_tool = "@ecsact_cli_linux//file",
28-
)
29-
30-
toolchain(
31-
name = "ecsact_windows_toolchain",
32-
exec_compatible_with = [
33-
"@platforms//os:windows",
34-
"@platforms//cpu:x86_64",
35-
],
36-
toolchain = ":ecsact_cli_windows",
37-
toolchain_type = "@rules_ecsact//ecsact:toolchain_type",
38-
)
39-
40-
toolchain(
41-
name = "ecsact_linux_toolchain",
42-
exec_compatible_with = [
43-
"@platforms//os:linux",
44-
"@platforms//cpu:x86_64",
45-
],
46-
toolchain = ":ecsact_cli_linux",
47-
toolchain_type = "@rules_ecsact//ecsact:toolchain_type",
48-
)

MODULE.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module(
2+
name = "ecsact_rt_entt",
3+
version = "0.2.0",
4+
compatibility_level = 2,
5+
)
6+
7+
bazel_dep(name = "rules_cc", version = "0.0.9")
8+
bazel_dep(name = "bazel_skylib", version = "1.4.2")
9+
bazel_dep(name = "rules_ecsact", version = "0.4.0")
10+
bazel_dep(name = "ecsact_runtime", version = "0.5.1")
11+
bazel_dep(name = "ecsact_lang_cpp", version = "0.3.0")
12+
bazel_dep(name = "boost.mp11", version = "1.83.0.bzl.1")
13+
bazel_dep(name = "entt", version = "3.12.2")
14+
15+
ecsact = use_extension("@rules_ecsact//ecsact:extensions.bzl", "ecsact")
16+
ecsact.sdk_toolchain(version = "0.6.2")
17+
use_repo(ecsact, "ecsact_sdk", "ecsact_toolchains")
18+
19+
register_toolchains("@ecsact_toolchains//:all")

WORKSPACE.bazel

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,4 @@
1-
workspace(name = "ecsact_rt_entt")
2-
3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
4-
5-
http_archive(
6-
name = "com_github_skypjack_entt",
7-
sha256 = "0ac010f232d3089200c5e545bcbd6480cf68b705de6930d8ff7cdb0a29f5b47b",
8-
strip_prefix = "entt-3.11.1",
9-
url = "https://github.com/skypjack/entt/archive/refs/tags/v3.11.1.tar.gz",
10-
)
11-
12-
http_archive(
13-
name = "ecsact_lang_cpp",
14-
sha256 = "7ecf1d23fba53edfa5abf75498028b03068970a044eab3c703bd74b1edb0b2d5",
15-
strip_prefix = "ecsact_lang_cpp-0.2.0",
16-
urls = ["https://github.com/ecsact-dev/ecsact_lang_cpp/archive/refs/tags/0.2.0.tar.gz"],
17-
)
18-
19-
http_archive(
20-
name = "ecsact_runtime",
21-
sha256 = "dfc71e519d24b943c855d288d19f539fc9b9c65636c0376c7febb865233161b6",
22-
strip_prefix = "ecsact_runtime-0.2.0",
23-
urls = ["https://github.com/ecsact-dev/ecsact_runtime/archive/refs/tags/0.2.0.tar.gz"],
24-
)
25-
26-
http_file(
27-
name = "ecsact_cli_windows",
28-
url = "https://github.com/ecsact-dev/ecsact_cli/releases/download/0.1.0/ecsact_0.1.0_windows_x64.exe",
29-
executable = True,
30-
downloaded_file_path = "ecsact.exe",
31-
)
32-
33-
http_file(
34-
name = "ecsact_cli_linux",
35-
url = "https://github.com/ecsact-dev/ecsact_cli/releases/download/0.1.0/ecsact_0.1.0_linux_x64",
36-
executable = True,
37-
downloaded_file_path = "ecsact",
38-
)
39-
40-
http_archive(
41-
name = "rules_ecsact",
42-
sha256 = "3db6d498a681e036dabdcc1bb7e5ee254acadae4ab2ecf19d253f824db88d5e4",
43-
strip_prefix = "rules_ecsact-0.3.0",
44-
urls = ["https://github.com/ecsact-dev/rules_ecsact/archive/refs/tags/0.3.0.tar.gz"],
45-
)
46-
47-
load("@rules_ecsact//ecsact:repositories.bzl", "rules_ecsact_dependencies")
48-
49-
rules_ecsact_dependencies()
50-
51-
register_toolchains(
52-
"//:ecsact_windows_toolchain",
53-
"//:ecsact_linux_toolchain",
54-
)
55-
56-
http_archive(
57-
name = "com_google_googletest",
58-
sha256 = "ca6c78876bd052a7730dd717ba083e7351e26b3cfa68c5e3babd1b9d9925402e",
59-
strip_prefix = "googletest-0e0d9feefab1b51aaab9dfd70132e93c0b6964e5",
60-
url = "https://github.com/google/googletest/archive/0e0d9feefab1b51aaab9dfd70132e93c0b6964e5.zip",
61-
)
62-
63-
http_archive(
64-
name = "boost",
65-
sha256 = "4a79c389add7e3d54d0e12c83098d471d24536ba2d6b8593d3a95f151f25eebb",
66-
strip_prefix = "boost-da62319c330d81ef032517cbe13b6f35d97387cb",
67-
urls = ["https://github.com/bazelboost/boost/archive/da62319c330d81ef032517cbe13b6f35d97387cb.zip"],
68-
)
69-
70-
load("@boost//:index.bzl", "boost_http_archives")
71-
72-
boost_http_archives()
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
732

743
http_archive(
754
name = "hedron_compile_commands",
@@ -97,9 +26,7 @@ load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
9726

9827
llvm_toolchain(
9928
name = "llvm_toolchain",
100-
cxx_standard = {"linux": "c++20"},
101-
distribution = "clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz",
102-
llvm_version = "15.0.6",
29+
llvm_version = "16.0.4",
10330
)
10431

10532
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")

bazel/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config_setting(
2+
name = "compiler_emscripten",
3+
flag_values = {"@bazel_tools//tools/cpp:compiler": "emscripten"},
4+
)

bazel/common.bazelrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
startup --windows_enable_symlinks
2+
common --enable_bzlmod
3+
common --registry=https://raw.githubusercontent.com/ecsact-dev/bazel_registry/main
4+
common --registry=https://raw.githubusercontent.com/bazelboost/registry/main
5+
common --registry=https://bcr.bazel.build
6+
build --enable_platform_specific_config
7+
build --incompatible_use_platforms_repo_for_constraints
8+
build --incompatible_enable_cc_toolchain_resolution
9+
build --incompatible_strict_action_env
10+
build --enable_runfiles
11+
build --noincompatible_remove_rule_name_parameter
12+
query --noincompatible_remove_rule_name_parameter
13+
14+
# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged
15+
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
16+
17+
common:ci --announce_rc
18+
common:ci --verbose_failures
19+
common:ci --keep_going
20+
common:ci --disk_cache=~/.cache/bazel-disk-cache

bazel/copts.bzl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
"""
2-
"""
1+
load("@bazel_skylib//lib:selects.bzl", "selects")
32

4-
copts = select({
5-
"@bazel_tools//tools/cpp:msvc": ["/std:c++20", "/Zc:preprocessor", "/permissive-", "/diagnostics:caret"],
6-
"//conditions:default": ["-std=c++20"],
3+
# Ecsact repositories currently only support clang, cl, and emscripten
4+
copts = selects.with_or({
5+
(Label("//bazel:compiler_emscripten")): [
6+
"-std=c++20",
7+
],
8+
("@rules_cc//cc/compiler:clang"): [
9+
"-std=c++2b",
10+
"-fexperimental-library",
11+
],
12+
("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [
13+
"/std:c++latest",
14+
"/permissive-",
15+
"/Zc:preprocessor",
16+
],
717
})

bazel/platforms/BUILD.bazel

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)