Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
common --enable_bzlmod
common --experimental_google_legacy_api

# In Bazel 9, bazel does not allow loading the modules shipped with it by default. This flag allows us to access those.
# The intention is that none of these modules will ship with Bazel in future versions, but this is the only way to
# access these specific modules for now.
# https://blog.jetbrains.com/clion/2025/11/bazelcon-2025/#rules-moving-out-of-the-binary-autoloads-off-in-bazel-9
common --incompatible_autoload_externally=+@rules_cc,+@rules_shell

common --bes_results_url=https://app.buildbuddy.io/invocation/
common --bes_backend=grpcs://remote.buildbuddy.io
common --remote_cache=grpcs://remote.buildbuddy.io
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.2
9.1.1
19 changes: 11 additions & 8 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ module(
version = "1.0",
)

bazel_dep(name = "apple_support", version = "2.5.4", repo_name = "build_bazel_apple_support")
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.21.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.17.1")
bazel_dep(name = "aspect_rules_js", version = "2.3.7")
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
bazel_dep(name = "aspect_rules_js", version = "2.3.8")
bazel_dep(name = "aspect_rules_rollup", version = "2.0.1")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "aspect_rules_ts", version = "3.6.0")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_shell", version = "0.8.0")
bazel_dep(name = "rules_nodejs", version = "6.4.0")
bazel_dep(name = "aspect_rules_ts", version = "3.8.10")
bazel_dep(name = "platforms", version = "1.0.0")

rules_ts_ext = use_extension(
"@aspect_rules_ts//ts:extensions.bzl",
Expand Down Expand Up @@ -46,11 +49,11 @@ maven.install(
)
use_repo(maven, "rules_player_maven")

bazel_dep(name = "rules_android", version = "0.6.5")
bazel_dep(name = "rules_android", version = "0.7.2")

## Rule Dependencies
bazel_dep(name = "rules_swift", version = "2.9.0", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_apple", version = "4.3.3", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "3.6.1", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_apple", version = "4.4.0", repo_name = "build_bazel_rules_apple")

bazel_dep(name = "rules_bazel_integration_test", version = "0.24.1", dev_dependency = True)

Expand Down
864 changes: 722 additions & 142 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions distribution/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_missing_pkgs", "bzlformat_pkg")
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_binary")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//private:maven.bzl", "artifact")

# TODO: We should probably build this for the archive
Expand Down
3 changes: 1 addition & 2 deletions docs/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Public API for distribution related Bazel rules.
<pre>
load("@rules_player//distribution:defs.bzl", "build_constants")

build_constants(<a href="#build_constants-name">name</a>, <a href="#build_constants-constants">constants</a>, <a href="#build_constants-repo_mapping">repo_mapping</a>, <a href="#build_constants-version_file">version_file</a>)
build_constants(<a href="#build_constants-name">name</a>, <a href="#build_constants-constants">constants</a>, <a href="#build_constants-version_file">version_file</a>)
</pre>

**ATTRIBUTES**
Expand All @@ -19,7 +19,6 @@ build_constants(<a href="#build_constants-name">name</a>, <a href="#build_consta
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="build_constants-name"></a>name | A unique name for this repository. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="build_constants-constants"></a>constants | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="build_constants-repo_mapping"></a>repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).<br><br>This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | |
| <a id="build_constants-version_file"></a>version_file | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |


