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

WIP: Gazelle filegroup generation and buildifier_test #1589

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tanyabouman
Copy link
Contributor

This PR adds

  • an internal Gazelle extension which generates filegroups
  • gazelle rules to use the extension
  • the newly generated filegroups
  • a buildifier_test rule to replace buildifier with check.

There are two type of filegroups. The all_files groups make all files in a directory available for the future haskell_bazel_test. These groups are not included in this PR. The starlark_files groups make BUILD, WORKSPACE and other Starlark files available for buildifier_test.

TODO: Gazelle doesn't work properly in nested workspaces.

For example, in examples/BUILD.bazel:

filegroup(
    name = "starlark_files",
    testonly = True,
    srcs = [
        "BUILD.bazel",
        "WORKSPACE",
        "//examples/bazel-bin:starlark_files",
        "//examples/bazel-testlogs:starlark_files",
        "//examples/cat_hs:starlark_files",
        "//examples/primitive:starlark_files",
        "//examples/rts:starlark_files",
        "//examples/transformers:starlark_files",
        "//examples/vector:starlark_files",
    ],

Two problems here:

  • the srcs paths are relative to the top-level workspace, and not the nested one
  • Gazelle is going into bazel-* directories, which it doesn't do at the top level

Things to try:

  • reproduce a smaller example, and file an upstream feature request/bug report
  • run Gazelle from within the nested workspaces (rules_haskell/examples$ bazel run //:gazelle_starlark_files), and don't let the top level run (rules_haskell$ bazel run //:gazelle_starlark_files) go into the nested workspace at all

TODO: Check that Gazelle is including the correct files and directories.

Some of these might need to be specified manually. For example, *.md should probably be excluded, even from all_files, and that doesn't appear to be happening yet.

TODO: something in the CI to run Gazelle to make sure that the filegroups are generated

TODO: try buildifer_test in the nested workspaces: examples, examples/arm, tutorial, tests/c2hs/repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant