Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create "all_files" filegroup contains all rules_haskell sources #1596

Merged
merged 2 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ buildifier_exclude_patterns = [
"./vendor/**",
]

filegroup(
name = "all_files",
testonly = True,
srcs = [
"BUILD.bazel",
"WORKSPACE",
"constants.bzl",
"//debug/linking_utils:all_files",
"//docs:all_files",
"//haskell:all_files",
"//nixpkgs:all_files",
"//protobuf:all_files",
"//rule_info:all_files",
"//tests:all_files",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the buildifer use-case we'll want to include all files under tests to make sure that they are format tested as well. But, for the go_bazel_test use-case perhaps not. Including them means that go_bazel_test type integration tests are re-run not only when rules_haskell's implementation changes, but also when any of its tests changes.
AFAIK rules_go does not include the tests tree in the all_files filegroups.
A simple option might be to omit //tests:all_files here and then add it to the buildifier test explicitly. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A related instance is //vendor. It's needed for functionality, so will be needed for go_bazel_test, but it would be preferable to skip it for buildifier tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it makes sense to enumerate all necessary filegroups in buildifier_test srcs explicitly, because otherwise we'll inevitably end up with some kind of "sources for buildifer_test" filegroup. In this case name all_files is a bit odd for filegroup dedicated for integration_tests. rules_go for example doesn't include tests in all_files but use it both for integration tests and buildifier which is a bit kludgy imho. Some bazelbuild projects like bazel-skylib or rules_python uses name distribution for such filegroup, probably it makes sense to follow

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some bazelbuild projects like bazel-skylib or rules_python uses name distribution for such filegroup, probably it makes sense to follow

Nice find! Yes, that sounds like a good precedent to follow.

Probably it makes sense to enumerate all necessary filegroups in buildifier_test srcs explicitly, [...]

You mean at the top-level something like this?

buildifier_test(
    srcs = [
        "//haskell:all_files",
        "//nixpkgs:all_files",
        "//tests:all_files",
        ...
    ],

Yes, that sounds like a good solution to the problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean at the top-level something like this?

Yes, that's exactly what I meant :)

Copy link
Contributor Author

@k1nkreet k1nkreet Oct 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some bazelbuild projects like bazel-skylib or rules_python uses name distribution for such filegroup, probably it makes sense to follow

Done

"//tools:all_files",
],
visibility = ["//visibility:public"],
)

# Run this to check for errors in BUILD files.
buildifier(
name = "buildifier",
Expand Down
7 changes: 7 additions & 0 deletions debug/linking_utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ if res != {}:
"requires_nix",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
9 changes: 9 additions & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,12 @@ genrule(
"@zip//:bin",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]) + [
"//docs/pandoc:all_files",
],
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions docs/pandoc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ toolchain(
toolchain = "@macos_pandoc//:pandoc_toolchain",
toolchain_type = ":toolchain_type",
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
11 changes: 11 additions & 0 deletions haskell/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,14 @@ config_setting(
haskell_toolchain_info(
name = "toolchain_info",
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]) + [
"//haskell/c2hs:all_files",
"//haskell/experimental:all_files",
"//haskell/platforms:all_files",
],
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions haskell/c2hs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ toolchain_type(
name = "toolchain",
visibility = ["//visibility:public"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
9 changes: 9 additions & 0 deletions haskell/experimental/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ exports_files([
"defs.bzl",
"transitions.bzl",
])

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]) + [
"//haskell/experimental/private:all_files",
],
visibility = ["//visibility:public"],
)
6 changes: 6 additions & 0 deletions haskell/experimental/private/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"],
)
7 changes: 7 additions & 0 deletions haskell/platforms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ alias(
deprecation = "Use @io_tweag_rules_nixpkgs//nixpkgs/platforms:host instead.",
visibility = ["//visibility:public"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
6 changes: 6 additions & 0 deletions nixpkgs/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"],
)
7 changes: 7 additions & 0 deletions protobuf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ toolchain_type(
name = "toolchain",
visibility = ["//visibility:public"],
)

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

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
98 changes: 98 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,101 @@ haskell_repl(
"//tests/binary-with-lib",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]) + [
"//tests/binary-custom-main:all_files",
"//tests/binary-dynamic:all_files",
"//tests/binary-exe-path:all_files",
"//tests/binary-indirect-cbits:all_files",
"//tests/binary-linkstatic-flag:all_files",
"//tests/binary-simple:all_files",
"//tests/binary-with-compiler-flags:all_files",
"//tests/binary-with-data:all_files",
"//tests/binary-with-import:all_files",
"//tests/binary-with-indirect-sysdeps:all_files",
"//tests/binary-with-lib:all_files",
"//tests/binary-with-lib-dynamic:all_files",
"//tests/binary-with-link-flags:all_files",
"//tests/binary-with-main:all_files",
"//tests/binary-with-plugin:all_files",
"//tests/binary-with-prebuilt:all_files",
"//tests/binary-with-sysdeps:all_files",
"//tests/binary-with-tool:all_files",
"//tests/c2hs:all_files",
"//tests/cabal-toolchain-flags:all_files",
"//tests/cc_haskell_import:all_files",
"//tests/c-compiles:all_files",
"//tests/c-compiles-still:all_files",
"//tests/cpp_macro_conflict:all_files",
"//tests/data:all_files",
"//tests/encoding:all_files",
"//tests/external-haskell-repository:all_files",
"//tests/extra-source-files:all_files",
"//tests/generated-modules:all_files",
"//tests/ghc:all_files",
"//tests/ghc-check:all_files",
"//tests/ghcide:all_files",
"//tests/hackage:all_files",
"//tests/haddock:all_files",
"//tests/haddock_protobuf:all_files",
"//tests/haddock-with-plugin:all_files",
"//tests/haskell_cabal_binary:all_files",
"//tests/haskell_cabal_doctest:all_files",
"//tests/haskell_cabal_library:all_files",
"//tests/haskell_cabal_library_depends_on_haskell_library:all_files",
"//tests/haskell_cabal_library_sublibrary_name:all_files",
"//tests/haskell_cabal_package:all_files",
"//tests/haskell_doctest:all_files",
"//tests/haskell_import:all_files",
"//tests/haskell_module:all_files",
"//tests/haskell_proto_library:all_files",
"//tests/haskell_proto_simple:all_files",
"//tests/haskell_test:all_files",
"//tests/haskell_toolchain_library:all_files",
"//tests/hidden-modules:all_files",
"//tests/hie-bios:all_files",
"//tests/hs-boot:all_files",
"//tests/hsc:all_files",
"//tests/indirect-link:all_files",
"//tests/java_classpath:all_files",
"//tests/lhs:all_files",
"//tests/library-deps:all_files",
"//tests/library-empty:all_files",
"//tests/library-exports:all_files",
"//tests/library-linkstatic-flag:all_files",
"//tests/library-with-cbits:all_files",
"//tests/library-with-includes:all_files",
"//tests/library-with-static-cc-dep:all_files",
"//tests/library-with-sysdeps:all_files",
"//tests/library-with-sysincludes:all_files",
"//tests/multi_repl:all_files",
"//tests/package_configuration:all_files",
"//tests/package-id-clash:all_files",
"//tests/package-id-clash-binary:all_files",
"//tests/package-name:all_files",
"//tests/package-reexport:all_files",
"//tests/plugin-install-order:all_files",
"//tests/repl-flags:all_files",
"//tests/repl-make-variables:all_files",
"//tests/repl-multiple-definition:all_files",
"//tests/repl-name-conflicts:all_files",
"//tests/repl-targets:all_files",
"//tests/runfiles:all_files",
"//tests/sandwich:all_files",
"//tests/shellcheck:all_files",
"//tests/solib_dir:all_files",
"//tests/stackage_zlib_runpath:all_files",
"//tests/stack-snapshot-deps:all_files",
"//tests/target-name:all_files",
"//tests/template-haskell-with-cbits:all_files",
"//tests/textual-hdrs:all_files",
"//tests/two-libs:all_files",
"//tests/two-same-file:all_files",
"//tests/unit-tests:all_files",
"//tests/version-macros:all_files",
],
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-custom-main/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ haskell_test(
visibility = ["//visibility:public"],
deps = ["//tests/hackage:base"],
)

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

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-exe-path/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ haskell_test(
visibility = ["//visibility:public"],
deps = ["//tests/hackage:base"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-indirect-cbits/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ haskell_binary(
"//tests/library-with-cbits:library-with-cbits-static",
],
)

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

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

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

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-with-data/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ haskell_test(
"//tools/runfiles",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-with-import/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ haskell_test(
"//tests/hackage:base",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-with-indirect-sysdeps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ haskell_test(
"//tests/hackage:base",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-with-lib-dynamic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ dynamic_libraries_in_runfiles_test(
],
target_under_test = ":binary-with-lib-dynamic",
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-with-lib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ haskell_test(
"//tests/hackage:template-haskell",
],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions tests/binary-with-link-flags/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ haskell_test(
visibility = ["//visibility:public"],
deps = ["//tests/hackage:base"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
Loading