Skip to content

Commit

Permalink
Some random clean-ups (#179)
Browse files Browse the repository at this point in the history
* Bump rules_go, gazelle versions, upgrade go-version to v1.2.1, re-run gazelle

* Remove //:go_version_test target, remove LDFLAGS from Windows, build and test everything on CI

* Disable //:py3_bazelisk_test on Windows only
  • Loading branch information
philwo committed Oct 6, 2020
1 parent b6da6d4 commit 70eecfe
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 75 deletions.
33 changes: 14 additions & 19 deletions .bazelci/config.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
---
platforms:
ubuntu1604:
build_targets:
- //...
test_targets:
- //:go_bazelisk_test
- //:go_default_test
- //:go_version_test
- //:py_bazelisk_test
- //:py3_bazelisk_test
- //...
test_flags:
- --flaky_test_attempts=1
- --test_output=streamed
ubuntu1804:
build_targets:
- //...
test_targets:
- //:go_bazelisk_test
- //:go_default_test
- //:go_version_test
- //:py_bazelisk_test
- //:py3_bazelisk_test
- //...
test_flags:
- --flaky_test_attempts=1
- --test_output=streamed
macos:
build_targets:
- //...
test_targets:
- //:go_bazelisk_test
- //:go_default_test
- //:go_version_test
- //:py_bazelisk_test
- //:py3_bazelisk_test
- //...
test_flags:
- --flaky_test_attempts=1
- --test_output=streamed
windows:
build_targets:
- //...
test_targets:
- //:go_bazelisk_test
- //:go_default_test
- //:go_version_test
- //:py_bazelisk_test
- //...
# Windows doesn't have a `python3` executable on PATH.
- -//:py3_bazelisk_test
test_flags:
- --flaky_test_attempts=1
- --test_env=PATH
Expand Down
34 changes: 10 additions & 24 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,27 @@ go_library(
visibility = ["//visibility:private"],
x_defs = {"BazeliskVersion": "{STABLE_VERSION}"},
deps = [
"//core",
"//httputil",
"//repositories",
"//versions",
"//core:go_default_library",
"//repositories:go_default_library",
],
)

go_test(
name = "go_default_test",
srcs = ["bazelisk_test.go"],
srcs = [
"bazelisk_test.go",
"bazelisk_version_test.go",
],
data = [
"sample-issues-migration.json",
],
embed = [":go_default_library"],
importpath = "github.com/bazelbuild/bazelisk",
deps = [
"//core",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)

go_test(
name = "go_version_test",
srcs = ["bazelisk_version_test.go"],
embed = [":go_default_library"],
importpath = "github.com/bazelbuild/bazelisk",
deps = [
"//core",
"//httputil",
"//repositories",
"//versions",
"//core:go_default_library",
"//httputil:go_default_library",
"//repositories:go_default_library",
"//versions:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
Expand Down Expand Up @@ -132,10 +122,6 @@ go_binary(
name = "bazelisk-windows",
out = "bazelisk-windows_amd64.exe",
embed = [":go_default_library"],
gc_linkopts = [
"-s",
"-w",
],
goarch = "amd64",
goos = "windows",
pure = "on",
Expand Down
23 changes: 15 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "7f1aa43d986df189f7cf30e81dd2dc9d8ed7c74e356341a17267f6d7e5748382",
sha256 = "b725e6497741d7fc2d55fcc29a276627d10e43fa5d0bb692692890ae30d98d00",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.1/rules_go-v0.24.1.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.1/rules_go-v0.24.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.3/rules_go-v0.24.3.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.3/rules_go-v0.24.3.tar.gz",
],
)

Expand All @@ -17,23 +17,30 @@ go_register_toolchains()

http_archive(
name = "bazel_gazelle",
sha256 = "d4113967ab451dd4d2d767c3ca5f927fec4b30f3b2c6f8135a2033b9c05a5687",
sha256 = "72d339ff874a382f819aaea80669be049069f502d6c726a07759fdca99653c48",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.0/bazel-gazelle-v0.22.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.0/bazel-gazelle-v0.22.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.1/bazel-gazelle-v0.22.1.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.1/bazel-gazelle-v0.22.1.tar.gz",
],
)

# Load and call Gazelle dependencies
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

go_repository(
name = "com_github_bazelbuild_rules_go",
importpath = "github.com/bazelbuild/rules_go",
sum = "h1:BKNgfYF+WS0pBpmMy2w9k6TqMpxuzL3JI0oWmhZ4JRU=",
version = "v0.24.3",
)

gazelle_dependencies()

go_repository(
name = "com_github_hashicorp_go_version",
importpath = "github.com/hashicorp/go-version",
sum = "h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=",
version = "v1.2.0",
sum = "h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=",
version = "v1.2.1",
)

go_repository(
Expand Down
12 changes: 5 additions & 7 deletions core/BUILD
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "core",
name = "go_default_library",
srcs = [
"core.go",
"repositories.go",
],
importpath = "github.com/bazelbuild/bazelisk/core",
visibility = ["//visibility:public"],
deps = [
"@com_github_hashicorp_go_version//:go_default_library",
"//httputil:go_default_library",
"//platforms:go_default_library",
"//versions:go_default_library",
"@com_github_mitchellh_go_homedir//:go_default_library",
"//httputil",
"//platforms",
"//repositories",
"//versions",
],
)
)
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/bazelbuild/bazelisk
go 1.15

require (
github.com/hashicorp/go-version v1.2.0
github.com/bazelbuild/rules_go v0.24.3
github.com/hashicorp/go-version v1.2.1
github.com/mitchellh/go-homedir v1.1.0
)
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/bazelbuild/rules_go v0.24.3 h1:BKNgfYF+WS0pBpmMy2w9k6TqMpxuzL3JI0oWmhZ4JRU=
github.com/bazelbuild/rules_go v0.24.3/go.mod h1:MC23Dc/wkXEyk3Wpq6lCqz0ZAYOZDw2DR5y3N1q2i7M=
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
4 changes: 2 additions & 2 deletions httputil/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "httputil",
name = "go_default_library",
srcs = ["httputil.go"],
importpath = "github.com/bazelbuild/bazelisk/httputil",
visibility = ["//visibility:public"],
)
)
4 changes: 2 additions & 2 deletions platforms/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "platforms",
name = "go_default_library",
srcs = ["platforms.go"],
importpath = "github.com/bazelbuild/bazelisk/platforms",
visibility = ["//visibility:public"],
)
)
10 changes: 5 additions & 5 deletions repositories/BUILD
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "repositories",
name = "go_default_library",
srcs = [
"gcs.go",
"github.go",
],
importpath = "github.com/bazelbuild/bazelisk/repositories",
visibility = ["//visibility:public"],
deps = [
"//httputil",
"//platforms",
"//versions",
"//httputil:go_default_library",
"//platforms:go_default_library",
"//versions:go_default_library",
],
)
)
8 changes: 3 additions & 5 deletions versions/BUILD
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "versions",
srcs = [
"versions.go",
],
name = "go_default_library",
srcs = ["versions.go"],
importpath = "github.com/bazelbuild/bazelisk/versions",
visibility = ["//visibility:public"],
deps = [
"@com_github_hashicorp_go_version//:go_default_library",
],
)
)

0 comments on commit 70eecfe

Please sign in to comment.