8 changes: 4 additions & 4 deletions docs/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ Compiles and links Swift code into a static library and Swift module.
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="swift_library-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="swift_library-deps"></a>deps | A list of targets that are dependencies of the target being built, which will be linked into that target.<br><br>If the Swift toolchain supports implementation-only imports (`private_deps` on `swift_library`), then targets in `deps` are treated as regular (non-implementation-only) imports that are propagated both to their direct and indirect (transitive) dependents.<br><br>Allowed kinds of dependencies are:<br><br>* `swift_library` (or anything propagating `SwiftInfo`)<br><br>* `cc_library` (or anything propagating `CcInfo`)<br><br>Additionally, on platforms that support Objective-C interop, `objc_library` targets (or anything propagating the `apple_common.Objc` provider) are allowed as dependencies. On platforms that do not support Objective-C interop (such as Linux), those dependencies will be **ignored.** | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="swift_library-srcs"></a>srcs | A list of `.swift` source files that will be compiled into the library. | <a href="https://bazel.build/concepts/labels">List of labels</a> | required | |
| <a id="swift_library-deps"></a>deps | A list of targets that are dependencies of the target being built, which will be linked into that target.<br><br>If the Swift toolchain supports implementation-only imports (`private_deps` on `swift_library`), then targets in `deps` are treated as regular (non-implementation-only) imports that are propagated both to their direct and indirect (transitive) dependents.<br><br>Allowed kinds of dependencies are:<br><br>* `swift_library` (or anything propagating `SwiftInfo`)<br><br>* `cc_library` and `objc_library` (or anything propagating `CcInfo`) | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="swift_library-srcs"></a>srcs | A list of `.swift` source files that will be compiled into the library.<br><br>Except in very rare circumstances, a Swift source file should only appear in a single `swift_*` target. Adding the same source file to multiple `swift_*` targets can lead to binary bloat and/or symbol collisions. If specific sources need to be shared by multiple targets, consider factoring them out into their own `swift_library` instead. | <a href="https://bazel.build/concepts/labels">List of labels</a> | required | |
| <a id="swift_library-data"></a>data | The list of files needed by this target at runtime.<br><br>Files and targets named in the `data` attribute will appear in the `*.runfiles` area of this target, if it has one. This may include data files needed by a binary or library, or other programs needed by it. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="swift_library-always_include_developer_search_paths"></a>always_include_developer_search_paths | If `True`, the developer framework search paths will be added to the compilation command. This enables a Swift module to access `XCTest` without having to mark the target as `testonly = True`. | Boolean | optional | `False` |
| <a id="swift_library-alwayslink"></a>alwayslink | If true, any binary that depends (directly or indirectly) on this Swift module will link in all the object files for the files listed in `srcs`, even if some contain no symbols referenced by the binary. This is useful if your code isn't explicitly called by code in the binary; for example, if you rely on runtime checks for protocol conformances added in extensions in the library but do not directly reference any other symbols in the object file that adds that conformance. | Boolean | optional | `False` |
| <a id="swift_library-alwayslink"></a>alwayslink | If `False`, any binary that depends (directly or indirectly) on this Swift module will only link in all the object files for the files listed in `srcs` when there is a direct symbol reference.<br><br>Swift protocol conformances don't create linker references. Likewise, if the Swift code has Objective-C classes/methods, their usage does not always result in linker references.<br><br>_"All the object files"_ for this module is also somewhat fuzzy. Unlike C, C++, and Objective-C, where each source file results in a `.o` file; for Swift the number of .o files depends on the compiler options (`-wmo`/`-whole-module-optimization`, `-num-threads`). That makes relying on linker reference more fragile, and any individual .swift file in `srcs` may/may not get picked up based on the linker references to other files that happen to get batched into a single `.o` by the compiler options used.<br><br>Swift Package Manager always passes the individual `.o` files to the linker instead of using intermediate static libraries, so it effectively is the same as `alwayslink = True`.<br><br>Note that by default, this value will default to True. But if the swift.enable_embedded feature is on, this value will be automatically overridden to False, as the swift features that cause -force_load to be required (such as reflection) are not available in that mode. | Boolean | optional | `True` |
| <a id="swift_library-copts"></a>copts | Additional compiler options that should be passed to `swiftc`. These strings are subject to `$(location ...)` and ["Make" variable](https://docs.bazel.build/versions/master/be/make-variables.html) expansion. | List of strings | optional | `[]` |
| <a id="swift_library-defines"></a>defines | A list of defines to add to the compilation command line.<br><br>Note that unlike C-family languages, Swift defines do not have values; they are simply identifiers that are either defined or undefined. So strings in this list should be simple identifiers, **not** `name=value` pairs.<br><br>Each string is prepended with `-D` and added to the command line. Unlike `copts`, these flags are added for the target and every target that depends on it, so use this attribute with caution. It is preferred that you add defines directly to `copts`, only using this feature in the rare case that a library needs to propagate a symbol up to those that depend on it. | List of strings | optional | `[]` |
| <a id="swift_library-generated_header_name"></a>generated_header_name | The name of the generated Objective-C interface header. This name must end with a `.h` extension and cannot contain any path separators.<br><br>If this attribute is not specified, then the default behavior is to name the header `${target_name}-Swift.h`.<br><br>This attribute is ignored if the toolchain does not support generating headers. | String | optional | `""` |
Expand All @@ -94,7 +94,7 @@ Compiles and links Swift code into a static library and Swift module.
| <a id="swift_library-module_name"></a>module_name | The name of the Swift module being built.<br><br>If left unspecified, the module name will be computed based on the target's build label, by stripping the leading `//` and replacing `/`, `:`, and other non-identifier characters with underscores. | String | optional | `""` |
| <a id="swift_library-package_name"></a>package_name | The semantic package of the Swift target being built. Targets with the same package_name can access APIs using the 'package' access control modifier in Swift 5.9+. | String | optional | `""` |
| <a id="swift_library-plugins"></a>plugins | A list of `swift_compiler_plugin` targets that should be loaded by the compiler when compiling this module and any modules that directly depend on it. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="swift_library-private_deps"></a>private_deps | A list of targets that are implementation-only dependencies of the target being built. Libraries/linker flags from these dependencies will be propagated to dependent for linking, but artifacts/flags required for compilation (such as .swiftmodule files, C headers, and search paths) will not be propagated.<br><br>Allowed kinds of dependencies are:<br><br>* `swift_library` (or anything propagating `SwiftInfo`)<br><br>* `cc_library` (or anything propagating `CcInfo`)<br><br>Additionally, on platforms that support Objective-C interop, `objc_library` targets (or anything propagating the `apple_common.Objc` provider) are allowed as dependencies. On platforms that do not support Objective-C interop (such as Linux), those dependencies will be **ignored.** | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="swift_library-private_deps"></a>private_deps | A list of targets that are implementation-only dependencies of the target being built. Libraries/linker flags from these dependencies will be propagated to dependent for linking, but artifacts/flags required for compilation (such as .swiftmodule files, C headers, and search paths) will not be propagated.<br><br>Allowed kinds of dependencies are:<br><br>* `swift_library` (or anything propagating `SwiftInfo`)<br><br>* `cc_library` and `objc_library` (or anything propagating `CcInfo`) | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="swift_library-swiftc_inputs"></a>swiftc_inputs | Additional files that are referenced using `$(location ...)` in attributes that support location expansion. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |


Expand Down
4 changes: 3 additions & 1 deletion docs/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ load("@rules_player//javascript:defs.bzl", "js_pipeline")

js_pipeline(<a href="#js_pipeline-package_name">package_name</a>, <a href="#js_pipeline-name">name</a>, <a href="#js_pipeline-srcs">srcs</a>, <a href="#js_pipeline-package_json">package_json</a>, <a href="#js_pipeline-root_package_json">root_package_json</a>, <a href="#js_pipeline-vitest_config">vitest_config</a>, <a href="#js_pipeline-tsup_config">tsup_config</a>,
<a href="#js_pipeline-tsconfig">tsconfig</a>, <a href="#js_pipeline-node_modules">node_modules</a>, <a href="#js_pipeline-deps">deps</a>, <a href="#js_pipeline-native_bundle">native_bundle</a>, <a href="#js_pipeline-private">private</a>, <a href="#js_pipeline-peer_deps">peer_deps</a>, <a href="#js_pipeline-create_package_json_args">create_package_json_args</a>,
<a href="#js_pipeline-include_packaging_targets">include_packaging_targets</a>, <a href="#js_pipeline-test_deps">test_deps</a>, <a href="#js_pipeline-lint_deps">lint_deps</a>, <a href="#js_pipeline-build_deps">build_deps</a>, <a href="#js_pipeline-benchmark_envs">benchmark_envs</a>)
<a href="#js_pipeline-include_packaging_targets">include_packaging_targets</a>, <a href="#js_pipeline-test_deps">test_deps</a>, <a href="#js_pipeline-lint_deps">lint_deps</a>, <a href="#js_pipeline-build_deps">build_deps</a>, <a href="#js_pipeline-benchmark_envs">benchmark_envs</a>,
<a href="#js_pipeline-_extra_replace_prefixes">_extra_replace_prefixes</a>)
</pre>

