Skip to content

Commit

Permalink
Fix "failed to call RLocation: runfile (...)/Main: file does not exis…
Browse files Browse the repository at this point in the history
…t" (#259)

Fix "bazel run gazelle" failing on Windows with the following error:
> 1:57PM FTL external/contrib_rules_jvm/java/gazelle/configure.go:139 >
could not start javaparser error="failed to start / connect to
javaparser server: failed to find javaparser in runfiles: failed to call
RLocation: runfile
contrib_rules_jvm/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main:
file does not exist" (Fixes #257)
  • Loading branch information
bartoszpop authored May 2, 2024
1 parent 7491b60 commit 603fb5c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions java/gazelle/private/servermanager/servermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ func locateJavaparser() (string, error) {
}

// We want //java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators:Main
loc, err := rf.Rlocation("contrib_rules_jvm/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main")
javaparserPath := "contrib_rules_jvm/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main"
loc, err := rf.Rlocation(javaparserPath)
if err != nil {
return "", fmt.Errorf("failed to call RLocation: %w", err)
loc, err = rf.Rlocation(javaparserPath + ".exe")
}

if err != nil {
return "", fmt.Errorf("failed to call RLocation: %w", err)
}
return loc, nil
}

Expand Down

0 comments on commit 603fb5c

Please sign in to comment.