generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
bugSomething isn't workingSomething isn't workingneed: investigationInvestigation required to proceed furtherInvestigation required to proceed further
Description
What happened?
It seems that ts_project doesn't expose this config option yet and the defaults are different.
Without transpiler
-
data is passed to the
ts_project
rule here:
Lines 406 to 412 in 42094e8
ts_project_rule( name = tsc_target_name, srcs = srcs, args = args, assets = assets, data = data, deps = tsc_deps, -
The
ts_project
rule invokesgather_runfiles
rules_ts/ts/private/ts_project.bzl
Lines 270 to 275 in 42094e8
runfiles = js_lib_helpers.gather_runfiles( ctx = ctx, sources = output_sources_depset, data = ctx.attr.data, deps = ctx.attr.srcs + [ctx.attr.tsconfig] + ctx.attr.deps, )
With transpiler
-
data is passed to
js_library
here:
Lines 392 to 400 in 42094e8
js_library( name = name, # Include the tsc target in srcs to pick-up both the direct & transitive declaration outputs so # that this js_library can be a valid dep for downstream ts_project or other rules_js derivative rules. srcs = [transpile_target_name, tsc_target_name] + assets, deps = deps, data = data, **common_kwargs )
What I'd expect
- The behavior with and without
transpiler
to be the same. - There be an equivalent option to
js_library
onts_project
(the macro).
Version
Development (host) and target OS/architectures:
Output of bazel --version
:
bazelisk --version
bazel 6.3.2
Version of the Aspect rules, or other relevant rules from your
WORKSPACE
or MODULE.bazel
file:
rules_js: 1.31.0
rules_ts: 1.4.5
Language(s) and/or frameworks involved: None.
How to reproduce
Minimal steps, happy to provide more if necessary.
1. Add a filegroup with files in a different package to `data` of a `ts_project` (without `transpiler` set).
2. Build passes.
3. Set `transpiler` to `swc`.
4. Build fails (example failure below)
5. Switch `filegroup` to `js_library`
6. Build passes
Expected to find source file <the file> in '//package-of-ts-project', but instead it is in '//package-of-file'.
All source and data files that are not in the Bazel output tree must be in the same package as the
target so that they can be copied to the output tree in an action.
See https://docs.aspect.build/rules/aspect_rules_js/docs/#javascript for more context on why this is required.
### Any other information?
Happy to open a PR to align this, but I'd like to agree on the following first:
- Exact fix (add flag, align behavior, ???)
- Target branch (1.x, 2.x)?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneed: investigationInvestigation required to proceed furtherInvestigation required to proceed further