Skip to content

Commit

Permalink
link: take absolute path of main file (#1727)
Browse files Browse the repository at this point in the history
Windows has trouble with long paths. Other paths to .a files are
absolutized already.

Related bazel-contrib/bazel-gazelle#321
  • Loading branch information
jayconrod authored and Jay Conrod committed Oct 3, 2018
1 parent b6279f2 commit 56cecb1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions go/tools/builders/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"strings"
)

Expand All @@ -49,6 +50,16 @@ func run(args []string) error {
return err
}

// On Windows, take the absolute path of the output file and main file.
// This is needed on Windows because the relative path is frequently too long.
// os.Open on Windows converts absolute paths to some other path format with
// longer length limits. Absolute paths do not work on macOS for .dylib
// outputs because they get baked in as the "install path".
if runtime.GOOS != "darwin" {
*outFile = abs(*outFile)
}
*main = abs(*main)

// If we were given any stamp value files, read and parse them
stampmap := map[string]string{}
for _, stampfile := range stamps {
Expand Down

0 comments on commit 56cecb1

Please sign in to comment.