Skip to content

feat: bzlmodify #78

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 7 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test
compile_commands.json
15 changes: 1 addition & 14 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
startup --windows_enable_symlinks
build --enable_platform_specific_config
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
build --enable_runfiles

build:windows --platforms=//bazel/platforms:windows
build:windows --host_platform=//bazel/platforms:windows

build:linux --platforms=//bazel/platforms:linux
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux

build:no-warnings --per_file_copt=//.*@-Werror
import %workspace%/bazel/common.bazelrc

try-import %workspace%/user.bazelrc
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.3.2
15 changes: 15 additions & 0 deletions .github/workflows/bzlmod-archive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is maintained by ecsact-dev/ecsact_common
# If changes are required please make them there

name: bzlmod archive

on:
release:
types: [published]

jobs:
bzlmod-archive:
uses: ecsact-dev/bazel_registry/.github/workflows/bzlmod-archive.yml@main
secrets: inherit
permissions:
contents: write
4 changes: 0 additions & 4 deletions .github/workflows/ci-windows.bazelrc

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/ci.bazelrc

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/ci.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This file is maintained by ecsact-dev/ecsact_common
# If changes are required please make them there

name: main

on:
push:
branches:
- "**"

jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jidicula/[email protected]
with: { clang-format-version: "16" }

test-windows:
runs-on: windows-latest
steps:
- uses: ecsact-dev/[email protected]
- uses: actions/cache@v3
with:
path: |
/Users/runneradmin/AppData/Local/bazelisk
/Users/runneradmin/.cache/bazel-disk-cache
key: ${{runner.os}}-bazel-cache
- uses: actions/checkout@v4
- run: bazelisk --output_user_root=C:/tmp build --config=ci //...
- if: ${{ hashfiles('test/MODULE.bazel') != '' }}
run: bazelisk --output_user_root=C:/tmp test --config=ci ...
working-directory: test

test-linux:
runs-on: ubuntu-latest
steps:
- uses: ecsact-dev/[email protected]
- uses: actions/cache@v3
with:
path: |
~/.cache/bazelisk
~/.cache/bazel-disk-cache
key: ${{runner.os}}-bazel-cache
- uses: actions/checkout@v4
- run: bazelisk build --config=ci //...
- if: ${{ hashfiles('test/MODULE.bazel') != '' }}
run: bazelisk test --config=ci ...
working-directory: test
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/bazel-*
/user.bazelrc
/compile_commands.json
/external
/.cache/
bazel-*
user.bazelrc
compile_commands.json
external
.cache
33 changes: 0 additions & 33 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_ecsact//ecsact:toolchain.bzl", "ecsact_toolchain")
load("//bazel:copts.bzl", "copts")

package(default_visibility = ["//visibility:public"])
Expand All @@ -14,35 +13,3 @@ cc_library(
hdrs = glob(["ecsact/**/*.hh"]),
copts = copts,
)

#### ECSACT TOOLCHAIN STUFF FOR TESTS BELOW HERE ####

ecsact_toolchain(
name = "ecsact_cli_windows",
target_tool = "@ecsact_cli_windows//file",
)

ecsact_toolchain(
name = "ecsact_cli_linux",
target_tool = "@ecsact_cli_linux//file",
)

toolchain(
name = "ecsact_windows_toolchain",
exec_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
toolchain = ":ecsact_cli_windows",
toolchain_type = "@rules_ecsact//ecsact:toolchain_type",
)

toolchain(
name = "ecsact_linux_toolchain",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
toolchain = ":ecsact_cli_linux",
toolchain_type = "@rules_ecsact//ecsact:toolchain_type",
)
19 changes: 19 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module(
name = "ecsact_rt_entt",
version = "0.2.0",
compatibility_level = 2,
)

bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "rules_ecsact", version = "0.4.0")
bazel_dep(name = "ecsact_runtime", version = "0.5.1")
bazel_dep(name = "ecsact_lang_cpp", version = "0.3.0")
bazel_dep(name = "boost.mp11", version = "1.83.0.bzl.1")
bazel_dep(name = "entt", version = "3.12.2")

ecsact = use_extension("@rules_ecsact//ecsact:extensions.bzl", "ecsact")
ecsact.sdk_toolchain(version = "0.6.2")
use_repo(ecsact, "ecsact_sdk", "ecsact_toolchains")

register_toolchains("@ecsact_toolchains//:all")
77 changes: 2 additions & 75 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,75 +1,4 @@
workspace(name = "ecsact_rt_entt")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

http_archive(
name = "com_github_skypjack_entt",
sha256 = "0ac010f232d3089200c5e545bcbd6480cf68b705de6930d8ff7cdb0a29f5b47b",
strip_prefix = "entt-3.11.1",
url = "https://github.com/skypjack/entt/archive/refs/tags/v3.11.1.tar.gz",
)

