Skip to content

envoy_build_system: use private bazel macros where possible#6926

Merged
htuch merged 7 commits intoenvoyproxy:masterfrom
fcfort:envoy_build_private
May 16, 2019
Merged

envoy_build_system: use private bazel macros where possible#6926
htuch merged 7 commits intoenvoyproxy:masterfrom
fcfort:envoy_build_private

Conversation

@fcfort
Copy link
Copy Markdown
Contributor

@fcfort fcfort commented May 13, 2019

Signed-off-by: Frank Fort ffort@google.com

Description: This PR makes all macros used solely within envoy_build_system.bzl as private by prefixing the macro name with an _ as per https://docs.bazel.build/versions/master/build-ref.html#load. For more background, see #6871 where Envoy's build macro envoy_cc_test_infrastructure_library was made private.

We should strive to restrict visibility of our build macros where possible so that we don't create dependencies on the internal details of our build system where we do not intend to.

Risk Level: Low
Testing: Ran bazel test //test/common/... //test/exe/...
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Frank Fort <ffort@google.com>
Copy link
Copy Markdown
Contributor

@jmillikin-stripe jmillikin-stripe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM modulo a minor comment.
/wait

})

def envoy_select_force_libcpp(if_libcpp, default = None):
def _envoy_select_force_libcpp(if_libcpp, default = None):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think most of the selects here are intended for export. If not, maybe we can regroup them elsewhere and give them a name with "internal" in it to avoid confusion with the exported select macros.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The envoy_select_foo macros that I have marked as private with an _ are all used only within envoy_build_system.bzl, at least within the Envoy code base (and google3 as well). Are you saying that we intentionally want to leave these as part of the public API of envoy_build_system.bzl so that external developers building upon Envoy may rely on them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, I'm suggesting you move them to elsewhere in this file and rename them, since they are not really in the same category as the ones we are exporting, and it's confusing to colocate these in the same section of the file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah gotcha. I moved all the envoy_select_* macros to the bottom and append _internal to them. I'm planning a larger refactor of this file so I didn't move/rename all the private macros.

@htuch htuch self-assigned this May 14, 2019
fcfort added 2 commits May 15, 2019 14:15
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
fcfort added 2 commits May 15, 2019 14:20
This reverts commit 44cb146.

Signed-off-by: Frank Fort <ffort@google.com>
This reverts commit 2932f44.

Signed-off-by: Frank Fort <ffort@google.com>
fcfort added a commit to fcfort/envoy that referenced this pull request May 15, 2019
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@htuch htuch merged commit dd16cb9 into envoyproxy:master May 16, 2019
@fcfort fcfort deleted the envoy_build_private branch May 16, 2019 13:30
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.

4 participants