Skip to content

Commit fb0e5bd

Browse files
authored
basic bazel integration (#809)
* bazel integration * github workflow * name fix * set CC var too * name fix
1 parent 925969b commit fb0e5bd

File tree

9 files changed

+353
-1
lines changed

9 files changed

+353
-1
lines changed

.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --cxxopt="-std=c++20"

.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.0.0

.github/workflows/ubuntu-bazel.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Ubuntu 22.04 Bazel
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
push:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**.md'
14+
- 'docs/**'
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
ubuntu-bazel:
25+
runs-on: ubuntu-22.04
26+
strategy:
27+
matrix:
28+
shared: [ON, OFF]
29+
cxx: [g++-12, clang++-14]
30+
steps:
31+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
- uses: bazelbuild/setup-bazelisk@v3
33+
- name: Build & Test
34+
run: bazel test //...
35+
env:
36+
CC: ${{matrix.cxx}}
37+
CXX: ${{matrix.cxx}}

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ benchmarks/competitors/servo-url/debug
2424
benchmarks/competitors/servo-url/target
2525

2626
#ignore VScode
27-
.vscode/
27+
.vscode/
28+
29+
# bazel output
30+
bazel-*

BUILD.bazel

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cc_library(
2+
name = "ada",
3+
srcs = [
4+
"src/ada.cpp",
5+
],
6+
hdrs = glob([
7+
"include/*.h",
8+
"include/ada/*.h",
9+
# todo: this can be included by every client of the library, but there is no better way
10+
# since .cpp files are included into each other.
11+
"src/*.cpp",
12+
]),
13+
# todo: once .cpp files are not included, rather then polluting -I flags, src/ should
14+
# be dropped from hdrs and this replaced by `strip_include_prefix = "include"`
15+
includes = [
16+
"include",
17+
"include/ada",
18+
],
19+
visibility = ["//visibility:public"],
20+
)

MODULE.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel_dep(name = "googletest", version = "1.15.2")

MODULE.bazel.lock

+280
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE

Whitespace-only changes.

tests/BUILD.bazel

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cc_test(
2+
name = "url_search_params",
3+
srcs = ["url_search_params.cpp"],
4+
deps = [
5+
"//:ada",
6+
"@googletest//:gtest",
7+
"@googletest//:gtest_main",
8+
],
9+
)

0 commit comments

Comments
 (0)