diff --git a/.aspect/bazelrc/ci.bazelrc b/.aspect/bazelrc/ci.bazelrc index 4d91ee09..11aae33d 100644 --- a/.aspect/bazelrc/ci.bazelrc +++ b/.aspect/bazelrc/ci.bazelrc @@ -1,10 +1,3 @@ -# We recommend enforcing a policy that keeps your CI from being slowed down -# by individual test targets that should be optimized -# or split up into multiple test targets with sharding or manually. -# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI. -# Docs: https://bazel.build/docs/user-manual#test-timeout-filters -test --test_timeout_filters=-eternal - # Set this flag to enable re-tries of failed tests on CI. # When any test target fails, try one or more times. This applies regardless of whether the "flaky" # tag appears on the target definition. diff --git a/.aspect/bazelrc/correctness.bazelrc b/.aspect/bazelrc/correctness.bazelrc index 56fad5fd..a599f6d8 100644 --- a/.aspect/bazelrc/correctness.bazelrc +++ b/.aspect/bazelrc/correctness.bazelrc @@ -60,3 +60,16 @@ query --experimental_allow_tags_propagation # https://github.com/bazelbuild/bazel/issues/10076. # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py build --incompatible_default_to_explicit_init_py + +# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when +# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package +# because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195. +# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob +common --incompatible_disallow_empty_glob + +# Always download coverage files for tests from the remote cache. By default, coverage files are not +# downloaded on test result cahce hits when --remote_download_minimal is enabled, making it impossible +# to generate a full coverage report. +# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs +# detching remote cache results +test --experimental_fetch_all_coverage_outputs diff --git a/.aspect/bazelrc/javascript.bazelrc b/.aspect/bazelrc/javascript.bazelrc index dc768641..ace9d604 100644 --- a/.aspect/bazelrc/javascript.bazelrc +++ b/.aspect/bazelrc/javascript.bazelrc @@ -8,21 +8,4 @@ # details. # Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options run:debug -- --node_options=--inspect-brk - -# Enable runfiles on all platforms. Runfiles are on by default on Linux and MacOS but off on -# Windows. -# -# In general, rules_js and derivate rule sets assume that runfiles are enabled and do not support no -# runfiles case because it does not scale to teach all Node.js tools to use the runfiles manifest. -# -# If you are developing on Windows, you must either run bazel with administrator privileges or -# enable developer mode. If you do not you may hit this error on Windows: -# -# Bazel needs to create symlinks to build the runfiles tree. -# Creating symlinks on Windows requires one of the following: -# 1. Bazel is run with administrator privileges. -# 2. The system version is Windows 10 Creators Update (1703) or later -# and developer mode is enabled. -# -# Docs: https://bazel.build/reference/command-line-reference#flag--enable_runfiles -build --enable_runfiles +test:debug --test_env=NODE_OPTIONS=--inspect-brk diff --git a/.aspect/bazelrc/performance.bazelrc b/.aspect/bazelrc/performance.bazelrc index fff4c7c5..acc48c59 100644 --- a/.aspect/bazelrc/performance.bazelrc +++ b/.aspect/bazelrc/performance.bazelrc @@ -1,12 +1,3 @@ -# Speed up all builds by not checking if output files have been modified. Lets you make changes to -# the output tree without triggering a build for local debugging. For example, you can modify -# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree -# when local debugging. -# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185 -build --noexperimental_check_output_files -fetch --noexperimental_check_output_files -query --noexperimental_check_output_files - # Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache. # If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where # Bazel doesn't write to the local disk cache as it treats as a remote cache. @@ -27,12 +18,3 @@ build --experimental_reuse_sandbox_directories # author. # Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles build --nolegacy_external_runfiles - -# Some actions are always IO-intensive but require little compute. It's wasteful to put the output -# in the remote cache, it just saturates the network and fills the cache storage causing earlier -# evictions. It's also not worth sending them for remote execution. -# For actions like PackageTar it's usually faster to just re-run the work locally every time. -# You'll have to look at an execution log to figure out what other action mnemonics you care about. -# In some cases you may need to patch rulesets to add a mnemonic to actions that don't have one. -# https://bazel.build/reference/command-line-reference#flag--modify_execution_info -build --modify_execution_info=PackageTar=+no-remote diff --git a/.github/workflows/bazel6.bazelrc b/.github/workflows/bazel6.bazelrc index 11a1c67f..f6a155c7 100644 --- a/.github/workflows/bazel6.bazelrc +++ b/.github/workflows/bazel6.bazelrc @@ -13,3 +13,15 @@ build --reuse_sandbox_directories # Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel # See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/ build --noexperimental_action_cache_store_output_metadata + +# Speed up all builds by not checking if output files have been modified. Lets you make changes to +# the output tree without triggering a build for local debugging. For example, you can modify +# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree +# when local debugging. +# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185 +# NB: This flag is in bazel6.bazelrc as when used in Bazel 7 is has been observed to break +# "build without the bytes" --remote_download_outputs=toplevel. See https://github.com/aspect-build/bazel-lib/pull/711 +# for more info. +build --noexperimental_check_output_files +fetch --noexperimental_check_output_files +query --noexperimental_check_output_files diff --git a/.github/workflows/bazel7.bazelrc b/.github/workflows/bazel7.bazelrc index 11a1c67f..212c26e7 100644 --- a/.github/workflows/bazel7.bazelrc +++ b/.github/workflows/bazel7.bazelrc @@ -9,7 +9,3 @@ query --noexperimental_check_external_repository_files # build. # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories build --reuse_sandbox_directories - -# Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel -# See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/ -build --noexperimental_action_cache_store_output_metadata diff --git a/BUILD.bazel b/BUILD.bazel index 770a682a..4d3dc2f2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,9 +1,7 @@ +load("@aspect_bazel_lib//lib:utils.bzl", bazel_lib_utils = "utils") load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@buildifier_prebuilt//:rules.bzl", "buildifier") -# buildifier: disable=bzl-visibility -load("//swc/private:is_bazel_7_or_greater.bzl", "is_bazel_7_or_greater") - buildifier( name = "buildifier", exclude_patterns = ["./.git/*"], @@ -27,5 +25,5 @@ bzl_library( deps = [ "@bazel_tools//tools/build_defs/repo:http.bzl", "@bazel_tools//tools/build_defs/repo:utils.bzl", - ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if is_bazel_7_or_greater() else []), + ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if bazel_lib_utils.is_bazel_7_or_greater() else []), ) diff --git a/MODULE.bazel b/MODULE.bazel index 509117bb..cdcc8aee 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,9 +7,9 @@ module( ) # Lower-bounds (minimum) versions for direct runtime dependencies -bazel_dep(name = "aspect_bazel_lib", version = "1.33.0") -bazel_dep(name = "aspect_rules_js", version = "1.31.0") # Note: only used for provider symbols, we don't spawn nodejs actions -bazel_dep(name = "bazel_skylib", version = "1.4.1") +bazel_dep(name = "aspect_bazel_lib", version = "2.7.3") +bazel_dep(name = "aspect_rules_js", version = "2.0.0-rc0") # Note: only used for provider symbols, we don't spawn nodejs actions +bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "platforms", version = "0.0.7") swc = use_extension("@aspect_rules_swc//swc:extensions.bzl", "swc") diff --git a/WORKSPACE b/WORKSPACE index 3091a7b8..a3c939cf 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -19,24 +19,11 @@ swc_register_toolchains( swc_version = LATEST_SWC_VERSION, ) -load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_jq_toolchains") +load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains") -aspect_bazel_lib_dependencies(override_local_config_platform = True) +rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION) -register_jq_toolchains() - -load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") - -rules_js_dependencies() - -load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") - -nodejs_register_toolchains( - name = "nodejs", - node_version = DEFAULT_NODE_VERSION, -) - -load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock") +load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") npm_translate_lock( name = "npm", diff --git a/docs/swc.md b/docs/swc.md index f3a090bb..4fefde17 100644 --- a/docs/swc.md +++ b/docs/swc.md @@ -37,7 +37,7 @@ for example to set your own output labels for `js_outs`. | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | | srcs | source files, typically .ts files in the source tree | List of labels | required | | -| data | Runtime dependencies to include in binaries/tests that depend on this target.

