Skip to content

Commit

Permalink
rust: Use a single lock file for site deps
Browse files Browse the repository at this point in the history
See also:
  https://earthly.dev/blog/rust-monorepo/

Change-Id: I0deb17f7b0644df2b306586782ba1026cf20a793
  • Loading branch information
Synss committed Sep 19, 2024
1 parent d13b386 commit 9b48a19
Show file tree
Hide file tree
Showing 8 changed files with 9,010 additions and 11,794 deletions.
2,397 changes: 2,397 additions & 0 deletions Cargo.site.lock

Large diffs are not rendered by default.

11,918 changes: 6,571 additions & 5,347 deletions packages/check-http/Cargo.lock.bazel → Cargo.site.lock.bazel

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Cargo.site.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Cargo.toml file used to lock the deps for bazel.
#
# See Also:
# https://earthly.dev/blog/rust-monorepo/

[workspace]
members = [
"packages/check-cert",
"packages/check-http",
]
45 changes: 30 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ http_archive(
],
)

load("//omd/packages/rules:cargo_deps.bzl", "cargo_deps")
load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
load("//omd/packages/rules:rust_workspace.bzl", "rust_workspace")

rust_workspace()
Expand All @@ -58,23 +58,38 @@ rules_pkg_dependencies()
# | |
# '----------------------------------------------------------------------'

cargo_deps(
name = "check-cert-deps",
package = "packages/check-cert",
)

load("@check-cert-deps//:defs.bzl", check_cert_deps = "crate_repositories")

check_cert_deps()

cargo_deps(
name = "check-http-deps",
package = "packages/check-http",
# Repin with `CARGO_BAZEL_REPIN=1 bazel sync --only=cargo_deps_site`.
crates_repository(
# Repository for rust binaries or libraries deployed in the site.
name = "cargo_deps_site",
annotations = {
"openssl-sys": [
crate.annotation(
build_script_data = [
"@openssl//:gen_dir",
],
build_script_env = {
"OPENSSL_DIR": "$(execpath @openssl//:gen_dir)",
"OPENSSL_NO_VENDOR": "1",
},
deps = [
"@openssl//:openssl_shared",
],
),
],
},
cargo_lockfile = "//:Cargo.site.lock",
lockfile = "//:Cargo.site.lock.bazel",
manifests = [
"//:Cargo.site.toml",
"//packages/check-cert:Cargo.toml",
"//packages/check-http:Cargo.toml",
],
)

load("@check-http-deps//:defs.bzl", check_http_deps = "crate_repositories")
load("@cargo_deps_site//:defs.bzl", site_crate_repository = "crate_repositories")

check_http_deps()
site_crate_repository()

load("//omd/packages/patch:patch_http.bzl", "patch_workspace")

Expand Down
26 changes: 0 additions & 26 deletions omd/packages/rules/cargo_deps.bzl

This file was deleted.

4 changes: 1 addition & 3 deletions packages/check-cert/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# //packages/check-cert:check-cert

load("@check-cert-deps//:defs.bzl", "aliases", "all_crate_deps")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
load("@cargo_deps_site//:defs.bzl", "aliases", "all_crate_deps")

rust_library(
name = "check-cert-lib",
Expand Down
Loading

0 comments on commit 9b48a19

Please sign in to comment.