chore: centralize bun version and release URL constants
This commit is contained in:
committed by
copilot-swe-agent[bot]
parent
6a29ae954e
commit
97c63c68f6
@@ -1,35 +1,36 @@
|
|||||||
load(":toolchain.bzl", "bun_toolchain")
|
load(":toolchain.bzl", "bun_toolchain")
|
||||||
|
load(":version.bzl", "BUN_VERSION")
|
||||||
|
|
||||||
toolchain_type(name = "toolchain_type")
|
toolchain_type(name = "toolchain_type")
|
||||||
|
|
||||||
bun_toolchain(
|
bun_toolchain(
|
||||||
name = "linux_x64_toolchain_impl",
|
name = "linux_x64_toolchain_impl",
|
||||||
bun = "@bun_linux_x64//:bun",
|
bun = "@bun_linux_x64//:bun",
|
||||||
version = "1.1.38",
|
version = BUN_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
bun_toolchain(
|
bun_toolchain(
|
||||||
name = "linux_aarch64_toolchain_impl",
|
name = "linux_aarch64_toolchain_impl",
|
||||||
bun = "@bun_linux_aarch64//:bun",
|
bun = "@bun_linux_aarch64//:bun",
|
||||||
version = "1.1.38",
|
version = BUN_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
bun_toolchain(
|
bun_toolchain(
|
||||||
name = "darwin_x64_toolchain_impl",
|
name = "darwin_x64_toolchain_impl",
|
||||||
bun = "@bun_darwin_x64//:bun",
|
bun = "@bun_darwin_x64//:bun",
|
||||||
version = "1.1.38",
|
version = BUN_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
bun_toolchain(
|
bun_toolchain(
|
||||||
name = "darwin_aarch64_toolchain_impl",
|
name = "darwin_aarch64_toolchain_impl",
|
||||||
bun = "@bun_darwin_aarch64//:bun",
|
bun = "@bun_darwin_aarch64//:bun",
|
||||||
version = "1.1.38",
|
version = BUN_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
bun_toolchain(
|
bun_toolchain(
|
||||||
name = "windows_x64_toolchain_impl",
|
name = "windows_x64_toolchain_impl",
|
||||||
bun = "@bun_windows_x64//:bun",
|
bun = "@bun_windows_x64//:bun",
|
||||||
version = "1.1.38",
|
version = BUN_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
toolchain(
|
toolchain(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
load(":version.bzl", "BUN_VERSION")
|
||||||
_BUN_VERSION = "1.1.38"
|
|
||||||
|
|
||||||
_BUN_ARCHIVES = {
|
_BUN_ARCHIVES = {
|
||||||
"bun_linux_x64": {
|
"bun_linux_x64": {
|
||||||
@@ -30,6 +29,8 @@ _BUN_ARCHIVES = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_BUN_GITHUB_RELEASE_URL_TEMPLATE = "https://github.com/oven-sh/bun/releases/download/bun-v{}/{}"
|
||||||
|
|
||||||
|
|
||||||
def _declare_bun_repo(name, asset, sha256, binary, version):
|
def _declare_bun_repo(name, asset, sha256, binary, version):
|
||||||
if native.existing_rule(name):
|
if native.existing_rule(name):
|
||||||
@@ -37,7 +38,7 @@ def _declare_bun_repo(name, asset, sha256, binary, version):
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = name,
|
name = name,
|
||||||
urls = ["https://github.com/oven-sh/bun/releases/download/bun-v{}/{}".format(version, asset)],
|
urls = [_BUN_GITHUB_RELEASE_URL_TEMPLATE.format(version, asset)],
|
||||||
sha256 = sha256,
|
sha256 = sha256,
|
||||||
build_file_content = """
|
build_file_content = """
|
||||||
exports_files(["{binary}"])
|
exports_files(["{binary}"])
|
||||||
@@ -51,7 +52,7 @@ filegroup(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def bun_repositories(version = _BUN_VERSION):
|
def bun_repositories(version = BUN_VERSION):
|
||||||
for name, metadata in _BUN_ARCHIVES.items():
|
for name, metadata in _BUN_ARCHIVES.items():
|
||||||
_declare_bun_repo(
|
_declare_bun_repo(
|
||||||
name = name,
|
name = name,
|
||||||
@@ -62,7 +63,7 @@ def bun_repositories(version = _BUN_VERSION):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def bun_register_toolchains(version = _BUN_VERSION):
|
def bun_register_toolchains(version = BUN_VERSION):
|
||||||
bun_repositories(version = version)
|
bun_repositories(version = version)
|
||||||
native.register_toolchains(
|
native.register_toolchains(
|
||||||
"//bun:darwin_aarch64_toolchain",
|
"//bun:darwin_aarch64_toolchain",
|
||||||
|
|||||||
1
bun/version.bzl
Normal file
1
bun/version.bzl
Normal file
@@ -0,0 +1 @@
|
|||||||
|
BUN_VERSION = "1.1.38"
|
||||||
Reference in New Issue
Block a user