Skip to content

Commit

Permalink
Port WORKSPACE to Bzlmod for better compatibility with Bazel 8.0 and …
Browse files Browse the repository at this point in the history
…later.

PiperOrigin-RevId: 704450706
  • Loading branch information
xnnpack-bot committed Dec 10, 2024
1 parent cae3e32 commit fde3571
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Common settings
common --enable_workspace
common --enable_bzlmod
build --enable_bzlmod

# Basic build settings
build --jobs 128
Expand Down
1 change: 0 additions & 1 deletion .bazelversion

This file was deleted.

60 changes: 23 additions & 37 deletions WORKSPACE → MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,47 +1,33 @@
workspace(name = "xnnpack")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
## MODULE.bazel
module(
name = "xnnpack",
)

# Bazel rule definitions
http_archive(
name = "rules_cc",
sha256 = "3868eab488bd5be37a6acedbd222a196bea14408a2857916f33cce7b4780897d",
strip_prefix = "rules_cc-5e848c1434d3458018734238dbc4781f43992ea5",
urls = [
"https://github.com/bazelbuild/rules_cc/archive/5e848c1434d3458018734238dbc4781f43992ea5.zip",
],
)
bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "rules_python", version = "1.0.0")

# Bazel Python rule definitions.
http_archive(
name = "rules_python",
sha256 = "4912ced70dc1a2a8e4b86cec233b192ca053e82bc72d877b98e126156e8f228d",
strip_prefix = "rules_python-0.32.2",
urls = [
"https://github.com/bazelbuild/rules_python/releases/download/0.32.2/rules_python-0.32.2.tar.gz",
],
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
requirements_lock = "//:requirements_lock.txt",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
use_repo(pip, "pip")

# Bazel Skylib.
http_archive(
name = "bazel_skylib",
sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
],
)
bazel_dep(name = "bazel_skylib", version = "1.7.1")

# Bazel Platforms
http_archive(
name = "platforms",
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
urls = ["https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz"],
)
bazel_dep(name = "platforms", version = "0.0.10")

# TODO: some (most? all?) of the http_archive() calls below could become bazel_dep() calls,
# but it would require verifying that the semver provided by the Bazel registry matches the hash
# that we expect in CMake; it's not clear that it is a big win to do so given the modest
# complexity of our deps, so I'm leaving it like this for now to ensure that the Bazel and CMake
# builds are using identical dependencies.

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

# LINT.IfChange
# Google Test framework, used by most unit-tests.
Expand Down Expand Up @@ -102,7 +88,7 @@ http_archive(
sha256 = "ad37707084a6d4ff41be10cbe8540c75bea057ba79d0de6c367c1bfac6ba0852",
strip_prefix = "kleidiai-40a926833857fb64786e02f97703e42b1537cb57",
urls = [
"https://gitlab.arm.com/kleidi/kleidiai/-/archive/40a926833857fb64786e02f97703e42b1537cb57/kleidiai-40a926833857fb64786e02f97703e42b1537cb57.zip"
"https://gitlab.arm.com/kleidi/kleidiai/-/archive/40a926833857fb64786e02f97703e42b1537cb57/kleidiai-40a926833857fb64786e02f97703e42b1537cb57.zip",
],
)
# LINT.ThenChange(cmake/DownloadKleidiAI.cmake)
Expand Down

0 comments on commit fde3571

Please sign in to comment.