Skip to content

Commit a86e7cd

Browse files
authored
Merge pull request #5 from stackb/pcj/label-fixes-wip
Avoid self references to @io_bazel_rules_closure
2 parents 88d6c5e + d759b14 commit a86e7cd

142 files changed

Lines changed: 1473 additions & 186 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# Compile/run with Java 21
2-
build --java_language_version=21
1+
# Enable Java 21
32
build --java_runtime_version=21
3+
build --java_language_version=21
44
build --tool_java_language_version=21
55
build --tool_java_runtime_version=21
66

7-
build --experimental_proto_descriptor_sets_include_source_info
8-
97
# Don't leak PATH and LD_LIBRARY_PATH into the build.
108
build --incompatible_strict_action_env
119

MODULE.bazel

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module(
99
# -------------------------------------------------------------------
1010

1111
bazel_dep(name = "bazel_skylib", version = "1.8.2")
12-
bazel_dep(name = "build_stack_rules_proto", version = "4.1.0")
12+
bazel_dep(name = "build_stack_rules_proto", version = "4.1.1")
1313
bazel_dep(name = "closure-templates", version = "1.0.1")
1414
bazel_dep(name = "google_bazel_common", version = "0.0.1")
1515
bazel_dep(name = "platforms", version = "1.0.0")
@@ -20,10 +20,18 @@ bazel_dep(name = "rules_shell", version = "0.6.1")
2020
bazel_dep(name = "rules_jvm_external", version = "6.8")
2121
bazel_dep(name = "rules_proto", version = "7.1.0")
2222
bazel_dep(name = "rules_python", version = "1.5.3")
23-
bazel_dep(name = "rules_tsickle", version = "1.0.0")
23+
bazel_dep(name = "rules_tsickle", version = "1.1.0")
2424
bazel_dep(name = "rules_web_testing_java", version = "0.4.1")
2525
bazel_dep(name = "rules_webtesting", version = "0.4.1")
2626

27+
# google_bazel_common override is needed for @closure-compiler
28+
git_override(
29+
module_name = "google_bazel_common",
30+
# Pin to newer version to fix b/408030907
31+
commit = "2cab52929507935aa43d460a3976d3bedc814d3a",
32+
remote = "https://github.com/google/bazel-common",
33+
)
34+
2735
# -------------------------------------------------------------------
2836
# Overrides
2937
# -------------------------------------------------------------------
@@ -45,6 +53,21 @@ archive_override(
4553
patch_strip = 1,
4654
)
4755

56+
# Commit: 04fc63fb40bf30d2e5e0b3786028eb41218de979
57+
# Date: 2025-10-09 04:43:15 +0000 UTC
58+
# URL: https://github.com/stackb/rules_proto/commit/04fc63fb40bf30d2e5e0b3786028eb41218de979
59+
#
60+
# Remove lock file for @maven
61+
#
62+
# It is shared by multiple workspaces and seems to cause problems when locked
63+
# Size: 4088796 (4.1 MB)
64+
archive_override(
65+
module_name = "build_stack_rules_proto",
66+
sha256 = "aff21579deef91316c726582bec71c621dde2ae2ec74099a55b637bda8997333",
67+
strip_prefix = "rules_proto-04fc63fb40bf30d2e5e0b3786028eb41218de979",
68+
urls = ["https://github.com/stackb/rules_proto/archive/04fc63fb40bf30d2e5e0b3786028eb41218de979.tar.gz"],
69+
)
70+
4871
# -------------------------------------------------------------------
4972
# additional http dependencies
5073
# -------------------------------------------------------------------
@@ -121,12 +144,36 @@ platform_http_file(
121144
],
122145
)
123146

147+
# -------------------------------------------------------------------
148+
# java configuration
149+
# -------------------------------------------------------------------
150+
151+
# Compatibility layer
152+
compat = use_extension("@rules_java//java:rules_java_deps.bzl", "compatibility_proxy")
153+
use_repo(compat, "compatibility_proxy")
154+
124155
# -------------------------------------------------------------------
125156
# maven configuration
126157
# -------------------------------------------------------------------
127158

