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

Use gazelle for external erlang deps #6935

Merged
merged 19 commits into from
Jan 25, 2023

Conversation

HoloRin
Copy link
Contributor

@HoloRin HoloRin commented Jan 19, 2023

This adds explicit bazel BUILD info for external deps. This allows the windows build to use bzlmod, since the bzlmod extension can only auto-import deps on macos and linux. This in turn allows deletion of workspace_helpers.bzl, and elimination of double bookkeeping.

The BUILD.lib_name files are generated with gazelle, e.g. bazel run gazelle -- update-repos --verbose --build_files_dir=bazel hex.pm/redbug@2.0.7
Running gazelle will update WORKSPACE, but the changes should be ignored (because gazelle doesn't yet support MODULE.bazel files). However, MODULE.bazel should be manually updated accordingly.

@mergify mergify bot added the bazel label Jan 19, 2023
@HoloRin HoloRin force-pushed the rin/use-gazelle-for-external-erlang-deps branch from 4ca2f00 to 4a3fe19 Compare January 24, 2023 10:00
For updating external erlang libraries
This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.
So that it can by dialyzed against
to try to fix some version collisions that seemed to load the wrong
gazelle version in some envs
However, we skip the explicit bazel/BUILD.osiris file, as osiris
already contains the file in its repo
As the correct one now lives in the bazel dir
But skip the explict BUILD.inet_tcp_proxy_dist file, since the repo
already contains a bazel BUILD.bazel file

gazelle command:
`bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
bats is a test dep, so need not be redeclared by bazel workspaces that
import rabbitmq-server
@HoloRin HoloRin force-pushed the rin/use-gazelle-for-external-erlang-deps branch from 4a3fe19 to 0efe67f Compare January 24, 2023 10:10
`bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`
@HoloRin
Copy link
Contributor Author

HoloRin commented Jan 24, 2023

This can be merged once rules_erlang 3.9.1 is released and this branch is updated to use it.

@HoloRin HoloRin marked this pull request as ready for review January 25, 2023 08:37
@HoloRin HoloRin merged commit 2c7b37d into main Jan 25, 2023
@HoloRin HoloRin deleted the rin/use-gazelle-for-external-erlang-deps branch January 25, 2023 08:42
mergify bot pushed a commit that referenced this pull request Jan 25, 2023
* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests

(cherry picked from commit 2c7b37d)

# Conflicts:
#	workspace_helpers.bzl
HoloRin added a commit that referenced this pull request Jan 25, 2023
* Use gazelle for external erlang deps (#6935)

* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests

(cherry picked from commit 2c7b37d)

# Conflicts:
#	workspace_helpers.bzl

* Fixup backport

Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
mergify bot added a commit that referenced this pull request Jan 25, 2023
* Use gazelle for external erlang deps (#6935)

* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests

(cherry picked from commit 2c7b37d)

# Conflicts:
#	workspace_helpers.bzl

* Fixup backport

Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
(cherry picked from commit c6dfe2f)

# Conflicts:
#	MODULE.bazel
#	workspace_helpers.bzl
HoloRin added a commit that referenced this pull request Jan 25, 2023
#7030)

* Use gazelle for external erlang deps (backport #6935) (#7029)

* Use gazelle for external erlang deps (#6935)

* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests

(cherry picked from commit 2c7b37d)

# Conflicts:
#	workspace_helpers.bzl

* Fixup backport

Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
(cherry picked from commit c6dfe2f)

# Conflicts:
#	MODULE.bazel
#	workspace_helpers.bzl

* Fixup backport

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
mergify bot added a commit that referenced this pull request Jan 25, 2023
#7030)

* Use gazelle for external erlang deps (backport #6935) (#7029)

* Use gazelle for external erlang deps (#6935)

* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests

(cherry picked from commit 2c7b37d)

# Conflicts:
#	workspace_helpers.bzl

* Fixup backport

Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
(cherry picked from commit c6dfe2f)

# Conflicts:
#	MODULE.bazel
#	workspace_helpers.bzl

* Fixup backport

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
(cherry picked from commit 85525f3)

# Conflicts:
#	MODULE.bazel
#	workspace_helpers.bzl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant