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

[BUILD] Add support for bzlmod #2608

Merged
merged 5 commits into from
Jun 14, 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
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,27 @@ jobs:
- name: run tests
run: ./ci/do_ci.sh bazel.test

bazel_no_bzlmod_test:
name: Bazel without bzlmod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Mount Bazel Cache
uses: actions/cache@v4
env:
cache-name: bazel_cache
with:
path: /home/runner/.cache/bazel
key: bazel_test
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_bazelisk.sh
- name: run tests
run: ./ci/do_ci.sh bazel.no_bzlmod.test

bazel_test_async:
name: Bazel with async export
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*.app

# Bazel files
MODULE.bazel.lock
/bazel-*

# Mac
Expand Down
25 changes: 25 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

module(
name = "opentelemetry-cpp",
version = "0",
compatibility_level = 0,
repo_name = "io_opentelemetry_cpp",
)

bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "com_google_absl")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "curl", version = "8.4.0")
bazel_dep(name = "grpc", version = "1.62.1", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "github_nlohmann_json")
bazel_dep(name = "opentelemetry-proto", version = "1.3.1", repo_name = "com_github_opentelemetry_proto")
bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_opentracing")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "prometheus-cpp", version = "1.2.4", repo_name = "com_github_jupp0r_prometheus_cpp")
bazel_dep(name = "protobuf", version = "26.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "zlib", version = "1.3.1.bcr.1")

bazel_dep(name = "google_benchmark", version = "1.8.3", dev_dependency = True, repo_name = "com_github_google_benchmark")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", dev_dependency = True, repo_name = "com_google_googletest")
4 changes: 4 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# Disables the default WORKSPACE when using bzlmod
4 changes: 4 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ EOF
make load_plugin_example
examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null
exit 0
elif [[ "$1" == "bazel.no_bzlmod.test" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build --enable_bzlmod=false $BAZEL_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test --enable_bzlmod=false $BAZEL_TEST_OPTIONS //...
marcalff marked this conversation as resolved.
Show resolved Hide resolved
exit 0
elif [[ "$1" == "bazel.test" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //...
Expand Down