Skip to content

Commit

Permalink
Fix slashes in srcs
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed May 3, 2024
1 parent f25c34a commit ab743d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions java/gazelle/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ func (l javaLang) generateJavaTest(file *rule.File, pathToPackageRelativeToBazel
}

path := strings.TrimPrefix(f.pathRelativeToBazelWorkspaceRoot, pathToPackageRelativeToBazelWorkspace+"/")
r.SetAttr("srcs", []string{path})
r.SetAttr("srcs", []string{filepath.ToSlash(path)})
r.SetAttr("test_class", fullyQualifiedTestClass)
r.SetPrivateAttr(packagesKey, []types.ResolvableJavaPackage{*types.NewResolvableJavaPackage(f.pkg, true, false)})

Expand Down Expand Up @@ -601,7 +601,11 @@ var junit5RuntimeDeps = []string{
func (l javaLang) generateJavaTestSuite(file *rule.File, name string, srcs []string, packageNames *sorted_set.SortedSet[types.PackageName], mavenRepositoryName string, imports *sorted_set.SortedSet[types.PackageName], customTestSuffixes *[]string, hasHelpers bool, res *language.GenerateResult) {
const ruleKind = "java_test_suite"
r := rule.NewRule(ruleKind, name)
r.SetAttr("srcs", srcs)
slashSrcs := make([]string, 0, len(srcs))
for _, src := range srcs {
slashSrcs = append(slashSrcs, filepath.ToSlash(src))
}
r.SetAttr("srcs", slashSrcs)
resolvablePackages := make([]types.ResolvableJavaPackage, 0, packageNames.Len())
if hasHelpers {
for _, packageName := range packageNames.SortedSlice() {
Expand Down

0 comments on commit ab743d5

Please sign in to comment.