Skip to content

Commit

Permalink
fix: support --incompatible_disallow_empty_glob (#731)
Browse files Browse the repository at this point in the history
* fix: support --incompatible_disallow_empty_glob

This flag was flipped for Bazel 8

* switch our flag setting

* chore(deps): upgrade stardoc

* chore: docgen

* chore: bump rules_proto
  • Loading branch information
alexeagle authored Nov 1, 2024
1 parent 3849ce6 commit 60a3e9f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import %workspace%/.aspect/bazelrc/performance.bazelrc
common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
common --@aspect_rules_ts//ts:default_to_tsc_transpiler

# We have some empty globs in this repo
common --noincompatible_disallow_empty_glob
# opt-in to flag that is on by default in Bazel 8
common --incompatible_disallow_empty_glob

# Never Compile protoc Again
common --incompatible_enable_proto_toolchain_resolution
Expand Down
9 changes: 1 addition & 8 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True
bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "rules_go", version = "0.46.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_nodejs", version = "6.2.0", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "toolchains_protoc", version = "0.3.0", dev_dependency = True)

# Should not be required, stardoc leaks a dependency
Expand All @@ -38,13 +38,6 @@ register_toolchains(
dev_dependency = True,
)

# pick up fix: https://github.com/bazelbuild/stardoc/pull/221
git_override(
module_name = "stardoc",
commit = "3baa5d1761970c6285d2ac9c3adccfaac42f54c5",
remote = "https://github.com/bazelbuild/stardoc.git",
)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
Expand Down
2 changes: 2 additions & 0 deletions docs/proto.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Future work
## ts_proto_library

<pre>
load("@aspect_rules_ts//ts:proto.bzl", "ts_proto_library")

ts_proto_library(<a href="#ts_proto_library-name">name</a>, <a href="#ts_proto_library-node_modules">node_modules</a>, <a href="#ts_proto_library-proto">proto</a>, <a href="#ts_proto_library-protoc_gen_options">protoc_gen_options</a>, <a href="#ts_proto_library-gen_connect_es">gen_connect_es</a>, <a href="#ts_proto_library-gen_connect_query">gen_connect_query</a>,
<a href="#ts_proto_library-gen_connect_query_service_mapping">gen_connect_query_service_mapping</a>, <a href="#ts_proto_library-copy_files">copy_files</a>, <a href="#ts_proto_library-proto_srcs">proto_srcs</a>, <a href="#ts_proto_library-files_to_copy">files_to_copy</a>, <a href="#ts_proto_library-kwargs">kwargs</a>)
</pre>
Expand Down
2 changes: 2 additions & 0 deletions docs/repositories.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion docs/rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def rules_ts_internal_deps():

http_archive(
name = "io_bazel_stardoc",
sha256 = "62bd2e60216b7a6fec3ac79341aa201e0956477e7c8f6ccc286f279ad1d96432",
urls = ["https://github.com/bazelbuild/stardoc/releases/download/0.6.2/stardoc-0.6.2.tar.gz"],
sha256 = "fabb280f6c92a3b55eed89a918ca91e39fb733373c81e87a18ae9e33e75023ec",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz",
],
)

http_archive(
Expand All @@ -46,9 +49,9 @@ def rules_ts_internal_deps():

http_archive(
name = "rules_proto",
sha256 = "303e86e722a520f6f326a50b41cfc16b98fe6d1955ce46642a5b7a67c11c0f5d",
strip_prefix = "rules_proto-6.0.0",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
strip_prefix = "rules_proto-6.0.2",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
)

http_archive(
Expand Down
4 changes: 2 additions & 2 deletions ts/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _is_file_missing(label):
"""
file_abs = "%s/%s" % (label.package, label.name)
file_rel = file_abs[len(native.package_name()) + 1:]
file_glob = native.glob([file_rel])
file_glob = native.glob([file_rel], allow_empty = True)
return len(file_glob) == 0

_tsc = "@npm_typescript//:tsc"
Expand Down Expand Up @@ -475,7 +475,7 @@ def _default_srcs(allow_js, resolve_json_module):
include.append("**/*.json")
exclude.extend(["**/package.json", "**/package-lock.json", "**/tsconfig*.json"])

return native.glob(include, exclude)
return native.glob(include, exclude, allow_empty = True)

def _invoke_custom_transpiler(type_str, transpiler, transpile_target_name, srcs, common_kwargs):
if type(transpiler) == "function" or type(transpiler) == "rule":
Expand Down

0 comments on commit 60a3e9f

Please sign in to comment.