Open gzm0 opened 1 year ago
The behavior with and without transpiler to be the same
I don't think we make this promise anywhere, though I can understand why it's unfortunate to make non-local changes when switching the transplier
There be an equivalent option to js_library on ts_project (the macro).
Is this just saying you need a boolean attribute to be exposed in the public API to control copy_data_files_to_bin
?
It would be really great if you could find somewhere in our examples/e2e folder where you could reproduce the problem caused by your data files getting copied or not copied, and how the runfiles is involved, so we could study a bit more.
I don't think we make this promise anywhere, though I can understand why it's unfortunate to make non-local changes when switching the transplier
Fair enough. Although this one was particularly confusing to me because I'd expect the data
attribute not to interact with the compilation/transpilation step at all (but only with downstream execution steps).
Is this just saying you need a boolean attribute to be exposed in the public API to control copy_data_files_to_bin?
Yes, pretty much (and maybe, but IIUC for 2.0.0 it's already too late, make it the same default, independent of whether transpiler
is set).
It would be really great if you could find somewhere in our examples/e2e folder where you could reproduce the problem caused by your data files getting copied or not copied, and how the runfiles is involved, so we could study a bit more.
TBH, I do not understand the specific effect this has on the runfiles tree (I shamefully admit that when it comes to runfiles, I just fiddle with relative paths until my code can find the files).
The way I hit this issue is by depending on a filegroup:
ts_project(
name = "test",
// stuff
data = [
"//other-package:files" // <-- filegroup target containing source files
],
)
copy_to_bin will fail on //other-package:files
, because it can only act on files in the invoking package (so for all I know the resulting runfiles tree would look the same).
To me, it feels this is reason enough to add the copy_data_files_to_bin
options to ts_project
but if you feel this needs some deeper understanding of how this actually affects runfiles (beyond what is documented in rules_js), I'm happy to do some digging.
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: https://github.com/aspect-build/rules_ts/blob/42094e84545d3420081da240819a123aa02b69ce/ts/defs.bzl#L406-L412The
ts_project
rule invokesgather_runfiles
https://github.com/aspect-build/rules_ts/blob/42094e84545d3420081da240819a123aa02b69ce/ts/private/ts_project.bzl#L270-L275The default for
copy_data_files_to_bin
isFalse
With transpiler
data is passed to
js_library
here: https://github.com/aspect-build/rules_ts/blob/42094e84545d3420081da240819a123aa02b69ce/ts/defs.bzl#L392-L400The default for
js_library
isTrue
What I'd expect
transpiler
to be the same.js_library
onts_project
(the macro).Version
Development (host) and target OS/architectures:
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved: None.
How to reproduce