aspect-build / aspect-build/rules_ts

[Bug]: copy_files in ts_proto_library tries to copy non existing directories

Open
#645 1 comment 0 reactions 0 assignees View on GitHub
bug need: repro
Dominant language
Starlark
Stars
138
Forks
87
Avg merge
2d 8h
Merged PRs (30d)
3

Description

### What happened?

I want to copy the `.js` files generated by the proto target so I can run outside of bazel.

For that purpose, I used "copy_files", pointing to the JS files.

I added 2 entries - one for _connect.js and one for _pb.js.

It looks like it copies the first file, but then tries to copy all files under it - as if it was a directory

```

proto_library(
name = "my_service_proto",
srcs = ["my_service.proto"],
)

ts_proto_library(
name = "my_service_ts_proto",
proto_deps = [":my_service_proto"],
copy_files = True,
files_to_copy =[
"my_service_pb.d.ts",
"my_service_connect.d.ts",
"my_service_pb.js",
"my_service_connect.js"
],
)
```

In the output I see it copies the file, but then files on copying a folder

```
Copying file /my_service_pb.d.ts in /home/dev
Copying file /my_service_connect.d.ts in /home/dev
Copying file /my_service_pb.js in /home/dev
cp: cannot stat /my_service_pb.js/*: No such file or directory
```

### Version

Development (host) and target OS/architectures:

Output of `bazel --version`: 7.2.0

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: 2.4.2

Language(s) and/or frameworks involved: typescript

### How to reproduce

_No response_

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the ts_proto_library handling for copy_files and files_to_copy, using the BUILD definitions and Bazel output shown in the issue to reproduce the failure. Done means the listed individual .d.ts and .js files are copied without attempting to treat a file as a directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.