Skip to content

Commit

Permalink
Manual fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
achew22 committed Oct 22, 2020
1 parent e89d25e commit 5625751
Show file tree
Hide file tree
Showing 21 changed files with 183 additions and 124 deletions.
11 changes: 0 additions & 11 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependenci

go_embed_data_dependencies()

http_archive(
name = "rules_proto",
sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
# master, as of 2020-01-06
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
],
)

# Used by //tests:buildifier_test.
# Latest release is not compatible with the incompatible bazel flags we use
# in CI, in particular, --incompatible_load_proto_rules_from_bzl.
Expand Down
3 changes: 2 additions & 1 deletion extras/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ bzl_library(
name = "embed_data_deps",
srcs = ["embed_data_deps.bzl"],
visibility = ["//visibility:public"],
deps = ["@bazel_tools//tools/build_defs/repo:git.bzl"],
# Don't list dependency on @bazel_tools//tools/build_defs/repo.bzl
deps = [], # keep
)
44 changes: 32 additions & 12 deletions go/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ bzl_library(
srcs = ["def.bzl"],
visibility = ["//visibility:public"],
deps = [
"@io_bazel_rules_go//extras:embed_data",
"@io_bazel_rules_go//go/private:context",
"@io_bazel_rules_go//go/private:go_toolchain",
"@io_bazel_rules_go//go/private:providers",
"@io_bazel_rules_go//go/private/rules:library",
"@io_bazel_rules_go//go/private/rules:nogo",
"@io_bazel_rules_go//go/private/rules:sdk",
"@io_bazel_rules_go//go/private/rules:source",
"@io_bazel_rules_go//go/private/rules:wrappers",
"@io_bazel_rules_go//go/private/tools:path",
"//extras:embed_data",
"//go/private:context",
"//go/private:go_toolchain",
"//go/private:providers",
"//go/private/rules:library",
"//go/private/rules:nogo",
"//go/private/rules:sdk",
"//go/private/rules:source",
"//go/private/rules:wrappers",
"//go/private/tools:path",
],
)

Expand All @@ -51,7 +51,27 @@ bzl_library(
srcs = ["deps.bzl"],
visibility = ["//visibility:public"],
deps = [
"@io_bazel_rules_go//go/private:repositories",
"@io_bazel_rules_go//go/private:sdk",
"//go/private:repositories",
"//go/private:sdk",
],
)

load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")

stardoc(
name = "def-docs",
out = "def.md",
input = "def.bzl",
deps = [
"//extras:embed_data",
"//go/private:context",
"//go/private:go_toolchain",
"//go/private:providers",
"//go/private/rules:library",
"//go/private/rules:nogo",
"//go/private/rules:sdk",
"//go/private/rules:source",
"//go/private/rules:wrappers",
"//go/private/tools:path",
],
)
20 changes: 10 additions & 10 deletions go/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ may change without notice.
"""

load(
"@io_bazel_rules_go//go/private:context.bzl",
"//go/private:context.bzl",
_go_context = "go_context",
)
load(
"@io_bazel_rules_go//go/private:providers.bzl",
"//go/private:providers.bzl",
_GoArchive = "GoArchive",
_GoArchiveData = "GoArchiveData",
_GoLibrary = "GoLibrary",
Expand All @@ -36,38 +36,38 @@ load(
_GoSource = "GoSource",
)
load(
"@io_bazel_rules_go//go/private/rules:sdk.bzl",
"//go/private/rules:sdk.bzl",
_go_sdk = "go_sdk",
)
load(
"@io_bazel_rules_go//go/private:go_toolchain.bzl",
"//go/private:go_toolchain.bzl",
_declare_toolchains = "declare_toolchains",
_go_toolchain = "go_toolchain",
)
load(
"@io_bazel_rules_go//go/private/rules:wrappers.bzl",
"//go/private/rules:wrappers.bzl",
_go_binary_macro = "go_binary_macro",
_go_library_macro = "go_library_macro",
_go_test_macro = "go_test_macro",
)
load(
"@io_bazel_rules_go//go/private/rules:source.bzl",
"//go/private/rules:source.bzl",
_go_source = "go_source",
)
load(
"@io_bazel_rules_go//extras:embed_data.bzl",
"//extras:embed_data.bzl",
_go_embed_data = "go_embed_data",
)
load(
"@io_bazel_rules_go//go/private/tools:path.bzl",
"//go/private/tools:path.bzl",
_go_path = "go_path",
)
load(
"@io_bazel_rules_go//go/private/rules:library.bzl",
"//go/private/rules:library.bzl",
_go_tool_library = "go_tool_library",
)
load(
"@io_bazel_rules_go//go/private/rules:nogo.bzl",
"//go/private/rules:nogo.bzl",
_nogo = "nogo_wrapper",
)

Expand Down
10 changes: 5 additions & 5 deletions go/platform/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ filegroup(
visibility = ["//visibility:public"],
)

bzl_library(
name = "apple",
srcs = ["apple.bzl"],
)

bzl_library(
name = "list",
srcs = ["list.bzl"],
deps = ["@io_bazel_rules_go//go/private:platforms"],
)

bzl_library(
name = "apple",
srcs = ["apple.bzl"],
)
70 changes: 43 additions & 27 deletions go/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ config_setting(
values = {"stamp": "true"},
)

bzl_library(
name = "common",
srcs = ["common.bzl"],
)

bzl_library(
name = "context",
srcs = ["context.bzl"],
visibility = [
"//extras:__pkg__", # Manually added
"//go:__subpackages__",
],
deps = [
":common",
":mode",
Expand All @@ -56,6 +55,7 @@ bzl_library(
bzl_library(
name = "go_toolchain",
srcs = ["go_toolchain.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@io_bazel_rules_go//go/private:platforms",
"@io_bazel_rules_go//go/private:providers",
Expand All @@ -70,41 +70,23 @@ bzl_library(
],
)

bzl_library(
name = "mode",
srcs = ["mode.bzl"],
)

bzl_library(
name = "nogo",
srcs = ["nogo.bzl"],
)

bzl_library(
name = "platforms",
srcs = ["platforms.bzl"],
)

bzl_library(
name = "providers",
srcs = ["providers.bzl"],
)

bzl_library(
name = "repositories",
srcs = ["repositories.bzl"],
visibility = ["//go:__subpackages__"],
# Don't list dependency on @bazel_tools//tools/build_defs/repo:http.bzl
deps = [
":common",
":nogo",
"//go/private/skylib/lib:versions",
"//proto:gogo",
"@bazel_tools//tools/build_defs/repo:http.bzl",
],
], # keep
)

bzl_library(
name = "sdk",
srcs = ["sdk.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@io_bazel_rules_go//go/private:common",
"@io_bazel_rules_go//go/private:nogo",
Expand All @@ -114,7 +96,41 @@ bzl_library(
],
)

bzl_library(
name = "common",
srcs = ["common.bzl"],
visibility = ["//go:__subpackages__"],
)

bzl_library(
name = "mode",
srcs = ["mode.bzl"],
visibility = ["//go:__subpackages__"],
)

bzl_library(
name = "nogo",
srcs = ["nogo.bzl"],
visibility = ["//go:__subpackages__"],
)

bzl_library(
name = "platforms",
srcs = ["platforms.bzl"],
visibility = ["//go:__subpackages__"],
)

bzl_library(
name = "providers",
srcs = ["providers.bzl"],
visibility = [
"//go:__subpackages__",
"//proto:__pkg__", # keep
],
)

bzl_library(
name = "sdk_list",
srcs = ["sdk_list.bzl"],
visibility = ["//go:__subpackages__"],
)
9 changes: 9 additions & 0 deletions go/private/actions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library(
name = "archive",
srcs = ["archive.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@io_bazel_rules_go//go/private:common",
"@io_bazel_rules_go//go/private:mode",
Expand All @@ -15,12 +16,14 @@ bzl_library(
bzl_library(
name = "asm",
srcs = ["asm.bzl"],
visibility = ["//go:__subpackages__"],
deps = ["@io_bazel_rules_go//go/private:mode"],
)

bzl_library(
name = "binary",
srcs = ["binary.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@io_bazel_rules_go//go/private:common",
"@io_bazel_rules_go//go/private:mode",
Expand All @@ -30,12 +33,14 @@ bzl_library(
bzl_library(
name = "compile",
srcs = ["compile.bzl"],
visibility = ["//go:__subpackages__"],
deps = ["@io_bazel_rules_go//go/private:mode"],
)

bzl_library(
name = "compilepkg",
srcs = ["compilepkg.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@bazel_skylib//lib:shell",
"@io_bazel_rules_go//go/private:mode",
Expand All @@ -45,6 +50,7 @@ bzl_library(
bzl_library(
name = "cover",
srcs = ["cover.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@bazel_skylib//lib:structs",
"@io_bazel_rules_go//go/private:providers",
Expand All @@ -54,6 +60,7 @@ bzl_library(
bzl_library(
name = "link",
srcs = ["link.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@io_bazel_rules_go//go/private:common",
"@io_bazel_rules_go//go/private:mode",
Expand All @@ -63,11 +70,13 @@ bzl_library(
bzl_library(
name = "pack",
srcs = ["pack.bzl"],
visibility = ["//go:__subpackages__"],
)

bzl_library(
name = "stdlib",
srcs = ["stdlib.bzl"],
visibility = ["//go:__subpackages__"],
deps = [
"@io_bazel_rules_go//go/private:mode",
"@io_bazel_rules_go//go/private:providers",
Expand Down
20 changes: 10 additions & 10 deletions go/private/go_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
Toolchain rules used by go.
"""