128159
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
160+
161+
# NOTE: even though we isolate OUR maven deps into a separate namespace, we
162+
# still need the ones from other contributing modules. That is why this
163+
# maven.install() declaration exists, and I am surprised bzlmod /
164+
# rules_jvm_external works this way.
165+
maven.install(
166+
name = "maven",
167+
known_contributing_modules = [
168+
"build_stack_rules_proto",
169+
"grpc-java",
170+
"io_bazel_rules_closure",
171+
"protobuf",
172+
"rules_web_testing_java",
173+
],
174+
)
129175
maven.install(
176+
name = "maven_rules_closure",
130177
artifacts = [
131178
"args4j:args4j:2.33",
132179
"com.google.closure-stylesheets:closure-stylesheets:1.5.0",
@@ -138,14 +185,18 @@ maven.install(
138185
"org.seleniumhq.selenium:selenium-api:4.27.0",
139186
"org.seleniumhq.selenium:selenium-support:4.27.0",
140187
],
188+
lock_file = "//:maven_rules_closure_install.json",
141189
)
142190
maven.artifact(
191+
name = "maven_rules_closure",
143192
artifact = "closure-compiler",
144193
group = "com.google.javascript",
145-
version = "v20250402", # Using maven.artifact here because the version number vxxxxx cannot parsed correctly.
194+
# version = "v20250402", # Using maven.artifact here because the version number vxxxxx cannot parsed correctly.
195+
version = "v20250820", # Using maven.artifact here because the version number vxxxxx cannot parsed correctly.
146196
)
147197
maven.override(
198+
name = "maven_rules_closure",
148199
coordinates = "javacc:javacc",
149-
target = "@maven//:net_java_dev_javacc_javacc", # javacc:javacc was not updated since 2008 and relocated to net.java.dev.javacc
200+
target = "@maven_rules_closure//:net_java_dev_javacc_javacc", # javacc:javacc was not updated since 2008 and relocated to net.java.dev.javacc
150201
)
151-
use_repo(maven, "maven")
202+
use_repo(maven, "maven_rules_closure")

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Please see the test directories within this project for concrete examples of usa
106106
## closure\_js\_library
107107

108108
```starlark
109-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
109+
load("//closure:defs.bzl", "closure_js_library")
110110
closure_js_library(name, srcs, data, deps, exports, suppress, convention,
111111
no_closure_library)
112112
```
@@ -206,7 +206,7 @@ This rule can be referenced as though it were the following:
206206
## closure\_js\_binary
207207

208208
```starlark
209-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary")
209+
load("//closure:defs.bzl", "closure_js_binary")
210210
closure_js_binary(name, deps, css, debug, language, entry_points,
211211
dependency_mode, compilation_level, formatting,
212212
output_wrapper, property_renaming_report, defs)
@@ -340,7 +340,7 @@ closure_js_binary(
340340
## closure\_js\_test
341341

342342
```starlark
343-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_test")
343+
load("//closure:defs.bzl", "closure_js_test")
344344
closure_js_test(name, srcs, data, deps, css, html, language, suppress,
345345
compilation_level, entry_points, defs)
346346
```
@@ -412,7 +412,7 @@ This rule can be referenced as though it were the following:
412412
## phantomjs\_test
413413

414414
```starlark
415-
load("@io_bazel_rules_closure//closure:defs.bzl", "phantomjs_test")
415+
load("//closure:defs.bzl", "phantomjs_test")
416416
phantomjs_test(name, data, deps, html, harness, runner)
417417
```
418418

@@ -460,7 +460,7 @@ This rule can be referenced as though it were the following:
460460
## closure\_css\_library
461461

462462
```starlark
463-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_library")
463+
load("//closure:defs.bzl", "closure_css_library")
464464
closure_css_library(name, srcs, data, deps)
465465
```
466466

@@ -523,7 +523,7 @@ This rule can be referenced as though it were the following:
523523
## closure\_css\_binary
524524

525525
```starlark
526-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_binary")
526+
load("//closure:defs.bzl", "closure_css_binary")
527527
closure_css_binary(name, deps, renaming, debug, defs)
528528
```
529529

closure/compiler/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ licenses(["notice"])
2121

2222
java_library(
2323
name = "compiler",
24-
exports = ["@maven//:com_google_javascript_closure_compiler"],
24+
exports = ["@maven_rules_closure//:com_google_javascript_closure_compiler"],
2525
)
2626

2727
bzl_library(

closure/compiler/closure_js_library.bzl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ load(
2525
"ClosureJsLibraryInfo",
2626
"JS_FILE_TYPE",
2727
"JS_LANGUAGE_IN",
28+
"JS_OR_ZIP_FILE_TYPE",
2829
"collect_js",
2930
"collect_runfiles",
3031
"convert_path_to_es6_module_name",
@@ -72,6 +73,9 @@ def create_closure_js_library(
7273
but also propagate up to closure_js_binary.
7374
lenient: makes the library lenient which suppresses handful of checkings in
7475
one shot.
76+
convention: naming convention for the library (default: "CLOSURE")
77+
internal_descriptors: depset of protobuf descriptor files
78+
artifact_suffix: suffix to append to generated artifact names
7579
7680
Returns:
7781
A closure_js_library metadata struct with exports and closure_js_library attribute
@@ -202,10 +206,6 @@ def _closure_js_library_impl(
202206
args.add("--output_ijs_file", ijs_file)
203207
args.add("--convention", convention)
204208

205-
# Because JsChecker is an edge in the build graph, we need to declare all of
206-
# its input vertices.
207-
inputs = []
208-
209209
# We want to test the failure conditions of this rule from within Bazel,
210210
# rather than from a meta-system like shell scripts. In order to do that, we
211211
# need a way to toggle the return status of the process.
@@ -375,12 +375,14 @@ def _closure_js_library(ctx):
375375
if not ctx.files.srcs and (ctx.attr.suppress or ctx.attr.lenient):
376376
fail("'srcs' must be set when using 'suppress' or 'lenient'")
377377
if ctx.attr.language:
378+
# buildifier: disable=print
378379
print("The closure_js_library 'language' attribute is now removed and " +
379380
"is always set to " + JS_LANGUAGE_IN)
380381

381382
# Create a list of the sources defined by this specific rule.
382383
srcs = ctx.files.srcs
383384
if ctx.files.externs:
385+
# buildifier: disable=print
384386
print("closure_js_library 'externs' is deprecated; just use 'srcs'")
385387
srcs = ctx.files.externs + srcs
386388

@@ -438,7 +440,7 @@ closure_js_library = rule(
438440
),
439441
"includes": attr.string_list(),
440442
"no_closure_library": attr.bool(),
441-
"srcs": attr.label_list(allow_files = JS_FILE_TYPE),
443+
"srcs": attr.label_list(allow_files = JS_OR_ZIP_FILE_TYPE),
442444
"suppress": attr.string_list(),
443445
"lenient": attr.bool(),
444446

closure/compiler/test/app/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile")
22
load(
3-
"@io_bazel_rules_closure//closure:defs.bzl",
3+
"//closure:defs.bzl",
44
"closure_css_binary",
55
"closure_css_library",
66
"closure_js_binary",
77
"closure_js_library",
88
"closure_js_template_library",
99
"web_library",
1010
)
11-
load("@io_bazel_rules_closure//closure/protobuf:defs.bzl", "closure_jspb_library")
11+
load("//closure/protobuf:defs.bzl", "closure_jspb_library")
1212

1313
package(default_testonly = True)
1414

closure/goog/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# They are too different to attempt a copybara transform between them.
33
# This file is used in the closure-library repo by external Bazel users (via io_bazel_rules_closure)
44

5-
load("@io_bazel_rules_closure//closure/compiler:closure_base_js_library.bzl", "closure_base_js_library")
5+
load("//closure/compiler:closure_base_js_library.bzl", "closure_base_js_library")
66

77
package(default_visibility = ["//visibility:public"])
88

closure/goog/a11y/aria/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
1+
load("//closure:defs.bzl", "closure_js_library")
22

33
package(default_visibility = ["//visibility:public"])
44

closure/goog/array/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
1+
load("//closure:defs.bzl", "closure_js_library")
22

33
package(default_visibility = ["//visibility:public"])
44

closure/goog/asserts/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
1+
load("//closure:defs.bzl", "closure_js_library")
22

33
package(default_visibility = ["//visibility:public"])
44

0 commit comments

Comments
 (0)