Skip to content

Commit

Permalink
[NFC] Miscellaneous Maintenance (#45)
Browse files Browse the repository at this point in the history
- [x] Move 3p http_archive definitions to `deps.bzl` to keep WORKSPACE
minimal
- [x] Restore AotCompile targets in clangd database
- [x] Bump pip requirements_lock
  • Loading branch information
sjain-stanford authored Feb 23, 2024
1 parent cfed9d9 commit 4c0a627
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 63 deletions.
56 changes: 0 additions & 56 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,10 @@ load("@torch-mlir-raw//utils/bazel:configure.bzl", "torch_mlir_configure")

torch_mlir_configure(name = "torch-mlir")

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

# -------------------------- #
# Hermetic Python Setup #
# -------------------------- #

RULES_PYTHON_VERSION = "0.29.0"

RULES_PYTHON_SHA256 = "d71d2c67e0bce986e1c5a7731b4693226867c45bfe0b7c5e0067228a536fc580"

http_archive(
name = "rules_python",
sha256 = RULES_PYTHON_SHA256,
strip_prefix = "rules_python-{}".format(RULES_PYTHON_VERSION),
url = "https://github.com/bazelbuild/rules_python/releases/download/{}/rules_python-{}.tar.gz".format(RULES_PYTHON_VERSION, RULES_PYTHON_VERSION),
)

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

py_repositories()
Expand Down Expand Up @@ -71,15 +58,6 @@ install_deps()

# https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md

http_archive(
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")

go_rules_dependencies()
Expand All @@ -88,55 +66,21 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains")

go_register_toolchains(version = "1.20.3")

http_archive(
name = "bazel_gazelle",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
],
)

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()

http_archive(
name = "com_google_protobuf",
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
strip_prefix = "protobuf-3.19.4",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz",
],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "ae34c344514e08c23e90da0e2d6cb700fcd28e80c02e23e4d5715dddcb42f7b3",
strip_prefix = "buildtools-4.2.2",
urls = [
"https://github.com/bazelbuild/buildtools/archive/refs/tags/4.2.2.tar.gz",
],
)

# ------------------------------------ #
# Bazel Compile Commands Extractor #
# for clangd #
# ------------------------------------ #

# https://github.com/hedronvision/bazel-compile-commands-extractor/blob/main/README.md

http_archive(
name = "hedron_compile_commands",
sha256 = "2188c3cd3a16404a6b20136151b37e7afb5a320e150453750c15080de5ba3058",
strip_prefix = "bazel-compile-commands-extractor-6d58fa6bf39f612304e55566fa628fd160b38177",
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/6d58fa6bf39f612304e55566fa628fd160b38177.tar.gz",
)

load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")

hedron_compile_commands_setup()
53 changes: 52 additions & 1 deletion deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def third_party_deps():
)

SKYLIB_VERSION = "1.3.0"

http_archive(
name = "bazel_skylib",
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
Expand Down Expand Up @@ -100,3 +99,55 @@ def third_party_deps():
urls = ["https://github.com/google/googletest/archive/f8d7d77c06936315286eb55f8de22cd23c188571.zip"],
strip_prefix = "googletest-f8d7d77c06936315286eb55f8de22cd23c188571",
)

RULES_PYTHON_VERSION = "0.29.0"
RULES_PYTHON_SHA256 = "d71d2c67e0bce986e1c5a7731b4693226867c45bfe0b7c5e0067228a536fc580"
http_archive(
name = "rules_python",
sha256 = RULES_PYTHON_SHA256,
strip_prefix = "rules_python-{}".format(RULES_PYTHON_VERSION),
url = "https://github.com/bazelbuild/rules_python/releases/download/{}/rules_python-{}.tar.gz".format(RULES_PYTHON_VERSION, RULES_PYTHON_VERSION),
)

http_archive(
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
],
)

http_archive(
name = "com_google_protobuf",
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
strip_prefix = "protobuf-3.19.4",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz",
],
)

http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "ae34c344514e08c23e90da0e2d6cb700fcd28e80c02e23e4d5715dddcb42f7b3",
strip_prefix = "buildtools-4.2.2",
urls = [
"https://github.com/bazelbuild/buildtools/archive/refs/tags/4.2.2.tar.gz",
],
)

http_archive(
name = "hedron_compile_commands",
sha256 = "2188c3cd3a16404a6b20136151b37e7afb5a320e150453750c15080de5ba3058",
strip_prefix = "bazel-compile-commands-extractor-6d58fa6bf39f612304e55566fa628fd160b38177",
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/6d58fa6bf39f612304e55566fa628fd160b38177.tar.gz",
)
12 changes: 6 additions & 6 deletions requirements_lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ sympy==1.12 \
--hash=sha256:c3588cd4295d0c0f603d0f2ae780587e64e2efeedb3521e46b9bb1d08d184fa5 \
--hash=sha256:ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8
# via torch
torch==2.3.0.dev20240214+cpu \
--hash=sha256:31fb851ad1a957e6257ca61a3439aa0a0ad76e41f1b3239480236bd9132d4ca4 \
--hash=sha256:83f9e92c1549c5b2541ab8ea57654463f291c2376e7b8dd5fb357c635efd604d
torch==2.3.0.dev20240220+cpu \
--hash=sha256:03ca173f8cbf3e75035f7648ab93adbc8d90dea28d2b32aada53b7d64bc81a95 \
--hash=sha256:d55f8221662c555243af1dc7c9ba861ddb3c69d037fd64677b29b662bb8d2a18
# via
# -r requirements.txt
# torch-mlir
torch-mlir==20240221.14 \
--hash=sha256:071077a0ea13d66a409b1d9c55c69d8378f5b9f0a06f72271db23abb2096a8ec \
--hash=sha256:15c2dafc29b76d17199f4d11e8f0ac7bff361cc06900baad6b7b62ee1f3f015a
torch-mlir==20240223.16 \
--hash=sha256:429bce23c3830485b2c35ae48c1308ad66f63d3e86e4a9e19a17b11b58a1f06d \
--hash=sha256:8b463ad944951781a3c2c51f4240bfc15eb459a6565762499a279d332cc611cf
# via -r requirements.txt
typing-extensions==4.9.0 \
--hash=sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783 \
Expand Down
3 changes: 3 additions & 0 deletions tools/clangd/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ refresh_compile_commands(
"//:TcpTypesIncGen",
"//:TorchToTcp",
"//:tcp-opt",
"//test/AotCompile:aot_compiled_basic_tcp_ops",
"//test/AotCompile:test_aot_compiled_basic_tcp_ops",
"//tools/aot:abi",
],
)

0 comments on commit 4c0a627

Please sign in to comment.