The main entry point for any JS/TS project. `js_pipeline` should be the only thing you need in your BUILD file.
Expand Down Expand Up @@ -100,6 +101,7 @@ Creates a js_library, npm_package, and test targets for a given package.
| <a id="js_pipeline-lint_deps"></a>lint_deps | The lint dependencies for the package. | `["//:eslint_config"]` |
| <a id="js_pipeline-build_deps"></a>build_deps | The build dependencies for the package. | `["//:tsup_config", "//:typings"]` |
| <a id="js_pipeline-benchmark_envs"></a>benchmark_envs | env args for benchmark runs | `{}` |
| <a id="js_pipeline-_extra_replace_prefixes"></a>_extra_replace_prefixes | INTERNAL. Additional `replace_prefixes` entries for the assembled `npm_package`. Used by `js_xlr_pipeline` to relocate XLR outputs from their isolated build-time directory back into the published `dist/xlr/` layout. Do not pass this from BUILD files. | `{}` |


<a id="oclif_pipeline"></a>
Expand Down
5 changes: 4 additions & 1 deletion examples/kotlin/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
common --enable_bzlmod
common --enable_bzlmod

# Bazel 9: external modules still using bare native symbols. Auto-inject loads.
common --incompatible_autoload_externally=+@rules_cc,+@rules_shell
3 changes: 3 additions & 0 deletions examples/python/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
common --enable_bzlmod
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1

