Skip to content

Commit

Permalink
Absoulte paths for load statements (#503)
Browse files Browse the repository at this point in the history
Change all internal load statements to absolute paths otherwise we end up with
duplicate instances of the scripts, with thing like providers of the same name
that don't match.
This is a workaround for bazelbuild/bazel#3115
  • Loading branch information
ianthehat authored Jun 2, 2017
1 parent 489fb4f commit 9e5e4fc
Show file tree
Hide file tree
Showing 56 changed files with 81 additions and 81 deletions.
8 changes: 4 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("//go:def.bzl", "go_prefix")
load("//go/private:lines_sorted_test.bzl", "lines_sorted_test")
load("//proto:go_proto_library.bzl", "go_google_protobuf")
load("//go/private:bzl_format.bzl", "bzl_format_rules")
load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
load("@io_bazel_rules_go//go/private:lines_sorted_test.bzl", "lines_sorted_test")
load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_google_protobuf")
load("@io_bazel_rules_go//go/private:bzl_format.bzl", "bzl_format_rules")

go_prefix("github.com/bazelbuild/rules_go")

Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
workspace(name = "io_bazel_rules_go")

load("//go:def.bzl", "go_repositories", "go_repository")
load("@io_bazel_rules_go//go:def.bzl", "go_repositories", "go_repository")

go_repositories()

Expand All @@ -13,6 +13,6 @@ go_repository(

# Protocol buffers

load("//proto:go_proto_library.bzl", "go_proto_repositories")
load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_proto_repositories")

go_proto_repositories()
2 changes: 1 addition & 1 deletion examples/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package(
default_visibility = ["//visibility:public"],
)

load("//go:def.bzl", "go_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

go_binary(
name = "bin",
Expand Down
2 changes: 1 addition & 1 deletion examples/cgo/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package(
default_visibility = ["//visibility:public"],
)

load("//go:def.bzl", "go_library", "go_test", "cgo_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "cgo_library")

cgo_library(
name = "cgo_lib",
Expand Down
2 changes: 1 addition & 1 deletion examples/cgo/example_command/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package(
default_visibility = ["//visibility:public"],
)

load("//go:def.bzl", "go_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

go_binary(
name = "example_command",
Expand Down
2 changes: 1 addition & 1 deletion examples/cgo/skip_go_library/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("//go:def.bzl", "go_library", "cgo_genrule")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "cgo_genrule")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/external/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

go_binary(
name = "record_log",
Expand Down
2 changes: 1 addition & 1 deletion examples/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package(
default_visibility = ["//visibility:public"],
)

load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/lib/deep/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//examples/lib:__pkg__"])

load("//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/monobuild/cmd/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package(
default_visibility = ["//visibility:public"],
)

load("//go:def.bzl", "go_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

go_binary(
name = "mycmd",
Expand Down
2 changes: 1 addition & 1 deletion examples/monobuild/lib1/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//examples/monobuild/cmd:__pkg__"])

load("//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/monobuild/lib2/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//examples/monobuild/cmd:__pkg__"])

load("//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/proto/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/proto/dep/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//proto:go_proto_library.bzl", "go_proto_library")
load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_proto_library")

go_proto_library(
name = "useful_proto",
Expand Down
2 changes: 1 addition & 1 deletion examples/proto/gostyle/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//proto:go_proto_library.bzl", "go_proto_library")
load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_proto_library")

genrule(
name = "copy",
Expand Down
4 changes: 2 additions & 2 deletions examples/proto/grpc/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//go:def.bzl", "go_binary")
load("//proto:go_proto_library.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_proto_library")

go_proto_library(
name = "my_svc_proto",
Expand Down
2 changes: 1 addition & 1 deletion examples/proto/lib/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//proto:go_proto_library.bzl", "go_proto_library")
load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_proto_library")

go_proto_library(
name = "lib_proto",
Expand Down
2 changes: 1 addition & 1 deletion examples/stamped_bin/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "go_default_xtest",
Expand Down
2 changes: 1 addition & 1 deletion examples/stamped_bin/stamp/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/vendor/github.com/user/vendored/BUILD

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions go/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:repositories.bzl", "go_repositories")
load("//go/private:go_repository.bzl", "go_repository", "new_go_repository")
load("//go/private:go_prefix.bzl", "go_prefix")
load("//go/private:library.bzl", "go_library")
load("//go/private:binary.bzl", "go_binary")
load("//go/private:test.bzl", "go_test")
load("//go/private:cgo.bzl", "cgo_library", "cgo_genrule")
load("@io_bazel_rules_go//go/private:repositories.bzl", "go_repositories")
load("@io_bazel_rules_go//go/private:go_repository.bzl", "go_repository", "new_go_repository")
load("@io_bazel_rules_go//go/private:go_prefix.bzl", "go_prefix")
load("@io_bazel_rules_go//go/private:library.bzl", "go_library")
load("@io_bazel_rules_go//go/private:binary.bzl", "go_binary")
load("@io_bazel_rules_go//go/private:test.bzl", "go_test")
load("@io_bazel_rules_go//go/private:cgo.bzl", "cgo_library", "cgo_genrule")

"""These are bare-bones Go rules.
Expand Down
4 changes: 2 additions & 2 deletions go/private/asm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:common.bzl", "get_go_toolchain")
load("//go/private:json.bzl", "json_marshal")
load("@io_bazel_rules_go//go/private:common.bzl", "get_go_toolchain")
load("@io_bazel_rules_go//go/private:json.bzl", "json_marshal")

def emit_go_asm_action(ctx, source, hdrs, out_obj):
"""Construct the command line for compiling Go Assembly code.
Expand Down
4 changes: 2 additions & 2 deletions go/private/binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:common.bzl", "get_go_toolchain", "emit_generate_params_action", "go_filetype")
load("//go/private:library.bzl", "emit_library_actions")
load("@io_bazel_rules_go//go/private:common.bzl", "get_go_toolchain", "emit_generate_params_action", "go_filetype")
load("@io_bazel_rules_go//go/private:library.bzl", "emit_library_actions")

def _go_binary_impl(ctx):
"""go_binary_impl emits actions for compiling and linking a go executable."""
Expand Down
6 changes: 3 additions & 3 deletions go/private/cgo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:common.bzl", "get_go_toolchain", "emit_generate_params_action", "go_filetype", "cgo_filetype", "cc_hdr_filetype", "hdr_exts")
load("//go/private:library.bzl", "go_library")
load("//go/private:binary.bzl", "c_linker_options")
load("@io_bazel_rules_go//go/private:common.bzl", "get_go_toolchain", "emit_generate_params_action", "go_filetype", "cgo_filetype", "cc_hdr_filetype", "hdr_exts")
load("@io_bazel_rules_go//go/private:library.bzl", "go_library")
load("@io_bazel_rules_go//go/private:binary.bzl", "c_linker_options")

def _cgo_genrule_impl(ctx):
return struct(
Expand Down
4 changes: 2 additions & 2 deletions go/private/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:common.bzl", "get_go_toolchain", "DEFAULT_LIB", "VENDOR_PREFIX", "go_filetype")
load("//go/private:asm.bzl", "emit_go_asm_action")
load("@io_bazel_rules_go//go/private:common.bzl", "get_go_toolchain", "DEFAULT_LIB", "VENDOR_PREFIX", "go_filetype")
load("@io_bazel_rules_go//go/private:asm.bzl", "emit_go_asm_action")

def emit_library_actions(ctx, sources, deps, cgo_object, library):
go_toolchain = get_go_toolchain(ctx)
Expand Down
2 changes: 1 addition & 1 deletion go/private/lines_sorted_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:files_equal_test.bzl", "files_equal_test")
load("@io_bazel_rules_go//go/private:files_equal_test.bzl", "files_equal_test")

def lines_sorted_test(name, file, cmd="cat $< >$@", visibility=None, **kwargs):
"""Tests that lines within a file are sorted."""
Expand Down
8 changes: 4 additions & 4 deletions go/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

# Once nested repositories work, this file should cease to exist.

load("//go/private:toolchain.bzl", "go_sdk_repository", "go_repository_select")
load("//go/private:repository_tools.bzl", "go_repository_tools")
load("//go/private:bzl_format.bzl", "bzl_format_repositories")
load("//go/private:go_repository.bzl", "go_repository")
load("@io_bazel_rules_go//go/private:toolchain.bzl", "go_sdk_repository", "go_repository_select")
load("@io_bazel_rules_go//go/private:repository_tools.bzl", "go_repository_tools")
load("@io_bazel_rules_go//go/private:bzl_format.bzl", "bzl_format_repositories")
load("@io_bazel_rules_go//go/private:go_repository.bzl", "go_repository")

_sdk_repositories = {
# 1.8.3 repositories
Expand Down
4 changes: 2 additions & 2 deletions go/private/repository_tools.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:go_repository.bzl", "go_repository", "new_go_repository")
load("//go/private:bzl_format.bzl", "bzl_format_repositories")
load("@io_bazel_rules_go//go/private:go_repository.bzl", "go_repository", "new_go_repository")
load("@io_bazel_rules_go//go/private:bzl_format.bzl", "bzl_format_repositories")

_GO_REPOSITORY_TOOLS_BUILD_FILE = """
package(default_visibility = ["//visibility:public"])
Expand Down
6 changes: 3 additions & 3 deletions go/private/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:common.bzl", "get_go_toolchain", "emit_generate_params_action", "go_filetype")
load("//go/private:library.bzl", "emit_library_actions", "go_importpath", "emit_go_compile_action", "get_gc_goopts", "emit_go_pack_action")
load("//go/private:binary.bzl", "emit_go_link_action", "gc_linkopts")
load("@io_bazel_rules_go//go/private:common.bzl", "get_go_toolchain", "emit_generate_params_action", "go_filetype")
load("@io_bazel_rules_go//go/private:library.bzl", "emit_library_actions", "go_importpath", "emit_go_compile_action", "get_gc_goopts", "emit_go_pack_action")
load("@io_bazel_rules_go//go/private:binary.bzl", "emit_go_link_action", "gc_linkopts")

def _go_test_impl(ctx):
"""go_test_impl implements go testing.
Expand Down
2 changes: 1 addition & 1 deletion go/tools/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("//go/private:go_tool_binary.bzl", "go_tool_binary")
load("@io_bazel_rules_go//go/private:go_tool_binary.bzl", "go_tool_binary")

# This binary is used implicitly by go_test().
go_tool_binary(
Expand Down
2 changes: 1 addition & 1 deletion go/tools/bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/builders/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go/private:go_tool_binary.bzl", "go_tool_binary")
load("@io_bazel_rules_go//go/private:go_tool_binary.bzl", "go_tool_binary")

go_tool_binary(
name = "asm",
Expand Down
4 changes: 2 additions & 2 deletions go/tools/extract_package/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//go/private:go_tool_binary.bzl", "go_tool_binary")
load("//go:def.bzl", "go_test")
load("@io_bazel_rules_go//go/private:go_tool_binary.bzl", "go_tool_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_tool_binary(
name = "extract_package",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/fetch_repo/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")

go_binary(
name = "fetch_repo",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/filter_exec/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go/private:go_tool_binary.bzl", "go_tool_binary")
load("@io_bazel_rules_go//go/private:go_tool_binary.bzl", "go_tool_binary")

go_tool_binary(
name = "filter_exec",
Expand Down
4 changes: 2 additions & 2 deletions go/tools/filter_tags/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//go/private:go_tool_binary.bzl", "go_tool_binary")
load("//go:def.bzl", "go_test")
load("@io_bazel_rules_go//go/private:go_tool_binary.bzl", "go_tool_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_tool_binary(
name = "filter_tags",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/gazelle/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_binary", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_binary", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/generator/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/merger/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/packages/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/rules/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/testdata/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package(
default_visibility = ["//go/tools/gazelle:__subpackages__"],
)

load("//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gazelle/wspace/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion go/tools/wtool/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

go_binary(
name = "wtool",
Expand Down
2 changes: 1 addition & 1 deletion tests/asm_include/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

config_setting(
name = "linux_amd64",
Expand Down
4 changes: 2 additions & 2 deletions tests/binary_test_outputs/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This test checks that go_binary and go_test produce a single output file.
# See documentation in single_output_test.bzl.

load("//go:def.bzl", "go_binary", "go_test")
load("//go/private:single_output_test.bzl", "single_output_test")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test")
load("@io_bazel_rules_go//go/private:single_output_test.bzl", "single_output_test")

single_output_test(
name = "binary_single_output_test",
Expand Down
Loading

0 comments on commit 9e5e4fc

Please sign in to comment.