Open atavakoliyext opened 2 years ago
This blocks windows support in rules_python
: https://github.com/bazelbuild/rules_python/blob/0.8.0/.bazelci/presubmit.yml#L35-L36
@UebelAndre seems like a pretty reasonable step forward. While it's possible to make the change suggested in here by @atavakoliyext, I personally think it would be better to fix it in the place where the filepath is generated.
Something like modifying:
to end with
files = append(files, strings.Replace(f, `\\`, `/`)
and then either finding a test that's currently disabled, or writing a new test to confirm this behavior in Windows. If you have any questions about how to do that, please feel free to ping the thread.
Hi @fmeum, we recently re-ran into this issue after performing an internal upgrade that missed the patch above in our local fork. Would you have any thoughts on the fix described by me or @achew22? If either are acceptable, I'd be happy to put up the PR.
(apologies in advance if you're not the right person to tag on this)
@atavakoliyext Either looks good, although I would prefer this if it works:
diff --git a/cmd/generate_repo_config/generate_repo_config.go b/cmd/generate_repo_config/generate_repo_config.go
index f573fa2..79d90cc 100644
--- a/cmd/generate_repo_config/generate_repo_config.go
+++ b/cmd/generate_repo_config/generate_repo_config.go
@@ -141,7 +141,7 @@ func generateRepoConfig(configDest, configSource string) ([]string, error) {
if err != nil {
return nil, err
}
- files = append(files, f)
+ files = append(files, filepath.ToSlash(f))
}
return files, nil
Having a test in generate_repo_config_test.go
that catches such Windows-specific issues would be nice as well.
@atavakoliyext Either looks good, although I would prefer this if it works:
this has worked for me.
Having a test in
generate_repo_config_test.go
that catches such Windows-specific issues would be nice as well.
What about an integration test? That failure makes things break rather early in a build?
What version of gazelle are you using?
v0.24.0
What version of rules_go are you using?
v0.29.0
What version of Bazel are you using?
4.2.1
Does this issue reproduce with the latest releases of all the above?
Yes.
What operating system and processor architecture are you using?
Windows Server Core (docker image
mcr.microsoft.com/windows/servercore:1809
)What did you do?
Setup the WORKSPACE with rules_go and gazelle at the versions above.
Create
tools/go/repos.bzl
and add somego_repository
s to it.In WORKSPACE:
Create a go module in the repo that uses at least one of the modules in the above file.
Run
bazel run //:gazelle && bazel build //some/golibrary/target
What did you expect to see?
The build succeeds.
What did you see instead?
This is fixed by using a local_repository for gazelle with the following diff: