forked from hswaw/hscloud
Serge Bazanski
97b5cd7b58
This is a mega-change, but attempting to split this up further is probably not worth the effort. Summary: 1. Bump up bazel, rules_go, and others. 2. Switch to new go target naming (bye bye go_default_library) 3. Move go deps to go.mod/go.sum, use make gazelle generate from that 4. Bump up Python deps a bit And also whatever was required to actually get things to work - loads of small useless changes. Tested to work on NixOS and Ubuntu 20.04: $ bazel build //... $ bazel test //... Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583 Reviewed-by: q3k <q3k@hackerspace.pl>
315 lines
9.4 KiB
Python
315 lines
9.4 KiB
Python
workspace(
|
|
name = "hscloud",
|
|
)
|
|
|
|
local_repository(
|
|
name = "rules_jvm_external",
|
|
path = "/home/q3k/Software/rules_jvm_external",
|
|
)
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
|
|
|
|
# Load skylib
|
|
http_archive(
|
|
name = "bazel_skylib",
|
|
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
|
|
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
|
|
|
bazel_skylib_workspace()
|
|
|
|
load("@bazel_skylib//lib:versions.bzl", "versions")
|
|
|
|
versions.check(minimum_bazel_version = "5.4.1")
|
|
|
|
# Protobuf deps (shared between many rules).
|
|
# Load this as early as possible, to avoid a different version being pulled in by deps of something else
|
|
http_archive(
|
|
name = "com_google_protobuf",
|
|
sha256 = "76a33e2136f23971ce46c72fd697cd94dc9f73d56ab23b753c3e16854c90ddfd",
|
|
strip_prefix = "protobuf-2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a",
|
|
urls = [
|
|
"https://github.com/protocolbuffers/protobuf/archive/2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a.tar.gz",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_proto",
|
|
sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
|
|
strip_prefix = "rules_proto-5.3.0-21.7",
|
|
urls = [
|
|
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
|
|
],
|
|
)
|
|
|
|
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
|
|
|
|
rules_proto_dependencies()
|
|
|
|
rules_proto_toolchains()
|
|
|
|
rules_python_version = "0.24.0"
|
|
|
|
http_archive(
|
|
name = "rules_python",
|
|
sha256 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578",
|
|
strip_prefix = "rules_python-{}".format(rules_python_version),
|
|
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/{}.tar.gz".format(rules_python_version),
|
|
)
|
|
|
|
# Download Go/Gazelle rules
|
|
http_archive(
|
|
name = "io_bazel_rules_go",
|
|
sha256 = "51dc53293afe317d2696d4d6433a4c33feedb7748a9e352072e2ec3c0dafd2c6",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
|
|
"https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "bazel_gazelle",
|
|
sha256 = "29d5dafc2a5582995488c6735115d1d366fcd6a0fc2e2a153f02988706349825",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz",
|
|
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
|
|
load("//third_party/go:repositories.bzl", "go_repositories")
|
|
|
|
# Python rules
|
|
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
|
|
|
|
python_register_toolchains(
|
|
name = "python3_10",
|
|
python_version = "3.10",
|
|
)
|
|
|
|
load("@python3_10//:defs.bzl", "interpreter")
|
|
load("@rules_python//python:pip.bzl", "pip_parse")
|
|
|
|
pip_parse(
|
|
name = "pydeps",
|
|
python_interpreter_target = interpreter,
|
|
requirements_lock = "//third_party/py:requirements.txt",
|
|
)
|
|
|
|
load("@pydeps//:requirements.bzl", "install_deps")
|
|
|
|
install_deps()
|
|
|
|
# Setup Go toolchain.
|
|
|
|
# gazelle:repository_macro third_party/go/repositories.bzl%go_repositories
|
|
# gazelle:repository go_repository name=hscloud importpath=code.hackerspace.pl/hscloud
|
|
go_repositories()
|
|
|
|
load("@bazel_gazelle//:deps.bzl", "go_repository")
|
|
|
|
go_repository(
|
|
name = "org_golang_x_mod",
|
|
build_external = "external",
|
|
importpath = "golang.org/x/mod",
|
|
sum = "h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=",
|
|
version = "v0.10.0",
|
|
)
|
|
|
|
go_rules_dependencies()
|
|
|
|
go_register_toolchains(go_version = "1.20.5")
|
|
|
|
http_archive(
|
|
name = "com_github_grpc_grpc",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
"//third_party:grpc_extra_deps.patch",
|
|
],
|
|
sha256 = "931f07db9d48cff6a6007c1033ba6d691fe655bea2765444bc1ad974dfc840aa",
|
|
strip_prefix = "grpc-1.56.2",
|
|
urls = ["https://github.com/grpc/grpc/archive/v1.56.2.tar.gz"],
|
|
)
|
|
|
|
# Load grpc deps after Go, to prevent overriding Go toolchains/SDK.
|
|
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
|
|
|
|
grpc_deps()
|
|
|
|
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
|
|
|
|
grpc_extra_deps()
|
|
|
|
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
|
|
|
|
gazelle_dependencies()
|
|
|
|
# Docker rules
|
|
|
|
http_archive(
|
|
name = "io_bazel_rules_docker",
|
|
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
|
|
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
|
|
)
|
|
|
|
load("@io_bazel_rules_docker//toolchains/docker:toolchain.bzl", docker_toolchain_configure = "toolchain_configure")
|
|
|
|
load(
|
|
"@io_bazel_rules_docker//repositories:repositories.bzl",
|
|
container_repositories = "repositories",
|
|
)
|
|
|
|
container_repositories()
|
|
|
|
load(
|
|
"@io_bazel_rules_docker//python3:image.bzl",
|
|
_py_image_repos = "repositories",
|
|
)
|
|
|
|
_py_image_repos()
|
|
|
|
# Docker base images
|
|
|
|
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
|
|
|
|
container_pull(
|
|
name = "python-debian",
|
|
digest = "sha256:cfa3b79333c4e56fc675b6800445b6dcbb3e6cd4d52f2a9ade944ab73dadc6a1",
|
|
registry = "index.docker.io",
|
|
repository = "python",
|
|
tag = "3.10-bullseye", # use the same version as in python_register_toolchains
|
|
)
|
|
|
|
|
|
container_pull(
|
|
name = "prodimage-bionic",
|
|
digest = "sha256:1cd1f84169b8e1414a5d511b42909f2d540831c67b6799ae9af8cd6a80d75b5f",
|
|
registry = "registry.k0.hswaw.net",
|
|
repository = "q3k/prodimage",
|
|
tag = "20190822-1227",
|
|
)
|
|
|
|
container_pull(
|
|
name = "prodimage-focal",
|
|
digest = "sha256:fb6159a3ddf2f783092f1169792d1fba6f108714026ad2aa08204e8356825a13",
|
|
registry = "registry.k0.hswaw.net",
|
|
repository = "q3k/prodimage-focal",
|
|
tag = "20211214-0108",
|
|
)
|
|
|
|
container_pull(
|
|
name = "gerrit-3.3.2",
|
|
digest = "sha256:f7fc8b749706f38475f94191117091973914a8f084e69518deff7dbc9c2c557d",
|
|
registry = "index.docker.io",
|
|
repository = "gerritcodereview/gerrit",
|
|
tag = "3.3.2-ubuntu20",
|
|
)
|
|
|
|
# third_party/factorio
|
|
load("//third_party/factorio:factorio.bzl", "factorio_repositories")
|
|
|
|
factorio_repositories()
|
|
|
|
# For devtools/gerrit/gerrit-oauth-provider and gerrit OWNERS plugin
|
|
|
|
git_repository(
|
|
name = "com_googlesource_gerrit_bazlets",
|
|
commit = "a511f3c90129d7de7ae67c0637001162980c08d5",
|
|
remote = "https://gerrit.googlesource.com/bazlets",
|
|
shallow_since = "1606931369 -0600",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
"//third_party:bazlets_py3.patch",
|
|
],
|
|
)
|
|
|
|
load("@com_googlesource_gerrit_bazlets//:gerrit_api.bzl", "gerrit_api")
|
|
|
|
gerrit_api()
|
|
|
|
load("//devtools/gerrit/gerrit-oauth-provider:external_plugin_deps.bzl", gerrit_oauth_deps = "external_plugin_deps")
|
|
|
|
gerrit_oauth_deps(omit_commons_codec = False)
|
|
|
|
# Gerrit 3.3.2 built by q3k, backported with fix for 'empty reviewers column' bug.
|
|
# See: https://bugs.chromium.org/p/gerrit/issues/detail?id=13899
|
|
# Override can be removed once we update to > 3.3.2, as the fix for this is
|
|
# pending for the 3.3 branch.
|
|
#
|
|
# Built from v3.3.2 tag at df0507df5917fd78af01aee2495b2663530d52d1
|
|
# Cherry-picked fix from 8731af3ae785efe9ecff7f3d04302b6b01c4fc0b
|
|
# Resulted in commit 5949bfb86e62a32a95293e339ed86bfe52a283e9
|
|
# Built against Java 8:
|
|
# bazel build --java_toolchain //tools:error_prone_warnings_toolchain :release
|
|
#
|
|
http_file(
|
|
name = "org_q3k_gerrit_3_3_2_backport",
|
|
downloaded_file_path = "gerrit.war",
|
|
sha256 = "d1839d691a8534f4ccb27bed9a98281e45972fbebec50d004cecd4d5da2b15a6",
|
|
urls = [
|
|
"https://object.ceph-waw3.hswaw.net/q3k-personal/d1839d691a8534f4ccb27bed9a98281e45972fbebec50d004cecd4d5da2b15a6.war",
|
|
],
|
|
)
|
|
|
|
# Gerrit OWNERS plugins external repositories
|
|
|
|
git_repository(
|
|
name = "com_googlesource_gerrit_plugin_owners",
|
|
commit = "17817c9e319073c03513f9d5177b6142b8fd567b",
|
|
remote = "https://gerrit.googlesource.com/plugins/owners/",
|
|
shallow_since = "1593642470 +0200",
|
|
)
|
|
|
|
load("@com_googlesource_gerrit_plugin_owners//:external_plugin_deps_standalone.bzl", gerrit_owners_deps = "external_plugin_deps_standalone")
|
|
|
|
gerrit_owners_deps()
|
|
|
|
# Go image repos for Docker
|
|
|
|
load(
|
|
"@io_bazel_rules_docker//go:image.bzl",
|
|
go_image_repos = "repositories",
|
|
)
|
|
|
|
go_image_repos()
|
|
|
|
# //hswaw/site deps.
|
|
load("//hswaw/site:deps.bzl", "hswaw_site_deps")
|
|
|
|
hswaw_site_deps()
|
|
|
|
# noVNC, used by //dc/drackvm.
|
|
http_archive(
|
|
name = "com_github_novnc_novnc",
|
|
build_file_content = """
|
|
filegroup(
|
|
name = "distfiles",
|
|
srcs = [
|
|
"vnc.html",
|
|
] + glob([
|
|
"app/**",
|
|
"core/**",
|
|
"vendor/**",
|
|
]),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
""",
|
|
sha256 = "2c972cca34376dfd2a54939e7e571e466511bf592d03e838440b3c8868441eaf",
|
|
strip_prefix = "noVNC-1.3.0-beta",
|
|
urls = ["https://github.com/novnc/noVNC/archive/refs/tags/v1.3.0-beta.tar.gz"],
|
|
)
|
|
|
|
# temporarily use upstream binary, see //cluster/tools/BUILD
|
|
http_file(
|
|
name = "calicoctl_3_15",
|
|
downloaded_file_path = "calicoctl",
|
|
executable = True,
|
|
sha256 = "f49e9e8d25108f7f22d5a51c756b2fe40cbe36347ad297e31a767376172f2845",
|
|
urls = ["https://github.com/projectcalico/calicoctl/releases/download/v3.15.5/calicoctl"],
|
|
)
|