From 904958fa792a4a6e80c0676f8d3d5223ac923e8b Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Tue, 7 May 2024 17:46:39 +0100 Subject: [PATCH] Convert package to filepath --- java/gazelle/generate.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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,