bazel-contrib / bazel-contrib/rules_jvm

srcs is updated with the OS-specific path separator

Open
#269 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
54
Forks
98
Avg merge
6d 2h
Merged PRs (30d)
7

Description

rules_jvm updates the srcs attribute with the OS-specific path separator, which leads to unnecessary updates and the parent path being incorrectly trimmed, e.g. for the following project structure
```
.
+-- WORKSPACE
+-- BUILD.bazel
+-- project
| +-- BUILD.bazel
| +-- src
| +-- com
| +-- example
| +-- SomeClass.java
```
and the nested BUILD.bazel file having:
```
java_library(
name = "some-project",
srcs = [
"src/com/example/SomeClass.java"
]
```
once "bazel run gazelle" is executed on Windows, it will update the file to:
```
java_library(
name = "some-project",
srcs = [
"project\\src\\com\\example\\SomeClass.java"
]
```

I think it should always use "/" because java_library and other rules that consume this attribute support "/" regardless of the OS they run on.

Contributor guide

Open the contributing guide

Research direction

Start with the rules_jvm code involved in the Gazelle update of the java_library srcs attribute, using the provided nested BUILD.bazel example to reproduce the Windows path change. Verify that generated srcs retain forward slashes and do not incorrectly include or trim the parent project path.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.