load("@io_bazel_rules_go//go/private:platforms.bzl", "PLATFORMS")
load("@io_bazel_rules_go//go/private:providers.bzl", "GoSDK")
load("@io_bazel_rules_go//go/private/actions:archive.bzl", "emit_archive")
load("@io_bazel_rules_go//go/private/actions:asm.bzl", "emit_asm")
load("@io_bazel_rules_go//go/private/actions:binary.bzl", "emit_binary")
load("@io_bazel_rules_go//go/private/actions:compile.bzl", "emit_compile")
load("@io_bazel_rules_go//go/private/actions:cover.bzl", "emit_cover")
load("@io_bazel_rules_go//go/private/actions:link.bzl", "emit_link")
load("@io_bazel_rules_go//go/private/actions:pack.bzl", "emit_pack")
load("@io_bazel_rules_go//go/private/actions:stdlib.bzl", "emit_stdlib")
load("//go/private:platforms.bzl", "PLATFORMS")
load("//go/private:providers.bzl", "GoSDK")
load("//go/private/actions:archive.bzl", "emit_archive")
load("//go/private/actions:asm.bzl", "emit_asm")
load("//go/private/actions:binary.bzl", "emit_binary")
load("//go/private/actions:compile.bzl", "emit_compile")
load("//go/private/actions:cover.bzl", "emit_cover")
load("//go/private/actions:link.bzl", "emit_link")
load("//go/private/actions:pack.bzl", "emit_pack")
load("//go/private/actions:stdlib.bzl", "emit_stdlib")

def _go_toolchain_impl(ctx):
sdk = ctx.attr.sdk[GoSDK]
Expand Down
10 changes: 9 additions & 1 deletion go/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,15 @@ def _maybe(repo_rule, name, **kwargs):
repo_rule(name = name, **kwargs)

def _go_name_hack_impl(ctx):
ctx.file("BUILD.bazel")
build_content = """\
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library(
name = "def",
srcs = ["def.bzl"],
)
"""
ctx.file("BUILD.bazel", build_content)
content = "IS_RULES_GO = {}".format(ctx.attr.is_rules_go)
ctx.file("def.bzl", content)

Expand Down

0 comments on commit 5625751

Please sign in to comment.