Remove Bazel WORKSPACE setup. (#8509)

This commit is contained in:
Marcel
2025-01-24 19:16:10 +01:00
committed by GitHub
parent 65e49faf76
commit 82fefbf252
12 changed files with 2 additions and 324 deletions

View File

@@ -2,7 +2,6 @@
buildifier: latest buildifier: latest
matrix: matrix:
bazel: bazel:
- 6.x
- 7.x - 7.x
- 8.x - 8.x
tasks: tasks:

View File

@@ -32,7 +32,6 @@ filegroup(
".npmrc", ".npmrc",
"BUILD.bazel", "BUILD.bazel",
"MODULE.bazel", "MODULE.bazel",
"WORKSPACE",
"build_defs.bzl", "build_defs.bzl",
"package.json", "package.json",
"pnpm-lock.yaml", "pnpm-lock.yaml",

189
WORKSPACE
View File

@@ -1,189 +0,0 @@
workspace(name = "com_github_google_flatbuffers")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "platforms",
sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
],
)
# Import our own version of skylib before other rule sets (e.g. rules_swift)
# has a chance to import an old version.
http_archive(
name = "bazel_skylib",
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
http_archive(
name = "build_bazel_rules_apple",
sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz",
)
load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)
apple_rules_dependencies()
http_archive(
name = "build_bazel_rules_swift",
sha256 = "b1de723ff0dc433ac4ddfc6a7e8635bd4fb10c44d42d20a433de854196777f3d",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.10.1/rules_swift.1.10.1.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
http_archive(
name = "io_bazel_rules_go",
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")
go_rules_dependencies()
##### Protobuf
_PROTOBUF_VERSION = "3.15.2"
http_archive(
name = "com_google_protobuf",
strip_prefix = "protobuf-" + _PROTOBUF_VERSION,
urls = [
"https://github.com/protocolbuffers/protobuf/archive/v" + _PROTOBUF_VERSION + ".tar.gz",
],
)
#### Building boring ssl
# Fetching boringssl within the flatbuffers repository, to patch the issue
# of not being able to upgrade to Xcode 14.3 due to buildkite throwing errors
# which was patched in the following below.
# https://github.com/google/flatbuffers/commit/67eb95de9281087ccbba9aafd6e8ab1958d12045
# The patch was copied from the following comment on the same issue within tensorflow
# and fixed to adapt the already existing patch for boringssl.
# https://github.com/tensorflow/tensorflow/issues/60191#issuecomment-1496073147
http_archive(
name = "boringssl",
patch_args = ["-p1"],
patches = ["//grpc:boringssl.patch"],
# Use github mirror instead of https://boringssl.googlesource.com/boringssl
# to obtain a boringssl archive with consistent sha256
sha256 = "534fa658bd845fd974b50b10f444d392dfd0d93768c4a51b61263fd37d851c40",
strip_prefix = "boringssl-b9232f9e27e5668bc0414879dcdedb2a59ea75f2",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
"https://github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
],
)
##### GRPC
_GRPC_VERSION = "1.49.0" # https://github.com/grpc/grpc/releases/tag/v1.48.0
http_archive(
name = "com_github_grpc_grpc",
patch_args = ["-p1"],
patches = ["//grpc:build_grpc_with_cxx14.patch"],
sha256 = "15715e1847cc9e42014f02c727dbcb48e39dbdb90f79ad3d66fe4361709ff935",
strip_prefix = "grpc-" + _GRPC_VERSION,
urls = ["https://github.com/grpc/grpc/archive/refs/tags/v" + _GRPC_VERSION + ".tar.gz"],
)
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()
# rules_go from https://github.com/bazelbuild/rules_go/releases/tag/v0.34.0
http_archive(
name = "aspect_rules_js",
sha256 = "875b8d01af629dbf626eddc5cf239c9f0da20330f4d99ad956afc961096448dd",
strip_prefix = "rules_js-2.1.3",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.3/rules_js-v2.1.3.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//npm:repositories.bzl", "pnpm_repository")
pnpm_repository(name = "pnpm")
http_archive(
name = "aspect_rules_ts",
sha256 = "013a10b2b457add73b081780e604778eb50a141709f9194298f97761acdcc169",
strip_prefix = "rules_ts-3.4.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.4.0/rules_ts-v3.4.0.tar.gz",
)
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
rules_ts_dependencies(
# Since rules_ts doesn't always have the newest integrity hashes, we
# compute it manually here.
# $ curl --silent https://registry.npmjs.org/typescript/5.3.3 | jq ._integrity
ts_integrity = "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
ts_version_from = "//:package.json",
)
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)
load("@com_github_google_flatbuffers//ts:repositories.bzl", "flatbuffers_npm")
flatbuffers_npm(
name = "flatbuffers_npm",
)
load("@flatbuffers_npm//:repositories.bzl", "npm_repositories")
npm_repositories()
http_archive(
name = "aspect_rules_esbuild",
sha256 = "550e33ddeb86a564b22b2c5d3f84748c6639b1b2b71fae66bf362c33392cbed8",
strip_prefix = "rules_esbuild-0.21.0",
url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.21.0/rules_esbuild-v0.21.0.tar.gz",
)
# Register a toolchain containing esbuild npm package and native bindings
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
esbuild_register_toolchains(
name = "esbuild",
esbuild_version = LATEST_ESBUILD_VERSION,
)

View File

@@ -1,3 +0,0 @@
# This file is needed during the transition to Bzlmod
# Remove this file if we only support Bazel 8+ which
# defaults to --enable_workspace=false.

View File

@@ -7,19 +7,13 @@ Rules for building C++ flatbuffers with Bazel.
load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_cc//cc:defs.bzl", "cc_library")
def repo_name(label):
if hasattr(label, "repo_name"): # Added in Bazel 7.1
return label.repo_name
else:
return "com_github_google_flatbuffers"
TRUE_FLATC_PATH = Label("//:flatc") TRUE_FLATC_PATH = Label("//:flatc")
DEFAULT_INCLUDE_PATHS = [ DEFAULT_INCLUDE_PATHS = [
"./", "./",
"$(GENDIR)", "$(GENDIR)",
"$(BINDIR)", "$(BINDIR)",
"$(execpath %s).runfiles/%s" % (TRUE_FLATC_PATH, repo_name(TRUE_FLATC_PATH)), "$(execpath %s).runfiles/%s" % (TRUE_FLATC_PATH, TRUE_FLATC_PATH.repo_name),
] ]
def default_include_paths(flatc_path): def default_include_paths(flatc_path):
@@ -27,7 +21,7 @@ def default_include_paths(flatc_path):
"./", "./",
"$(GENDIR)", "$(GENDIR)",
"$(BINDIR)", "$(BINDIR)",
"$(execpath %s).runfiles/%s" % (flatc_path, repo_name(flatc_path)), "$(execpath %s).runfiles/%s" % (flatc_path, flatc_path.repo_name),
] ]
DEFAULT_FLATC_ARGS = [ DEFAULT_FLATC_ARGS = [

View File

@@ -1,8 +1,3 @@
This directory is not intended to be used independently of the flatbuffers This directory is not intended to be used independently of the flatbuffers
repository. Instead, this whole directory serves as a unit test for the repository. Instead, this whole directory serves as a unit test for the
C++ integration in the flatbuffers repo. C++ integration in the flatbuffers repo.
Run this test from the top-level of the flatbuffers repo.
```console
$ bazel test //tests:bazel_repository_test
```

View File

@@ -1,6 +0,0 @@
workspace(name = "bazel_repository_test")
local_repository(
name = "com_github_google_flatbuffers",
path = "../../",
)

View File

@@ -1,3 +0,0 @@
# This file is needed during the transition to Bzlmod
# Remove this file if we only support Bazel 8+ which
# defaults to --enable_workspace=false.

View File

@@ -1,82 +0,0 @@
workspace(name = "bazel_repository_test")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
local_repository(
name = "com_github_google_flatbuffers",
path = "../../../",
)
http_archive(
name = "aspect_rules_js",
sha256 = "875b8d01af629dbf626eddc5cf239c9f0da20330f4d99ad956afc961096448dd",
strip_prefix = "rules_js-2.1.3",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.3/rules_js-v2.1.3.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock", "pnpm_repository")
pnpm_repository(name = "pnpm")
http_archive(
name = "aspect_rules_ts",
sha256 = "013a10b2b457add73b081780e604778eb50a141709f9194298f97761acdcc169",
strip_prefix = "rules_ts-3.4.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.4.0/rules_ts-v3.4.0.tar.gz",
)
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
rules_ts_dependencies(
# curl --silent https://registry.npmjs.org/typescript/5.0.3 | jq ._integrity
ts_integrity = "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
ts_version = "5.3.3",
)
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)
npm_translate_lock(
name = "npm",
data = [
"//:package.json",
],
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
update_pnpm_lock = False,
verify_node_modules_ignored = "//:.bazelignore",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
http_archive(
name = "aspect_rules_esbuild",
sha256 = "550e33ddeb86a564b22b2c5d3f84748c6639b1b2b71fae66bf362c33392cbed8",
strip_prefix = "rules_esbuild-0.21.0",
url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.21.0/rules_esbuild-v0.21.0.tar.gz",
)
# Register a toolchain containing esbuild npm package and native bindings
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
esbuild_register_toolchains(
name = "esbuild",
esbuild_version = LATEST_ESBUILD_VERSION,
)
load("@com_github_google_flatbuffers//ts:repositories.bzl", "flatbuffers_npm")
flatbuffers_npm(
name = "flatbuffers_npm",
)
load("@flatbuffers_npm//:repositories.bzl", flatbuffers_npm_repositories = "npm_repositories")
flatbuffers_npm_repositories()

View File

@@ -1,3 +0,0 @@
# This file is needed during the transition to Bzlmod
# Remove this file if we only support Bazel 8+ which
# defaults to --enable_workspace=false.

View File

@@ -8,7 +8,6 @@ filegroup(
"BUILD.bazel", "BUILD.bazel",
"compile_flat_file.sh", "compile_flat_file.sh",
"pnpm-lock.yaml", "pnpm-lock.yaml",
"repositories.bzl",
] + glob([ ] + glob([
"*.ts", "*.ts",
]), ]),

View File

@@ -1,22 +0,0 @@
"""WORKSPACE macro to load flatbuffers's npm package list."""
load("@aspect_rules_js//npm:repositories.bzl", _npm_translate_lock = "npm_translate_lock")
def flatbuffers_npm(name):
_npm_translate_lock(
name = name,
npmrc = "@com_github_google_flatbuffers//:.npmrc",
pnpm_lock = "@com_github_google_flatbuffers//:pnpm-lock.yaml",
# Override the Bazel package where pnpm-lock.yaml is located and link
# to the specified package instead.
root_package = "ts",
# Set this to True when the lock file needs to be updated, commit the
# changes, then set to False again.
# Alternatively, run:
# $ bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only
update_pnpm_lock = False,
verify_node_modules_ignored = "@com_github_google_flatbuffers//:.bazelignore",
data = [
"@com_github_google_flatbuffers//:package.json",
],
)