Skip to content

Commit

Permalink
Convert package to filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed May 7, 2024
1 parent 0deb497 commit 904958f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions java/gazelle/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 904958f

Please sign in to comment.