1
0
Fork 0

Make golang deps fetching go faster

This commit aims to increase the speed of hscloud rebuild process
by optimizing the behavior of Go dependency fetching routines.

Gazelle v0.25.0 introduced a new dependency resolution mode
where it does not reach out for external dependencies; instead,
it operates solely on what is contained inside the workspace.

Because static dependency resolution mode is now the default
behavior in go_repository() rules, we are also updating the
contents of //third_party/go/repositories.bzl.

Also, I changed some of the bigger Go dependencies to be downloaded
by a tarball fetch in order to speed up the rebuild process.

Other changes:
  * Bump nixpkgs to a fresh snapshot
  * Upgrade to Bazel v5

Change-Id: Icfe752411b3128bcd5b25fa28bb76bec45ae2f71
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1441
Reviewed-by: q3k <q3k@hackerspace.pl>
master
patryk 2022-11-26 21:33:38 +01:00 committed by patryk
parent d171263d6e
commit 28742b8106
4 changed files with 1627 additions and 351 deletions

View File

@ -29,22 +29,36 @@ http_archive(
# Download Go/Gazelle rules
http_archive(
name = "io_bazel_rules_go",
sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b",
sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
],
)
http_archive(
name = "bazel_gazelle",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
sha256 = "448e37e0dbf61d6fa8f00aaa12d191745e14f07c31cabfa731f0c8e8a4f41b97",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz",
],
)
# Gazelle started requiring this after we bumped the version to v0.28.0.
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()
# Python rules
# Important: rules_python must be loaded before protobuf (and grpc) because they load an older version otherwise
load("@rules_python//python:pip.bzl", "pip_parse")
@ -61,7 +75,7 @@ install_deps()
# Setup Go toolchain.
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains")
go_register_toolchains(version = "1.17")
go_register_toolchains(version = "1.18.3")
# IMPORTANT: match protobuf version above with the one loaded by grpc
http_archive(

View File

@ -8,14 +8,20 @@ let
readTree = import ./nix/readtree {};
# Tracking nixos-unstable as of 2021-08-11.
nixpkgsCommit = "e26c0ffdb013cd378fc2528a44689a8bf35d2a6c";
nixpkgsCommit = "42aae6fa748a41ced37373fc6d914de512658178";
nixpkgsSrc = fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz";
sha256 = "1b33hw35fqb9rzszdg5jpiyfvhx2cxpv0qrkyr19zkdpdahzdbss";
sha256 = "I7oAGC1Ldm5kcryUQxLubMmMCj5o0n+JSLVGRCL0wm8=";
};
nixpkgs = import nixpkgsSrc {
config.allowUnfree = true;
config.allowBroken = true;
# Nixpkgs marked this package as insecure.
# We need it for HTML-to-PDF conversion.
config.permittedInsecurePackages = [
"qtwebkit-5.212.0-alpha4"
];
};
resForPkgs = pkgs: fix (self: (readTree rec {

View File

@ -42,7 +42,7 @@ in with hscloud.pkgs; let
in (pkgs.buildFHSUserEnv {
name = "hscloud-build";
targetPkgs = pkgs: with pkgs; [
bazel_4
bazel_5
postgresql
python38
openjdk11

File diff suppressed because it is too large Load Diff