Skip to content
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

basic bazel integration #809

Merged
merged 5 commits into from
Dec 24, 2024
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 .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt="-std=c++20"
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.0.0
37 changes: 37 additions & 0 deletions .github/workflows/ubuntu-bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Ubuntu 22.04 Bazel

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '**.md'
- 'docs/**'
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'

permissions:
contents: read

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

jobs:
ubuntu-bazel:
runs-on: ubuntu-22.04
strategy:
matrix:
shared: [ON, OFF]
cxx: [g++-12, clang++-14]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: bazelbuild/setup-bazelisk@v3
- name: Build & Test
run: bazel test //...
env:
CC: ${{matrix.cxx}}
CXX: ${{matrix.cxx}}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ benchmarks/competitors/servo-url/debug
benchmarks/competitors/servo-url/target

#ignore VScode
.vscode/
.vscode/

# bazel output
bazel-*
20 changes: 20 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cc_library(
name = "ada",
srcs = [
"src/ada.cpp",
],
hdrs = glob([
"include/*.h",
"include/ada/*.h",
# todo: this can be included by every client of the library, but there is no better way
# since .cpp files are included into each other.
"src/*.cpp",
]),
# todo: once .cpp files are not included, rather then polluting -I flags, src/ should
# be dropped from hdrs and this replaced by `strip_include_prefix = "include"`
includes = [
"include",
"include/ada",
],
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel_dep(name = "googletest", version = "1.15.2")
280 changes: 280 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

Empty file added WORKSPACE
Empty file.
9 changes: 9 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cc_test(
name = "url_search_params",
srcs = ["url_search_params.cpp"],
deps = [
"//:ada",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)
Loading