http_archive(
name = "ecsact_lang_cpp",
sha256 = "7ecf1d23fba53edfa5abf75498028b03068970a044eab3c703bd74b1edb0b2d5",
strip_prefix = "ecsact_lang_cpp-0.2.0",
urls = ["https://github.com/ecsact-dev/ecsact_lang_cpp/archive/refs/tags/0.2.0.tar.gz"],
)

http_archive(
name = "ecsact_runtime",
sha256 = "dfc71e519d24b943c855d288d19f539fc9b9c65636c0376c7febb865233161b6",
strip_prefix = "ecsact_runtime-0.2.0",
urls = ["https://github.com/ecsact-dev/ecsact_runtime/archive/refs/tags/0.2.0.tar.gz"],
)

http_file(
name = "ecsact_cli_windows",
url = "https://github.com/ecsact-dev/ecsact_cli/releases/download/0.1.0/ecsact_0.1.0_windows_x64.exe",
executable = True,
downloaded_file_path = "ecsact.exe",
)

http_file(
name = "ecsact_cli_linux",
url = "https://github.com/ecsact-dev/ecsact_cli/releases/download/0.1.0/ecsact_0.1.0_linux_x64",
executable = True,
downloaded_file_path = "ecsact",
)

http_archive(
name = "rules_ecsact",
sha256 = "3db6d498a681e036dabdcc1bb7e5ee254acadae4ab2ecf19d253f824db88d5e4",
strip_prefix = "rules_ecsact-0.3.0",
urls = ["https://github.com/ecsact-dev/rules_ecsact/archive/refs/tags/0.3.0.tar.gz"],
)

load("@rules_ecsact//ecsact:repositories.bzl", "rules_ecsact_dependencies")

rules_ecsact_dependencies()

register_toolchains(
"//:ecsact_windows_toolchain",
"//:ecsact_linux_toolchain",
)

http_archive(
name = "com_google_googletest",
sha256 = "ca6c78876bd052a7730dd717ba083e7351e26b3cfa68c5e3babd1b9d9925402e",
strip_prefix = "googletest-0e0d9feefab1b51aaab9dfd70132e93c0b6964e5",
url = "https://github.com/google/googletest/archive/0e0d9feefab1b51aaab9dfd70132e93c0b6964e5.zip",
)

http_archive(
name = "boost",
sha256 = "4a79c389add7e3d54d0e12c83098d471d24536ba2d6b8593d3a95f151f25eebb",
strip_prefix = "boost-da62319c330d81ef032517cbe13b6f35d97387cb",
urls = ["https://github.com/bazelboost/boost/archive/da62319c330d81ef032517cbe13b6f35d97387cb.zip"],
)

load("@boost//:index.bzl", "boost_http_archives")

boost_http_archives()
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

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

llvm_toolchain(
name = "llvm_toolchain",
cxx_standard = {"linux": "c++20"},
distribution = "clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz",
llvm_version = "15.0.6",
llvm_version = "16.0.4",
)

load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
Expand Down
4 changes: 4 additions & 0 deletions bazel/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config_setting(
name = "compiler_emscripten",
flag_values = {"@bazel_tools//tools/cpp:compiler": "emscripten"},
)
20 changes: 20 additions & 0 deletions bazel/common.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
startup --windows_enable_symlinks
common --enable_bzlmod
common --registry=https://raw.githubusercontent.com/ecsact-dev/bazel_registry/main
common --registry=https://raw.githubusercontent.com/bazelboost/registry/main
common --registry=https://bcr.bazel.build
build --enable_platform_specific_config
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
build --enable_runfiles
build --noincompatible_remove_rule_name_parameter
query --noincompatible_remove_rule_name_parameter

# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux

common:ci --announce_rc
common:ci --verbose_failures
common:ci --keep_going
common:ci --disk_cache=~/.cache/bazel-disk-cache
20 changes: 15 additions & 5 deletions bazel/copts.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
"""
"""
load("@bazel_skylib//lib:selects.bzl", "selects")

copts = select({
"@bazel_tools//tools/cpp:msvc": ["/std:c++20", "/Zc:preprocessor", "/permissive-", "/diagnostics:caret"],
"//conditions:default": ["-std=c++20"],
# Ecsact repositories currently only support clang, cl, and emscripten
copts = selects.with_or({
(Label("//bazel:compiler_emscripten")): [
"-std=c++20",
],
("@rules_cc//cc/compiler:clang"): [
"-std=c++2b",
"-fexperimental-library",
],
("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [
"/std:c++latest",
"/permissive-",
"/Zc:preprocessor",
],
})
19 changes: 0 additions & 19 deletions bazel/platforms/BUILD.bazel

This file was deleted.

Loading