Skip to content

Commit

Permalink
Simplify WORKSPACE.bzlmod and add CI test for Bzlmod
Browse files Browse the repository at this point in the history
- All workspace suffix are removed from WORKSPACE.bzlmod, since we get
  all dependencies and toolchains from Bzlmod.
- Added build:bzlmod bazelrc section, we have to override two flags to
  make sure toolchains are picked up correctly.
- Added zstd-jni as dependency
- Added postsubmit_bzlmod.yml for testing the Bzlmod build.

Tested at https://buildkite.com/bazel/bazel-bazel-with-bzlmod/builds/3

Closes #14312.

PiperOrigin-RevId: 411855954
  • Loading branch information
meteorcloudy authored and copybara-github committed Nov 23, 2021
1 parent ae0a6c9 commit 89ea68b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 400 deletions.
38 changes: 38 additions & 0 deletions .bazelci/postsubmit_bzlmod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
tasks:
centos7_java11_devtoolset10:
build_flags:
- "--config=bzlmod"
build_targets:
- "//src:bazel_nojdk"
ubuntu1804:
build_flags:
- "--config=bzlmod"
build_targets:
- "//src:bazel_nojdk"
ubuntu1804_clang:
platform: ubuntu1804
environment:
CC: clang
CC_CONFIGURE_DEBUG: 1
name: "Clang"
build_flags:
- "--config=bzlmod"
build_targets:
- "//src:bazel_nojdk"
ubuntu2004:
build_flags:
- "--config=bzlmod"
build_targets:
- "//src:bazel_nojdk"
macos:
xcode_version: "13.0"
build_flags:
- "--config=bzlmod"
build_targets:
- "//src:bazel_nojdk"
windows:
build_flags:
- "--config=bzlmod"
build_targets:
- "//src:bazel_nojdk"
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ build:remote --config=ubuntu1804_java11

build:macos --macos_minimum_os=10.10

# Enable Bzlmod
build:bzlmod --experimental_enable_bzlmod
# TODO(pcloudy): The following should be removed after fixing https://github.com/bazelbuild/bazel/issues/14279
build:bzlmod --crosstool_top=@rules_cc.0.0.1.cc_configure.local_config_cc//:toolchain
build:bzlmod --xcode_version_config=@rules_cc.0.0.1.cc_configure.local_config_xcode//:host_xcodes

# User-specific .bazelrc
try-import user.bazelrc
8 changes: 3 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ bazel_dep(name = "grpc", version = "1.41.0", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_pkg", version = "0.5.1")
bazel_dep(name = "stardoc", version = "0.5.0", repo_name = "io_bazel_skydoc")
bazel_dep(name = "zstd-jni", version = "1.5.0-4")

# TODO(pcloudy): Add remoteapis and googleapis as Bazel modules in the BCR.
bazel_dep(name = "remoteapis", version = "")
Expand All @@ -27,10 +28,7 @@ local_path_override(
)

# The following are required when building without WORKSPACE SUFFIX
# TODO(pcloudy): Make building Bazel work without WORKSPACE SUFFIX.
# This requires migrating all dependencies and toolchain registration defined in
# WORKSPACE to their corresponding Bazel modules. Eg. remote jdks, java tools
# and java toolchain registrations all should be moved to rules_java.
bazel_dep(name = "rules_cc", version = "0.0.1")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_python", version = "0.4.0")
bazel_dep(name = "rules_java", version = "5.0.0")
bazel_dep(name = "rules_proto", version = "4.0.0")
Loading

0 comments on commit 89ea68b

Please sign in to comment.