aspect-build / aspect-build/rules_ts
[Bug]: `ts_proto_library` does not work with `import_prefix` and `strip_import_prefix` in `proto_library`
- Dominant language
- Starlark
- Stars
- 138
- Forks
- 87
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 3
Description
### What happened?
This is the underlying cause of what I posted [here](https://github.com/aspect-build/rules_ts/issues/451#issuecomment-1791043681). It turns out that if you use `import_prefix` or `strip_import_prefix` in a `proto_library`, `ts_proto_library` will fail with an error that looks like this:
```
Could not find file in descriptor database: bazel-out/darwin_arm64-opt/bin/util/_virtual_imports/proto-library/sc/proto/util/v1/util.proto: No such file or directory
```
### Version
Development (host) and target OS/architectures: Mac OS
Output of `bazel --version`: 6.4.0
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: 2.0.0-rc1
Language(s) and/or frameworks involved: TypeScript
### How to reproduce
```shell
Have a directory structure like this:
util/
proto/
sc/
proto/
util/
v1/
util.proto
BUILD.bazel
WORKSPACE.bazel
```
with a `BUILD.bazel` file with these contents:
```
proto_library(
name = "proto-library",
srcs = glob(["proto/**/*.proto"]),
strip_import_prefix = "/" + package_name() + "/proto",
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:any_proto"],
)
ts_proto_library(
name = "ts-proto-library",
node_modules = "//:node_modules",
proto = ":proto-library",
visibility = ["//visibility:public"],
)
```
Note that `py_proto_library` is able to handle this scenario well such that the following builds file:
```
py_proto_library(
name = "py-proto-library",
output_mode = "NO_PREFIX",
protos = [":proto-library"],
visibility = ["//visibility:public"],
)
```
```
### Any other information?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.