-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Bazel build to work with 4.0.0 (#428)
* Update Bazel build to work with 4.0.0 This includes several updates to the BUILD and WORKSPACE files, so that they now work with Bazel 4.0.0, Gazelle 0.23 and rules_go 0.27. By default, [Gazelle now uses](bazel-contrib/bazel-gazelle#863) the last component of the Bazel package, rather than `go_default_library` as the `go_library name`. This causes problems when the naming conventions do not match. bazel-contrib/bazel-gazelle#890 (comment) Adding support for the new naming convention should not break anything that depends on using the old naming convention, because the Gazelle option `import_alias` makes aliases to the libraries and this allows the old naming convention to still work.
- Loading branch information
1 parent
e52839e
commit 59177e4
Showing
3 changed files
with
54 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
package(default_visibility = ["//visibility:private"]) | ||
|
||
load("@bazel_gazelle//:def.bzl", "gazelle") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
load("@bazel_gazelle//:def.bzl", "gazelle") | ||
|
||
gazelle( | ||
name = "gazelle", | ||
command = "fix", | ||
prefix = "github.com/go-resty/resty/v2", | ||
) | ||
# gazelle:prefix github.com/go-resty/resty/v2 | ||
# gazelle:go_naming_convention import_alias | ||
gazelle(name = "gazelle") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = glob( | ||
["*.go"], | ||
exclude = ["*_test.go"], | ||
), | ||
name = "resty", | ||
srcs = [ | ||
"client.go", | ||
"middleware.go", | ||
"redirect.go", | ||
"request.go", | ||
"response.go", | ||
"resty.go", | ||
"retry.go", | ||
"trace.go", | ||
"transport.go", | ||
"transport112.go", | ||
"util.go", | ||
], | ||
importpath = "github.com/go-resty/resty/v2", | ||
visibility = ["//visibility:public"], | ||
deps = ["@org_golang_x_net//publicsuffix:go_default_library"], | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = | ||
glob( | ||
["*_test.go"], | ||
exclude = ["example_test.go"], | ||
), | ||
data = glob([".testdata/*"]), | ||
embed = [":go_default_library"], | ||
importpath = "github.com/go-resty/resty/v2", | ||
deps = [ | ||
"@org_golang_x_net//proxy:go_default_library", | ||
name = "resty_test", | ||
srcs = [ | ||
"client_test.go", | ||
"context_test.go", | ||
"example_test.go", | ||
"request_test.go", | ||
"resty_test.go", | ||
"retry_test.go", | ||
"util_test.go", | ||
], | ||
data = glob([".testdata/*"]), | ||
embed = [":resty"], | ||
deps = ["@org_golang_x_net//proxy:go_default_library"], | ||
) | ||
|
||
alias( | ||
name = "go_default_library", | ||
actual = ":resty", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters