Skip to content

Commit

Permalink
Update Bazel WORKSPACE and build files (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayconrod authored and zombiezen committed Jun 16, 2018
1 parent 74ed9ef commit 7cfd211
Show file tree
Hide file tree
Showing 32 changed files with 82 additions and 47 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: go
go_import_path: zombiezen.com/go/capnproto2
go:
- 1.4.x
- 1.x
install: _travis/install.bash
script: _travis/build.bash
Expand Down
27 changes: 14 additions & 13 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_prefix", "go_test")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_prefix("zombiezen.com/go/capnproto2")
# gazelle:prefix zombiezen.com/go/capnproto2
gazelle(
name = "gazelle",
command = "fix",
)

go_library(
name = "go_default_library",
srcs = [
"address.go",
"canonical.go",
"capability.go",
"capn.go",
"doc.go",
Expand All @@ -20,6 +26,7 @@ go_library(
"strings.go",
"struct.go",
],
importpath = "zombiezen.com/go/capnproto2",
visibility = ["//visibility:public"],
deps = [
"//internal/packed:go_default_library",
Expand All @@ -33,28 +40,22 @@ go_test(
name = "go_default_test",
srcs = [
"address_test.go",
"canonical_test.go",
"capability_test.go",
"capn_test.go",
"example_test.go",
"integration_test.go",
"integrationutil_test.go",
"list_test.go",
"mem_test.go",
"rawpointer_test.go",
"readlimit_test.go",
],
library = ":go_default_library",
)

go_test(
name = "go_default_xtest",
srcs = [
"example_test.go",
"integration_test.go",
"integrationutil_test.go",
],
data = [
"//internal/aircraftlib:schema",
],
embed = [":go_default_library"],
deps = [
"//:go_default_library",
"//internal/aircraftlib:go_default_library",
"//internal/capnptool:go_default_library",
],
Expand Down
24 changes: 19 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
workspace(name = "com_zombiezen_go_capnproto2")

git_repository(
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
remote = "https://github.com/bazelbuild/rules_go.git",
commit = "43a3bda3eb97e7bcd86f564a1e0a4b008d6c407c",
sha256 = "8b68d0630d63d95dacc0016c3bb4b76154fe34fca93efd65d1c366de3fcb4294",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz"],
)

http_archive(
name = "bazel_gazelle",
sha256 = "ddedc7aaeb61f2654d7d7d4fd7940052ea992ccdb031b8f9797ed143ac7e8d43",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.12.0/bazel-gazelle-0.12.0.tar.gz"],
)

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

go_rules_dependencies()

go_register_toolchains()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

go_repositories()
gazelle_dependencies()

go_repository(
name = "com_github_kylelemons_godebug",
Expand Down
4 changes: 2 additions & 2 deletions _travis/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ die() {
if [[ -z "$USE_BAZEL" || "$USE_BAZEL" -eq "0" ]]; then
must go get -t ./...
else
BAZEL_VERSION="${BAZEL_VERSION:-0.5.4}"
BAZEL_VERSION="${BAZEL_VERSION:-0.14.1}"
case "$TRAVIS_OS_NAME" in
linux)
BAZEL_INSTALLER_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh"
Expand All @@ -32,7 +32,7 @@ else
must /tmp/bazel.sh --user
rm -f /tmp/bazel.sh
if [[ ! -z "$TRAVIS_GO_VERSION" ]]; then
must $SEDI -e "s/^go_repositories(.*/go_repositories(go_version=\"${TRAVIS_GO_VERSION}\")/" WORKSPACE
must $SEDI -e 's/^go_register_toolchains()/go_register_toolchains(go_version="host")/' WORKSPACE
fi
must "$HOME/bin/bazel" --bazelrc=_travis/bazelrc version
must "$HOME/bin/bazel" --bazelrc=_travis/bazelrc fetch //...
Expand Down
5 changes: 3 additions & 2 deletions capnpc-go/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ go_library(
"templateparams.go",
"templates.go",
],
importpath = "zombiezen.com/go/capnproto2/capnpc-go",
visibility = ["//visibility:private"],
deps = [
"//:go_default_library",
Expand All @@ -18,15 +19,15 @@ go_library(

go_binary(
name = "capnpc-go",
library = ":go_default_library",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)

go_test(
name = "go_default_test",
srcs = ["capnpc-go_test.go"],
data = glob(["testdata/**"]),
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//:go_default_library",
"//encoding/text:go_default_library",
Expand Down
3 changes: 2 additions & 1 deletion encoding/text/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["marshal.go"],
importpath = "zombiezen.com/go/capnproto2/encoding/text",
visibility = ["//visibility:public"],
deps = [
"//:go_default_library",
Expand All @@ -17,7 +18,7 @@ go_test(
name = "go_default_test",
srcs = ["marshal_test.go"],
data = glob(["testdata/**"]),
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//:go_default_library",
"//internal/schema:go_default_library",
Expand Down
3 changes: 2 additions & 1 deletion internal/aircraftlib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
"aircraft.capnp.go",
"generate.go",
],
importpath = "zombiezen.com/go/capnproto2/internal/aircraftlib",
visibility = ["//:__subpackages__"],
deps = [
"//:go_default_library",
Expand All @@ -18,6 +19,6 @@ go_library(

filegroup(
name = "schema",
visibility = ["//:__subpackages__"],
srcs = ["aircraft.capnp"],
visibility = ["//:__subpackages__"],
)
1 change: 1 addition & 0 deletions internal/capnptool/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["capnptool.go"],
importpath = "zombiezen.com/go/capnproto2/internal/capnptool",
visibility = ["//:__subpackages__"],
)
4 changes: 3 additions & 1 deletion internal/demo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["doc.go"],
importpath = "zombiezen.com/go/capnproto2/internal/demo",
visibility = ["//:__subpackages__"],
)

go_test(
name = "go_default_xtest",
name = "go_default_test",
srcs = [
"book_test.go",
"hash_test.go",
],
embed = [":go_default_library"],
deps = [
"//:go_default_library",
"//internal/demo/books:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions internal/demo/books/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
"books.capnp.go",
"gen.go",
],
importpath = "zombiezen.com/go/capnproto2/internal/demo/books",
visibility = ["//:__subpackages__"],
deps = [
"//:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions internal/demo/hashes/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
"gen.go",
"hash.capnp.go",
],
importpath = "zombiezen.com/go/capnproto2/internal/demo/hashes",
visibility = ["//:__subpackages__"],
deps = [
"//:go_default_library",
Expand Down
3 changes: 2 additions & 1 deletion internal/fulfiller/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["fulfiller.go"],
importpath = "zombiezen.com/go/capnproto2/internal/fulfiller",
visibility = ["//:__subpackages__"],
deps = [
"//:go_default_library",
Expand All @@ -13,6 +14,6 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["fulfiller_test.go"],
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//:go_default_library"],
)
1 change: 1 addition & 0 deletions internal/nodemap/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["nodemap.go"],
importpath = "zombiezen.com/go/capnproto2/internal/nodemap",
visibility = ["//:__subpackages__"],
deps = [
"//:go_default_library",
Expand Down
3 changes: 2 additions & 1 deletion internal/packed/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ go_library(
"discard_go14.go",
"packed.go",
],
importpath = "zombiezen.com/go/capnproto2/internal/packed",
visibility = ["//:__subpackages__"],
)

go_test(
name = "go_default_test",
srcs = ["packed_test.go"],
data = glob(["testdata/**"]),
library = ":go_default_library",
embed = [":go_default_library"],
)
3 changes: 2 additions & 1 deletion internal/queue/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["queue.go"],
importpath = "zombiezen.com/go/capnproto2/internal/queue",
visibility = ["//:__subpackages__"],
)

go_test(
name = "go_default_test",
srcs = ["queue_test.go"],
library = ":go_default_library",
embed = [":go_default_library"],
)
1 change: 1 addition & 0 deletions internal/schema/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["schema.capnp.go"],
importpath = "zombiezen.com/go/capnproto2/internal/schema",
visibility = ["//:__subpackages__"],
deps = ["//:go_default_library"],
)
1 change: 1 addition & 0 deletions internal/strquote/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["strquote.go"],
importpath = "zombiezen.com/go/capnproto2/internal/strquote",
visibility = ["//:__subpackages__"],
)
15 changes: 4 additions & 11 deletions pogs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ go_library(
"fields.go",
"insert.go",
],
importpath = "zombiezen.com/go/capnproto2/pogs",
visibility = ["//visibility:public"],
deps = [
"//:go_default_library",
Expand All @@ -21,24 +22,16 @@ go_test(
srcs = [
"bench_test.go",
"embed_test.go",
"example_test.go",
"interface_test.go",
"pogs_test.go",
],
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//:go_default_library",
"//internal/aircraftlib:go_default_library",
"//internal/demo/books:go_default_library",
"@com_github_kylelemons_godebug//pretty:go_default_library",
"@org_golang_x_net//context:go_default_library",
],
)

go_test(
name = "go_default_xtest",
srcs = ["example_test.go"],
deps = [
":go_default_library",
"//:go_default_library",
"//internal/demo/books:go_default_library",
],
)
5 changes: 3 additions & 2 deletions rpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ go_library(
"tables.go",
"transport.go",
],
importpath = "zombiezen.com/go/capnproto2/rpc",
visibility = ["//visibility:public"],
deps = [
"//:go_default_library",
Expand All @@ -24,7 +25,7 @@ go_library(
)

go_test(
name = "go_default_xtest",
name = "go_default_test",
srcs = [
"bench_test.go",
"cancel_test.go",
Expand All @@ -35,8 +36,8 @@ go_test(
"release_test.go",
"rpc_test.go",
],
embed = [":go_default_library"],
deps = [
":go_default_library",
"//:go_default_library",
"//rpc/internal/logtransport:go_default_library",
"//rpc/internal/pipetransport:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions rpc/internal/logtransport/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["logtransport.go"],
importpath = "zombiezen.com/go/capnproto2/rpc/internal/logtransport",
visibility = ["//rpc:__subpackages__"],
deps = [
"//encoding/text:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions rpc/internal/logutil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["logutil.go"],
importpath = "zombiezen.com/go/capnproto2/rpc/internal/logutil",
visibility = ["//rpc:__subpackages__"],
)
1 change: 1 addition & 0 deletions rpc/internal/pipetransport/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["pipetransport.go"],
importpath = "zombiezen.com/go/capnproto2/rpc/internal/pipetransport",
visibility = ["//rpc:__subpackages__"],
deps = [
"//:go_default_library",
Expand Down
3 changes: 2 additions & 1 deletion rpc/internal/refcount/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["refcount.go"],
importpath = "zombiezen.com/go/capnproto2/rpc/internal/refcount",
visibility = ["//rpc:__subpackages__"],
deps = ["//:go_default_library"],
)

go_test(
name = "go_default_test",
srcs = ["refcount_test.go"],
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//:go_default_library"],
)
Loading

0 comments on commit 7cfd211

Please sign in to comment.