# Bazel 9: external modules still using bare native symbols. Auto-inject loads.
common --incompatible_autoload_externally=+@rules_cc,+@rules_shell
4 changes: 4 additions & 0 deletions examples/ts-monorepo/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
common --enable_bzlmod

# Bazel 9: external modules still using bare native symbols. Auto-inject loads.
common --incompatible_autoload_externally=+@rules_cc,+@rules_shell

build:release --stamp --workspace_status_command=$(pwd)/workspace_status.sh

build --@aspect_rules_ts//ts:skipLibCheck=always
Expand Down
4 changes: 3 additions & 1 deletion examples/ts-monorepo/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ rules_ts_ext = use_extension(
"ext",
dev_dependency = True,
)
rules_ts_ext.deps()
rules_ts_ext.deps(
ts_version = "4.5.5",
)
use_repo(rules_ts_ext, "npm_typescript")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
Expand Down
1 change: 1 addition & 0 deletions ios/private/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bzl_library(
"@rules_pkg//:mappings.bzl",
"@rules_pkg//:pkg.bzl",
"@rules_pkg//pkg:bzl_srcs",
"@rules_shell//shell:rules_bzl",
],
)

Expand Down
3 changes: 2 additions & 1 deletion ios/private/common_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load("@build_bazel_rules_apple//apple:ios.bzl", "ios_ui_test", "ios_unit_test")
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

def ios_bundle_module_shim(name):
native.genrule(
Expand Down Expand Up @@ -162,7 +163,7 @@ def ios_pipeline(
)

# Runs SwiftLint as a test calling the genrule target which outputs the result of linting
native.sh_test(
sh_test(
name = name + "SwiftLint",
srcs = [":" + name + "_Lint"],
visibility = ["//visibility:public"],
Expand Down
6 changes: 5 additions & 1 deletion javascript/private/js_pipeline.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def js_pipeline(
test_deps = ["//:vitest_config"],
lint_deps = ["//:eslint_config"],
build_deps = ["//:tsup_config", "//:typings"],
benchmark_envs = {}):
benchmark_envs = {},
_extra_replace_prefixes = {}):
"""
The main entry point for any JS/TS project. `js_pipeline` should be the only thing you need in your BUILD file.

Expand All @@ -62,6 +63,7 @@ def js_pipeline(
lint_deps: The lint dependencies for the package.
build_deps: The build dependencies for the package.
benchmark_envs: env args for benchmark runs
_extra_replace_prefixes: INTERNAL. Additional `replace_prefixes` entries for the assembled `npm_package`. Used by `js_xlr_pipeline` to relocate XLR outputs from their isolated build-time directory back into the published `dist/xlr/` layout. Do not pass this from BUILD files.
"""

tslib_ref = "{}/tslib".format(node_modules)
Expand Down Expand Up @@ -186,6 +188,8 @@ def js_pipeline(
replacements = {}
replacements[package_json_name] = "package"
replacements[ts_types + "/src"] = "types"
for src, dst in _extra_replace_prefixes.items():
replacements[src] = dst

readme_files = native.glob(["README.md"], allow_empty = True)

Expand Down
Loading