The transitive npm dependencies, transitive sources, default outputs and runfiles of targets in the `data` attribute are added to the runfiles of this target. They should appear in the '*.runfiles' area of any executable which has a runtime dependency on this target.

If this list contains linked npm packages, npm package store targets or other targets that provide `JsInfo`, `NpmPackageStoreInfo` providers are gathered from `JsInfo`. This is done directly from the `npm_package_store_deps` field of these. For linked npm package targets, the underlying `npm_package_store` target(s) that back the links is used. Gathered `NpmPackageStoreInfo` providers are propagated to the direct dependencies of downstream linked `npm_package` targets.

NB: Linked npm package targets that are "dev" dependencies do not forward their underlying `npm_package_store` target(s) through `npm_package_store_deps` and will therefore not be propagated to the direct dependencies of downstream linked `npm_package` targets. npm packages that come in from `npm_translate_lock` are considered "dev" dependencies if they are have `dev: true` set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all `package.json` files within the pnpm workspace. This behavior is intentional to mimic how `devDependencies` work in published npm packages. | List of labels | optional | `[]` | +| data | Runtime dependencies to include in binaries/tests that depend on this target.

Follows the same semantics as `js_library` `data` attribute. See https://docs.aspect.build/rulesets/aspect_rules_js/docs/js_library#data for more info. | List of labels | optional | `[]` | | args | Additional arguments to pass to swcx cli (NOT swc!).

NB: this is not the same as the CLI arguments for @swc/cli npm package. For performance, rules_swc does not call a Node.js program wrapping the swc rust binding. Instead, we directly spawn the (somewhat experimental) native Rust binary shipped inside the @swc/core npm package, which the swc project calls "swcx" Tracking issue for feature parity: https://github.com/swc-project/swc/issues/4017 | List of strings | optional | `[]` | | js_outs | list of expected JavaScript output files.

There should be one for each entry in srcs. | List of labels | optional | `[]` | | map_outs | list of expected source map output files.

Can be empty, meaning no source maps should be produced. If non-empty, there should be one for each entry in srcs. | List of labels | optional | `[]` | @@ -83,7 +83,7 @@ Execute the SWC compiler ## swc_plugin
-swc_plugin(name, src, config, kwargs)
+swc_plugin(name, srcs, config, kwargs)
 
Configure an SWC plugin @@ -94,7 +94,7 @@ Configure an SWC plugin | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | A name for this target | none | -| src | Label for the plugin, either a directory containing a package.json pointing at a wasm file as the main entrypoint, or a wasm file. Usually a linked npm package target via rules_js. | `None` | +| srcs | Plugin files. Either a directory containing a package.json pointing at a wasm file as the main entrypoint, or a wasm file. Usually a linked npm package target via rules_js. | `[]` | | config | Optional configuration dict for the plugin. This is passed as a JSON object into the `jsc.experimental.plugins` entry for the plugin. | `{}` | | kwargs | additional keyword arguments passed through to underlying rule, eg. `visibility`, `tags` | none | diff --git a/e2e/smoke/MODULE.bazel b/e2e/smoke/MODULE.bazel index 11d04e84..41429587 100644 --- a/e2e/smoke/MODULE.bazel +++ b/e2e/smoke/MODULE.bazel @@ -4,7 +4,7 @@ local_path_override( path = "../..", ) -bazel_dep(name = "bazel_skylib", version = "1.4.1", dev_dependency = True) +bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True) # Optional: specify a custom swc toolchain instead of the default swc = use_extension("@aspect_rules_swc//swc:extensions.bzl", "swc", dev_dependency = True) diff --git a/examples/plugins/BUILD.bazel b/examples/plugins/BUILD.bazel index cbc75396..08aa7f5a 100644 --- a/examples/plugins/BUILD.bazel +++ b/examples/plugins/BUILD.bazel @@ -16,7 +16,11 @@ npm_link_all_packages(name = "node_modules") # This requires that the package.json includes a main entrypoint pointing at the plugin wasm file. swc_plugin( name = "npm_plugin", - src = ":node_modules/@swc/plugin-transform-imports", + srcs = [ + # reference the location where the "@swc/plugin-transform-imports" npm package was linked in our root Bazel package. + ":node_modules/@swc/plugin-transform-imports", + ":node_modules/@swc/plugin-transform-imports/dir", + ], # optional plugin config, the JSON object for the plugin passed into jsc.experimental.plugins # https://swc.rs/docs/configuration/compilation#jscexperimentalplugins config = { diff --git a/swc/BUILD.bazel b/swc/BUILD.bazel index 0ea0920d..a6c3f5be 100644 --- a/swc/BUILD.bazel +++ b/swc/BUILD.bazel @@ -1,5 +1,5 @@ +load("@aspect_bazel_lib//lib:utils.bzl", bazel_lib_utils = "utils") load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("//swc/private:is_bazel_7_or_greater.bzl", "is_bazel_7_or_greater") load("//swc/private:resolved_toolchain.bzl", "resolved_toolchain") # For stardoc to reference the files @@ -42,7 +42,7 @@ bzl_library( deps = [ "@bazel_tools//tools/build_defs/repo:http.bzl", "@bazel_tools//tools/build_defs/repo:utils.bzl", - ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if is_bazel_7_or_greater() else []), + ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if bazel_lib_utils.is_bazel_7_or_greater() else []), ) bzl_library( @@ -54,7 +54,7 @@ bzl_library( "//swc/private:swc_plugin", "@bazel_skylib//lib:types", "@bazel_skylib//rules:write_file", - ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if is_bazel_7_or_greater() else []), + ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if bazel_lib_utils.is_bazel_7_or_greater() else []), ) bzl_library( diff --git a/swc/defs.bzl b/swc/defs.bzl index 1e9f7077..a15e7ad3 100644 --- a/swc/defs.bzl +++ b/swc/defs.bzl @@ -128,13 +128,13 @@ _swc_plugin = rule( provides = _swc_plugin_lib.provides, ) -def swc_plugin(name, src = None, config = {}, **kwargs): +def swc_plugin(name, srcs = [], config = {}, **kwargs): """Configure an SWC plugin Args: name: A name for this target - src: Label for the plugin, either a directory containing a package.json pointing at a wasm file + srcs: Plugin files. Either a directory containing a package.json pointing at a wasm file as the main entrypoint, or a wasm file. Usually a linked npm package target via rules_js. config: Optional configuration dict for the plugin. This is passed as a JSON object into the @@ -146,9 +146,14 @@ def swc_plugin(name, src = None, config = {}, **kwargs): if not types.is_dict(config): fail("config must be a dict, not a " + type(config)) + # For backward compat + src = kwargs.pop("src", None) + if src: + srcs = srcs[:] + [src] + _swc_plugin( name = name, - src = src, + srcs = srcs, config = json.encode(config), **kwargs ) diff --git a/swc/dependencies.bzl b/swc/dependencies.bzl index 077983ca..268a44c3 100644 --- a/swc/dependencies.bzl +++ b/swc/dependencies.bzl @@ -15,20 +15,27 @@ def http_archive(**kwargs): def rules_swc_dependencies(): http_archive( name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz"], + sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94", + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz"], ) http_archive( name = "aspect_bazel_lib", - sha256 = "d488d8ecca98a4042442a4ae5f1ab0b614f896c0ebf6e3eafff363bcc51c6e62", - strip_prefix = "bazel-lib-1.33.0", - url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.33.0/bazel-lib-v1.33.0.tar.gz", + sha256 = "87ab4ec479ebeb00d286266aca2068caeef1bb0b1765e8f71c7b6cfee6af4226", + strip_prefix = "bazel-lib-2.7.3", + url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.3/bazel-lib-v2.7.3.tar.gz", ) http_archive( name = "aspect_rules_js", - sha256 = "7b2a4d1d264e105eae49a27e2e78065b23e2e45724df2251eacdd317e95bfdfd", - strip_prefix = "rules_js-1.31.0", - url = "https://github.com/aspect-build/rules_js/releases/download/v1.31.0/rules_js-v1.31.0.tar.gz", + sha256 = "389021e29b3aeed2f6fb3a7a1478f8fc52947a6500b198a7ec0f3358c2842415", + strip_prefix = "rules_js-2.0.0-rc0", + url = "https://github.com/aspect-build/rules_js/releases/download/v2.0.0-rc0/rules_js-v2.0.0-rc0.tar.gz", + ) + + http_archive( + name = "rules_nodejs", + sha256 = "dddd60acc3f2f30359bef502c9d788f67e33814b0ddd99aa27c5a15eb7a41b8c", + strip_prefix = "rules_nodejs-6.1.0", + url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.1.0/rules_nodejs-v6.1.0.tar.gz", ) diff --git a/swc/private/is_bazel_7_or_greater.bzl b/swc/private/is_bazel_7_or_greater.bzl deleted file mode 100644 index 0a9b740f..00000000 --- a/swc/private/is_bazel_7_or_greater.bzl +++ /dev/null @@ -1,7 +0,0 @@ -"is_bazel_7_or_greater" - -def is_bazel_7_or_greater(): - # Vendored in from https://github.com/aspect-build/bazel-lib/blob/adad7889c925c4f22a2f84568268f0a62e7c2fb0/lib/private/utils.bzl#L208 - # so that rules_js remains compatible with aspect_bazel_lib >= 2.0.0 and < 2.2.0. - # TODO(2.0): remove this and switch to the upstream function and bump minimum aspect_bazel_lib version to 2.2.0 - return "apple_binary" not in dir(native) and "cc_host_toolchain_alias" not in dir(native) diff --git a/swc/private/swc.bzl b/swc/private/swc.bzl index 0d20dd14..1093e5c7 100644 --- a/swc/private/swc.bzl +++ b/swc/private/swc.bzl @@ -42,7 +42,14 @@ _attrs = { If out_dir is also specified, it is used as the name of the output directory. Otherwise, the directory is named the same as the target.""", ), - "data": js_lib_helpers.JS_LIBRARY_DATA_ATTR, + "data": attr.label_list( + doc = """Runtime dependencies to include in binaries/tests that depend on this target. + +Follows the same semantics as `js_library` `data` attribute. See +https://docs.aspect.build/rulesets/aspect_rules_js/docs/js_library#data for more info. +""", + allow_files = True, + ), "swcrc": attr.label( doc = "label of a configuration file for swc, see https://swc.rs/docs/configuration/swcrc", allow_single_file = True, @@ -326,18 +333,18 @@ def _swc_impl(ctx): targets = ctx.attr.srcs, ) - transitive_declarations = js_lib_helpers.gather_transitive_declarations( - declarations = [], + transitive_types = js_lib_helpers.gather_transitive_types( + types = [], targets = ctx.attr.srcs, ) - npm_linked_packages = js_lib_helpers.gather_npm_linked_packages( + npm_sources = js_lib_helpers.gather_npm_sources( srcs = ctx.attr.srcs, deps = [], ) - npm_package_store_deps = js_lib_helpers.gather_npm_package_store_deps( - targets = ctx.attr.data, + npm_package_store_infos = js_lib_helpers.gather_npm_package_store_infos( + targets = ctx.attr.srcs + ctx.attr.data, ) runfiles = js_lib_helpers.gather_runfiles( @@ -349,14 +356,13 @@ def _swc_impl(ctx): return [ js_info( - npm_linked_package_files = npm_linked_packages.direct_files, - npm_linked_packages = npm_linked_packages.direct, - npm_package_store_deps = npm_package_store_deps, + target = ctx.label, sources = output_sources_depset, - transitive_declarations = transitive_declarations, - transitive_npm_linked_package_files = npm_linked_packages.transitive_files, - transitive_npm_linked_packages = npm_linked_packages.transitive, + types = depset(), # swc does not emit types directly transitive_sources = transitive_sources, + transitive_types = transitive_types, + npm_sources = npm_sources, + npm_package_store_infos = npm_package_store_infos, ), DefaultInfo( files = output_sources_depset, diff --git a/swc/private/swc_plugin.bzl b/swc/private/swc_plugin.bzl index 6a190c86..dd075ca3 100644 --- a/swc/private/swc_plugin.bzl +++ b/swc/private/swc_plugin.bzl @@ -3,7 +3,7 @@ load("//swc:providers.bzl", "SwcPluginConfigInfo") _attrs = { - "src": attr.label( + "srcs": attr.label_list( doc = "label for the plugin, either a directory containing a package.json pointing at a wasm file as the main entrypoint, or a wasm file", providers = [DefaultInfo], mandatory = True, @@ -18,7 +18,7 @@ _attrs = { def _swc_plugin_impl(ctx): return [ DefaultInfo( - files = ctx.attr.src[DefaultInfo].files, + files = depset(ctx.files.srcs), ), SwcPluginConfigInfo( label = ctx.label,