Skip to content

Commit 7cfd211

Browse files
jayconrodzombiezen
authored andcommitted
Update Bazel WORKSPACE and build files (#118)
1 parent 74ed9ef commit 7cfd211

32 files changed

Lines changed: 82 additions & 47 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: go
22
go_import_path: zombiezen.com/go/capnproto2
33
go:
4-
- 1.4.x
54
- 1.x
65
install: _travis/install.bash
76
script: _travis/build.bash

BUILD.bazel

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_prefix", "go_test")
1+
load("@bazel_gazelle//:def.bzl", "gazelle")
2+
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
23

3-
go_prefix("zombiezen.com/go/capnproto2")
4+
# gazelle:prefix zombiezen.com/go/capnproto2
5+
gazelle(
6+
name = "gazelle",
7+
command = "fix",
8+
)
49

510
go_library(
611
name = "go_default_library",
712
srcs = [
813
"address.go",
14+
"canonical.go",
915
"capability.go",
1016
"capn.go",
1117
"doc.go",
@@ -20,6 +26,7 @@ go_library(
2026
"strings.go",
2127
"struct.go",
2228
],
29+
importpath = "zombiezen.com/go/capnproto2",
2330
visibility = ["//visibility:public"],
2431
deps = [
2532
"//internal/packed:go_default_library",
@@ -33,28 +40,22 @@ go_test(
3340
name = "go_default_test",
3441
srcs = [
3542
"address_test.go",
43+
"canonical_test.go",
3644
"capability_test.go",
3745
"capn_test.go",
46+
"example_test.go",
47+
"integration_test.go",
48+
"integrationutil_test.go",
3849
"list_test.go",
3950
"mem_test.go",
4051
"rawpointer_test.go",
4152
"readlimit_test.go",
4253
],
43-
library = ":go_default_library",
44-
)
45-
46-
go_test(
47-
name = "go_default_xtest",
48-
srcs = [
49-
"example_test.go",
50-
"integration_test.go",
51-
"integrationutil_test.go",
52-
],
5354
data = [
5455
"//internal/aircraftlib:schema",
5556
],
57+
embed = [":go_default_library"],
5658
deps = [
57-
"//:go_default_library",
5859
"//internal/aircraftlib:go_default_library",
5960
"//internal/capnptool:go_default_library",
6061
],

WORKSPACE

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
workspace(name = "com_zombiezen_go_capnproto2")
22

3-
git_repository(
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
46
name = "io_bazel_rules_go",
5-
remote = "https://github.com/bazelbuild/rules_go.git",
6-
commit = "43a3bda3eb97e7bcd86f564a1e0a4b008d6c407c",
7+
sha256 = "8b68d0630d63d95dacc0016c3bb4b76154fe34fca93efd65d1c366de3fcb4294",
8+
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz"],
9+
)
10+
11+
http_archive(
12+
name = "bazel_gazelle",
13+
sha256 = "ddedc7aaeb61f2654d7d7d4fd7940052ea992ccdb031b8f9797ed143ac7e8d43",
14+
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.12.0/bazel-gazelle-0.12.0.tar.gz"],
715
)
816

9-
load("@io_bazel_rules_go//go:def.bzl", "go_repositories", "go_repository")
17+
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
18+
19+
go_rules_dependencies()
20+
21+
go_register_toolchains()
22+
23+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
1024

11-
go_repositories()
25+
gazelle_dependencies()
1226

1327
go_repository(
1428
name = "com_github_kylelemons_godebug",

_travis/install.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ die() {
1313
if [[ -z "$USE_BAZEL" || "$USE_BAZEL" -eq "0" ]]; then
1414
must go get -t ./...
1515
else
16-
BAZEL_VERSION="${BAZEL_VERSION:-0.5.4}"
16+
BAZEL_VERSION="${BAZEL_VERSION:-0.14.1}"
1717
case "$TRAVIS_OS_NAME" in
1818
linux)
1919
BAZEL_INSTALLER_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh"
@@ -32,7 +32,7 @@ else
3232
must /tmp/bazel.sh --user
3333
rm -f /tmp/bazel.sh
3434
if [[ ! -z "$TRAVIS_GO_VERSION" ]]; then
35-
must $SEDI -e "s/^go_repositories(.*/go_repositories(go_version=\"${TRAVIS_GO_VERSION}\")/" WORKSPACE
35+
must $SEDI -e 's/^go_register_toolchains()/go_register_toolchains(go_version="host")/' WORKSPACE
3636
fi
3737
must "$HOME/bin/bazel" --bazelrc=_travis/bazelrc version
3838
must "$HOME/bin/bazel" --bazelrc=_travis/bazelrc fetch //...

capnpc-go/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ go_library(
99
"templateparams.go",
1010
"templates.go",
1111
],
12+
importpath = "zombiezen.com/go/capnproto2/capnpc-go",
1213
visibility = ["//visibility:private"],
1314
deps = [
1415
"//:go_default_library",
@@ -18,15 +19,15 @@ go_library(
1819

1920
go_binary(
2021
name = "capnpc-go",
21-
library = ":go_default_library",
22+
embed = [":go_default_library"],
2223
visibility = ["//visibility:public"],
2324
)
2425

2526
go_test(
2627
name = "go_default_test",
2728
srcs = ["capnpc-go_test.go"],
2829
data = glob(["testdata/**"]),
29-
library = ":go_default_library",
30+
embed = [":go_default_library"],
3031
deps = [
3132
"//:go_default_library",
3233
"//encoding/text:go_default_library",

encoding/text/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
33
go_library(
44
name = "go_default_library",
55
srcs = ["marshal.go"],
6+
importpath = "zombiezen.com/go/capnproto2/encoding/text",
67
visibility = ["//visibility:public"],
78
deps = [
89
"//:go_default_library",
@@ -17,7 +18,7 @@ go_test(
1718
name = "go_default_test",
1819
srcs = ["marshal_test.go"],
1920
data = glob(["testdata/**"]),
20-
library = ":go_default_library",
21+
embed = [":go_default_library"],
2122
deps = [
2223
"//:go_default_library",
2324
"//internal/schema:go_default_library",

internal/aircraftlib/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ go_library(
66
"aircraft.capnp.go",
77
"generate.go",
88
],
9+
importpath = "zombiezen.com/go/capnproto2/internal/aircraftlib",
910
visibility = ["//:__subpackages__"],
1011
deps = [
1112
"//:go_default_library",
@@ -18,6 +19,6 @@ go_library(
1819

1920
filegroup(
2021
name = "schema",
21-
visibility = ["//:__subpackages__"],
2222
srcs = ["aircraft.capnp"],
23+
visibility = ["//:__subpackages__"],
2324
)

internal/capnptool/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
33
go_library(
44
name = "go_default_library",
55
srcs = ["capnptool.go"],
6+
importpath = "zombiezen.com/go/capnproto2/internal/capnptool",
67
visibility = ["//:__subpackages__"],
78
)

internal/demo/BUILD.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
33
go_library(
44
name = "go_default_library",
55
srcs = ["doc.go"],
6+
importpath = "zombiezen.com/go/capnproto2/internal/demo",
67
visibility = ["//:__subpackages__"],
78
)
89

910
go_test(
10-
name = "go_default_xtest",
11+
name = "go_default_test",
1112
srcs = [
1213
"book_test.go",
1314
"hash_test.go",
1415
],
16+
embed = [":go_default_library"],
1517
deps = [
1618
"//:go_default_library",
1719
"//internal/demo/books:go_default_library",

internal/demo/books/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ go_library(
66
"books.capnp.go",
77
"gen.go",
88
],
9+
importpath = "zombiezen.com/go/capnproto2/internal/demo/books",
910
visibility = ["//:__subpackages__"],
1011
deps = [
1112
"//:go_default_library",

0 commit comments

Comments
 (0)