Skip to content

Commit

Permalink
Move new runfiles library to //go/runfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Nov 6, 2022
1 parent 6393d3e commit ba1f367
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ go_library(
"manifest.go",
"runfiles.go",
],
importpath = "github.com/bazelbuild/rules_go/go/tools/bazel/runfiles",
importpath = "github.com/bazelbuild/rules_go/go/runfiles",
visibility = ["//visibility:public"],
)

Expand All @@ -35,15 +35,15 @@ go_test(
],
data = [
"test.txt",
"//go/tools/bazel/runfiles/testprog",
"//go/runfiles/testprog",
"@bazel_tools//tools/bash/runfiles",
],
deps = [":runfiles"],
)

exports_files(
["test.txt"],
visibility = ["//go/tools/bazel/runfiles/testprog:__pkg__"],
visibility = ["//go/runfiles/testprog:__pkg__"],
)

alias(
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions go/tools/bazel/runfiles/fs_test.go → go/runfiles/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func TestFS(t *testing.T) {
return
}

expected1 := "io_bazel_rules_go/go/tools/bazel/runfiles/test.txt"
expected2 := "io_bazel_rules_go/go/tools/bazel/runfiles/testprog/testprog_/testprog"
expected1 := "io_bazel_rules_go/go/runfiles/test.txt"
expected2 := "io_bazel_rules_go/go/testprog/testprog_/testprog"
expected3 := "bazel_tools/tools/bash/runfiles/runfiles.bash"
if err := fstest.TestFS(fsys, expected1, expected2, expected3); err != nil {
t.Error(err)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "testprog_lib",
srcs = ["main.go"],
importpath = "github.com/bazelbuild/rules_go/go/tools/bazel/runfiles/testprog",
importpath = "github.com/bazelbuild/rules_go/go/runfiles/testprog",
visibility = ["//visibility:private"],
deps = ["//go/tools/bazel/runfiles"],
deps = ["//go/runfiles"],
)

go_binary(
name = "testprog",
data = ["//go/tools/bazel/runfiles:test.txt"],
data = ["//go/runfiles:test.txt"],
embed = [":testprog_lib"],
visibility = ["//go/tools/bazel/runfiles:__pkg__"],
visibility = ["//go/runfiles:__pkg__"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
"fmt"
"io/ioutil"

"github.com/bazelbuild/rules_go/go/tools/bazel/runfiles"
"github.com/bazelbuild/rules_go/go/runfiles"
)

func main() {
path, err := runfiles.Path("io_bazel_rules_go/go/tools/bazel/runfiles/test.txt")
path, err := runfiles.Path("io_bazel_rules_go/go/runfiles/test.txt")
if err != nil {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions go/tools/bazel/runfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const (
// binaries invoked with 'bazel run'. On Windows,
// only tests invoked with 'bazel test' are supported.
//
// Deprecated: Use github.com/bazelbuild/rules_go/go/tools/bazel/runfiles
// instead for cross-platform support matching the behavior of the
// Bazel-provided runfiles libraries.
// Deprecated: Use github.com/bazelbuild/rules_go/go/runfiles instead for
// cross-platform support matching the behavior of the Bazel-provided runfiles
// libraries.
func Runfile(path string) (string, error) {
// Search in working directory
if _, err := os.Stat(path); err == nil {
Expand Down

0 comments on commit ba1f367

Please sign in to comment.