Skip to content

Commit

Permalink
feat: bzlmodify (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy authored Oct 6, 2023
1 parent 683b7a7 commit 7a47b77
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 73 deletions.
13 changes: 1 addition & 12 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
build --enable_platform_specific_config
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env

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

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

common:ci --announce_rc
common:ci --disk_cache=~/.cache/bazel-disk-cache
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
43 changes: 36 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
name: CI
# This file is maintained by ecsact-dev/ecsact_common
# If changes are required please make them there

name: main

on:
push:
branches:
- "**"

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

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

test-windows:
runs-on: windows-latest
steps:
- 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 build --config=ci //...
- if: ${{ hashfiles('test/MODULE.bazel') != '' }}
run: bazelisk test --config=ci ...
working-directory: test

test-linux:
runs-on: ubuntu-latest
steps:
- 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: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module(
name = "ecsact_lang_csharp",
version = "0.1.0",
compatibility_level = 1,
)

bazel_dep(name = "ecsact_runtime", version = "0.5.4")
bazel_dep(name = "ecsact_codegen", version = "0.1.3")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "ecsact_lang_cpp", version = "0.3.1")
29 changes: 1 addition & 28 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,6 @@ workspace(name = "ecsact_lang_csharp")

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

http_archive(
name = "ecsact_runtime",
sha256 = "219ce161deeb4865d3c190eac300dd257671e2b2ca0ec8752091506ccfa554a2",
strip_prefix = "ecsact_runtime-5cbf7257d7cbc42762d22e7604bc5bc0efb837fe",
url = "https://github.com/ecsact-dev/ecsact_runtime/archive/5cbf7257d7cbc42762d22e7604bc5bc0efb837fe.zip",
)

http_archive(
name = "boost",
sha256 = "c41441a6e9f8038ad626e9f937ddc3675ab896b6c3512eefc6840037b3816d03",
strip_prefix = "boost-563e8e0de4eac4b48a02d296581dc2454127608e",
urls = ["https://github.com/bazelboost/boost/archive/563e8e0de4eac4b48a02d296581dc2454127608e.zip"],
)

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

boost_http_archives()

http_archive(
name = "com_google_googletest",
sha256 = "41c14a5a4887125fe329235f00c5f92660f245b91bb8dde7c59f9a2540fdec28",
strip_prefix = "googletest-40412d85124f7c6f3d88454583c4633e5e10fc8c",
url = "https://github.com/google/googletest/archive/40412d85124f7c6f3d88454583c4633e5e10fc8c.zip",
)

http_archive(
name = "hedron_compile_commands",
sha256 = "ed5aea1dc87856aa2029cb6940a51511557c5cac3dbbcb05a4abd989862c36b4",
Expand All @@ -53,9 +28,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
19 changes: 16 additions & 3 deletions bazel/copts.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
copts = select({
"@bazel_tools//tools/cpp:msvc": ["/std:c++latest", "/Zc:preprocessor", "/permissive-"],
"//conditions:default": ["-std=c++20"],
load("@bazel_skylib//lib:selects.bzl", "selects")

# 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++20",
"-fexperimental-library",
],
("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [
"/std:c++20",
"/permissive-",
"/Zc:preprocessor",
],
})
19 changes: 0 additions & 19 deletions bazel/platforms/BUILD.bazel

This file was deleted.

10 changes: 10 additions & 0 deletions cog.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pre_bump_hooks = [
# Ecsact pre 1.0.0 the 0.X.0 is our 'major' version
"buildozer 'set version {{version}}' 'set compatibility_level {{version.minor}}' //MODULE.bazel:%module",
]

post_bump_hooks = [
"git push",
"git push origin {{version}}",
"gh release create {{version}} --generate-notes --latest -t {{version}} --verify-tag",
]
2 changes: 1 addition & 1 deletion csharp_codegen/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//bazel:copts.bzl", "copts")
load("@ecsact_runtime//:codegen_plugin.bzl", "cc_ecsact_codegen_plugin")
load("@ecsact_lang_cpp//:codegen_plugin.bzl", "cc_ecsact_codegen_plugin")

package(default_visibility = ["//visibility:public"])

Expand Down
4 changes: 2 additions & 2 deletions csharp_codegen/csharp_codegen.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <vector>
#include <cassert>
#include "ecsact/runtime/meta.hh"
#include "ecsact/codegen_plugin.h"
#include "ecsact/codegen_plugin.hh"
#include "ecsact/codegen/plugin.h"
#include "ecsact/codegen/plugin.hh"
#include "ecsact/lang-support/lang-csharp.hh"

static bool has_parent_system(ecsact_system_id id) {
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"extends": [
"github>ecsact-dev/renovate-config"
]
}
}

0 comments on commit 7a47b77

Please sign in to comment.