Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srcs is updated with the OS-specific path separator #269

Open
bartoszpop opened this issue May 4, 2024 · 0 comments
Open

srcs is updated with the OS-specific path separator #269

bartoszpop opened this issue May 4, 2024 · 0 comments

Comments

@bartoszpop
Copy link
Contributor

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.

bartoszpop added a commit to bartoszpop/rules_jvm that referenced this issue May 4, 2024
…le when gazelle is run on a different operating system and to correctly trim the parent path (bazel-contrib#269)
illicitonion pushed a commit that referenced this issue May 7, 2024
This pull request updates the srcs attribute with "/" regardless of the
OS not to update the BUILD file when Gazelle is run on a different OS
and to correctly trim the parent path (#269).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant