diff --git a/java/gazelle/generate.go b/java/gazelle/generate.go index 7819fc2b..92fa11bc 100644 --- a/java/gazelle/generate.go +++ b/java/gazelle/generate.go @@ -134,17 +134,18 @@ func (l javaLang) GenerateRules(args language.GenerateArgs) language.GenerateRes } allPackageNames.Add(mJavaPkg.Name) + mRelFilepath := filepath.FromSlash(mRel) if !mJavaPkg.TestPackage { addNonLocalImportsAndExports(productionJavaImports, nonLocalJavaExports, mJavaPkg.ImportedClasses, mJavaPkg.ImportedPackagesWithoutSpecificClasses, mJavaPkg.ExportedClasses, mJavaPkg.Name, javaClassNamesFromFileNames) for _, f := range mJavaPkg.Files.SortedSlice() { - productionJavaFiles.Add(filepath.Join(mRel, f)) + productionJavaFiles.Add(filepath.Join(mRelFilepath, f)) } allMains.AddAll(mJavaPkg.Mains) } else { // Tests don't get to export things, as things shouldn't depend on them. addNonLocalImportsAndExports(testJavaImports, nil, mJavaPkg.ImportedClasses, mJavaPkg.ImportedPackagesWithoutSpecificClasses, mJavaPkg.ExportedClasses, mJavaPkg.Name, javaClassNamesFromFileNames) for _, f := range mJavaPkg.Files.SortedSlice() { - path := filepath.Join(mRel, f) + path := filepath.Join(mRelFilepath, f) file := javaFile{ pathRelativeToBazelWorkspaceRoot: path, pkg: mJavaPkg.Name, @@ -163,7 +164,7 @@ func (l javaLang) GenerateRules(args language.GenerateArgs) language.GenerateRes } allMains.AddAll(javaPkg.Mains) for _, f := range javaFilenamesRelativeToPackage { - path := filepath.Join(args.Rel, f) + path := filepath.Join(filepath.FromSlash(args.Rel), f) if javaPkg.TestPackage { file := javaFile{ pathRelativeToBazelWorkspaceRoot: path,