Skip to content

Commit

Permalink
introducing update-deps.py, migrating few deps (#2775)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikea authored and jclee committed Oct 11, 2024
1 parent 339a9e7 commit e21cf21
Show file tree
Hide file tree
Showing 15 changed files with 930 additions and 43 deletions.
51 changes: 8 additions & 43 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
workspace(name = "workerd")

load("@//build/deps:gen/build_deps.bzl", build_deps_gen = "deps_gen")

build_deps_gen()

load("@//build/deps:gen/deps.bzl", "deps_gen")

deps_gen()

# ========================================================================================
# Bazel basics

Expand All @@ -8,27 +16,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"

NODE_VERSION = "20.14.0"

http_archive(
name = "bazel_skylib",
sha256 = "9f38886a40548c6e96c106b752f242130ee11aaa068a56ba7e56f4511f33e4f2",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz",
],
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

# Needed for objc_library starting with bazel 7.

http_archive(
name = "build_bazel_apple_support",
sha256 = "c31ce8e531b50ef1338392ee29dd3db3689668701ec3237b9c61e26a1937ab07",
url = "https://github.com/bazelbuild/apple_support/releases/download/1.16.0/apple_support.1.16.0.tar.gz",
)

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
Expand All @@ -44,25 +35,6 @@ bazel_features_deps()
# ========================================================================================
# Simple dependencies

http_archive(
name = "capnp-cpp",
integrity = "sha256-u4TajPQnM3yQIcLUghhNnEUslu0o3q0VdY3jRoPq7yM=",
strip_prefix = "capnproto-capnproto-6446b72/c++",
type = "tgz",
urls = ["https://github.com/capnproto/capnproto/tarball/6446b721a9860eebccf9d3c73b27610491359b5a"],
)

http_archive(
name = "ssl",
integrity = "sha256-fAgiuoIKLTwR0cwrUz6gwiAiSxGsUKtW2XzgtftXswM=",
strip_prefix = "google-boringssl-c08ccc9",
type = "tgz",
# from main-with-bazel branch. Later boringssl versions have bazel support on the main branch,
# so using the custom branch with a different directory structure will no longer be needed in
# the future.
urls = ["https://github.com/google/boringssl/tarball/c08ccc9ed166a82b92edd70ab215ae1f2501e838"],
)

http_archive(
name = "sqlite3",
build_file = "//:build/BUILD.sqlite3",
Expand All @@ -77,13 +49,6 @@ http_archive(
url = "https://sqlite.org/2023/sqlite-src-3440000.zip",
)

http_archive(
name = "rules_python",
integrity = "sha256-d4quqz5s/VbWgcifXBDXrWv40vGnLeneVbIwgbLTFhg=",
strip_prefix = "rules_python-0.34.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
)

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

py_repositories()
Expand Down
34 changes: 34 additions & 0 deletions build/deps/build_deps.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "deps.schema.json",
"repositories": [
{
"name": "bazel_skylib",
"type": "github_release",
"owner": "bazelbuild",
"repo": "bazel-skylib",
"file_regex": "\\.tar\\.gz$"
},
{
"name": "rules_license",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_license",
"file_regex": "\\.tar\\.gz$"
},
{
"name": "rules_python",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_python",
"file_regex": "\\.tar\\.gz$"
},
{
// Needed for objc_library starting with bazel 7
"name": "build_bazel_apple_support",
"type": "github_release",
"owner": "bazelbuild",
"repo": "apple_support",
"file_regex": "\\.tar\\.gz$"
}
]
}
22 changes: 22 additions & 0 deletions build/deps/deps.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "deps.schema.json",
"repositories": [
{
"name": "capnp-cpp",
"type": "github_tarball",
"owner": "capnproto",
"repo": "capnproto",
"branch": "v2",
"extra_strip_prefix": "/c++"
},
{
"name": "ssl",
"type": "github_tarball",
"owner": "google",
"repo": "boringssl",
"branch": "master-with-bazel",
// todo: head requires a trivial fix
"freeze_commit": "c08ccc9ed166a82b92edd70ab215ae1f2501e838"
}
]
}
203 changes: 203 additions & 0 deletions build/deps/deps.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Dependencies",
"description": "Description of external dependencies for the project",
"type": "object",
"properties": {
"repositories": {
"type": "array",
"items": {
"type": "object",
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"const": "github_tarball"
},
"name": {
"type": "string"
},
"owner": {
"type": "string"
},
"repo": {
"type": "string"
},
"freeze_commit": {
"type": "string"
},
"freeze_sha256": {
"type": "string"
},
"build_file": {
"type": "string"
},
"build_file_content": {
"type": "string"
},
"patches": {
"type": "array",
"items": {
"type": "string"
}
},
"repo_mapping": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"branch": {
"type": "string"
},
"extra_strip_prefix": {
"type": "string"
}
},
"required": [
"type",
"name",
"owner",
"repo"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"const": "github_release"
},
"name": {
"type": "string"
},
"owner": {
"type": "string"
},
"repo": {
"type": "string"
},
"file_regex": {
"type": "string"
},
"file_type": {
"type": "string",
"enum": [
"archive",
"executable"
]
},
"freeze_version": {
"type": "string"
},
"freeze_sha256": {
"type": "string"
},
"strip_prefix": {
"type": "string"
},
"build_file": {
"type": "string"
},
"build_file_content": {
"type": "string"
},
"patches": {
"type": "array",
"items": {
"type": "string"
}
},
"repo_mapping": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": [
"type",
"name",
"owner",
"repo",
"file_regex"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"const": "git_clone"
},
"name": {
"type": "string"
},
"url": {
"type": "string"
},
"branch": {
"type": "string"
},
"build_file": {
"type": "string"
},
"build_file_content": {
"type": "string"
},
"freeze_commit": {
"type": "string"
},
"patches": {
"type": "array",
"items": {
"type": "string"
}
},
"repo_mapping": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": [
"type",
"name",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"const": "crate"
},
"name": {
"type": "string"
},
"build_file": {
"type": "string"
},
"freeze_version": {
"type": "string"
}
},
"required": [
"type",
"name",
"build_file"
],
"additionalProperties": false
}
]
}
}
},
"required": [
"repositories"
]
}
12 changes: 12 additions & 0 deletions build/deps/gen/build_deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//build/deps:gen/dep_bazel_skylib.bzl", "dep_bazel_skylib")
load("@//build/deps:gen/dep_build_bazel_apple_support.bzl", "dep_build_bazel_apple_support")
load("@//build/deps:gen/dep_rules_license.bzl", "dep_rules_license")
load("@//build/deps:gen/dep_rules_python.bzl", "dep_rules_python")

def deps_gen():
dep_bazel_skylib()
dep_rules_license()
dep_rules_python()
dep_build_bazel_apple_support()
18 changes: 18 additions & 0 deletions build/deps/gen/dep_bazel_skylib.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//:build/http.bzl", "http_archive")

TAG_NAME = "1.7.1"
URL = "https://api.github.com/repos/bazelbuild/bazel-skylib/tarball/1.7.1"
STRIP_PREFIX = "bazelbuild-bazel-skylib-27d429d"
SHA256 = "46e81737e39440cc0364d9ad14212c462b0b5b4395ab7ed0d73cb880604a7fe1"
TYPE = "tgz"

def dep_bazel_skylib():
http_archive(
name = "bazel_skylib",
url = URL,
strip_prefix = STRIP_PREFIX,
type = TYPE,
sha256 = SHA256,
)
18 changes: 18 additions & 0 deletions build/deps/gen/dep_build_bazel_apple_support.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//:build/http.bzl", "http_archive")

TAG_NAME = "1.17.0"
URL = "https://api.github.com/repos/bazelbuild/apple_support/tarball/1.17.0"
STRIP_PREFIX = "bazelbuild-apple_support-07dd08d"
SHA256 = "f90a92ad6bdb245523f63dae5e65ebaef7e0087c6651236fc83987cb03937dc3"
TYPE = "tgz"

def dep_build_bazel_apple_support():
http_archive(
name = "build_bazel_apple_support",
url = URL,
strip_prefix = STRIP_PREFIX,
type = TYPE,
sha256 = SHA256,
)
Loading

0 comments on commit e21cf21

Please sign in to comment.