Skip to content

Commit

Permalink
Merge pull request #1597 from tweag/ip/buildifier-test-target
Browse files Browse the repository at this point in the history
Add buildifier_test target
  • Loading branch information
mergify[bot] authored Dec 15, 2021
2 parents 0547755 + f434ca4 commit b58cfa3
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 4 deletions.
23 changes: 22 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier", "buildifier_test")

exports_files(["start"])

Expand Down Expand Up @@ -48,3 +48,24 @@ buildifier(
mode = "fix",
verbose = True,
)

buildifier_test(
name = "buildifier_test",
srcs = [
"BUILD.bazel",
"WORKSPACE",
"constants.bzl",
"//debug/linking_utils:all_files",
"//docs:all_files",
"//haskell:all_files",
"//nixpkgs:all_files",
"//rule_info:all_files",
"//tests:all_files",
"//tools:all_files",
"@examples-arm//:all_files",
"@examples//:all_files",
"@tutorial//:all_files",
],
mode = "diff",
tags = ["dont_test_on_windows"],
)
15 changes: 15 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,18 @@ bind(
load("//tools:repositories.bzl", "rules_haskell_worker_dependencies")

rules_haskell_worker_dependencies()

local_repository(
name = "tutorial",
path = "tutorial",
)

local_repository(
name = "examples",
path = "examples",
)

local_repository(
name = "examples-arm",
path = "examples/arm",
)
14 changes: 14 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
filegroup(
name = "all_files",
testonly = True,
srcs = [
"BUILD.bazel",
"WORKSPACE",
"//cat_hs:all_files",
"//primitive:all_files",
"//rts:all_files",
"//transformers:all_files",
"//vector:all_files",
],
visibility = ["//visibility:public"],
)
5 changes: 5 additions & 0 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ local_repository(
path = "..",
)

local_repository(
name = "arm",
path = "arm",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies")

Expand Down
17 changes: 17 additions & 0 deletions examples/arm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,20 @@ platform(
"@platforms//cpu:aarch64",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = [
"BUILD.bazel",
"BUILD.zlib.bazel",
"Example.hs",
"Example2.hs",
"LibExample.hs",
"WORKSPACE",
"arm-cross.nix",
"qemu-shell.nix",
"shell.nix",
],
visibility = ["//visibility:public"],
)
11 changes: 11 additions & 0 deletions examples/cat_hs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ haskell_doc(
"//cat_hs/lib/cat",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]) + [
"//cat_hs/exec/cat_hs:all_files",
"//cat_hs/lib/args:all_files",
"//cat_hs/lib/cat:all_files",
],
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/cat_hs/exec/cat_hs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ haskell_binary(
"@stackage//:base",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/cat_hs/lib/args/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ haskell_test(
"@stackage//:optparse-applicative",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/cat_hs/lib/cat/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ haskell_test(
"@stackage//:text",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/primitive/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ haskell_library(
"//transformers",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/rts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ cc_test(
":rts",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/transformers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ haskell_library(
visibility = ["//visibility:public"],
deps = [":base"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions examples/vector/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ haskell_library(
"//primitive",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
3 changes: 0 additions & 3 deletions tests/RunTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import Test.Hspec (context, hspec, it, describe, runIO, shouldSatisfy, expectati

main :: IO ()
main = hspec $ do
it "bazel lint" $ do
assertSuccess (bazel ["run", "//:buildifier"])

it "bazel test" $ do
assertSuccess (bazel ["test", "//..."])

Expand Down
10 changes: 10 additions & 0 deletions tutorial/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]) + [
"//lib:all_files",
"//main:all_files",
"//tools/build_rules:all_files",
],
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tutorial/lib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ haskell_library(
srcs = ["Bool.hs"],
visibility = ["//main:__pkg__"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tutorial/main/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ haskell_test(
"//lib:booleans",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
6 changes: 6 additions & 0 deletions tutorial/tools/build_rules/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)

0 comments on commit b58cfa3

Please sign in to comment.