Skip to content

Commit 37575b6

Browse files
committed
docs: explain out_dir with output_dir
1 parent 8db4ee5 commit 37575b6

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

docs/swc.md

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/directory/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ sh_test(
3838
deps = ["@bazel_tools//tools/bash/runfiles"],
3939
)
4040

41+
# Like above, but outputs to examples/directory/test-out_dir instead.
4142
swc(
4243
name = "out_dir",
4344
srcs = ["split_app"],

swc/defs.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def swc(name, srcs, args = [], data = [], plugins = [], output_dir = False, swcr
4343
data: Files needed at runtime by binaries or tests that transitively depend on this target.
4444
See https://bazel.build/reference/be/common-definitions#typical-attributes
4545
46-
output_dir: Whether to produce a directory output rather than individual files
46+
output_dir: Whether to produce a directory output rather than individual files.
47+
48+
If `out_dir` is set, then that is used as the name of the output directory.
49+
Otherwise, the output directory is named the same as the target.
4750
4851
args: Additional options to pass to `swcx` cli, see https://github.com/swc-project/swc/discussions/3859
4952
Note: we do **not** run the [NodeJS wrapper `@swc/cli`](https://swc.rs/docs/usage/cli)
@@ -61,7 +64,9 @@ def swc(name, srcs, args = [], data = [], plugins = [], output_dir = False, swcr
6164
6265
plugins: List of plugin labels created with `swc_plugin`.
6366
64-
out_dir: The base directory for output files relative to the output directory for this package
67+
out_dir: The base directory for output files relative to the output directory for this package.
68+
69+
If output_dir is True, then this is used as the name of the output directory.
6570
6671
root_dir: A subdirectory under the input package which should be considered the root directory of all the input files
6772

swc/private/swc.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ _attrs = {
2828
default = "false",
2929
),
3030
"output_dir": attr.bool(
31-
doc = "whether to produce a directory output rather than individual files",
31+
doc = """Whether to produce a directory output rather than individual files.
32+
33+
If out_dir is also specified, it is used as the name of the output directory.
34+
Otherwise, the directory is named the same as the target.""",
3235
),
3336
"data": js_lib_helpers.JS_LIBRARY_DATA_ATTR,
3437
"swcrc": attr.label(
@@ -40,7 +43,9 @@ _attrs = {
4043
providers = [[DefaultInfo, SwcPluginConfigInfo]],
4144
),
4245
"out_dir": attr.string(
43-
doc = "base directory for output files",
46+
doc = """With output_dir=False, output files will have this directory prefix.
47+
48+
With output_dir=True, this is the name of the output directory.""",
4449
),
4550
"root_dir": attr.string(
4651
doc = "a subdirectory under the input package which should be consider the root directory of all the input files",

0 commit comments

Comments
 (0)