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

Transitive bazel dependencies have public visibility #94

Closed
realityforge opened this issue Apr 2, 2019 · 3 comments · Fixed by #237
Closed

Transitive bazel dependencies have public visibility #94

realityforge opened this issue Apr 2, 2019 · 3 comments · Fixed by #237

Comments

@realityforge
Copy link
Contributor

As a reasonably new user I found it extremely surprising that a transitive dependency that was not declared in the artifacts attribute had public visibility. I would have expected that the way to make a transitive artifact public was to supply a 2-part spec in the artifacts attribute.

This would make it much easier for relative beginners to read the rules as the public targets would be explicitly declared.

Was this ever considered?

Other than that, it has been reasonably easy to get started. Thanks!

@jin
Copy link
Member

jin commented Apr 2, 2019

Yes, we should definitely restrict the visibility of unspecified artifacts. I'll mark this as a good first issue for anyone to take up if they want to give it a shot.

@jin jin added this to Needs triage in Triage via automation Apr 2, 2019
@jin jin moved this from Needs triage to P1 in Triage Apr 2, 2019
@jin jin moved this from P1 to P2 in Triage Apr 2, 2019
@mpassell
Copy link

This seems like a good idea in principle, but there are unfortunately some dependencies that seem to be specifically set up to bring in dependencies for you to directly reference. The Spring Boot starters would be a good example. It seems like a bad practice to me, but they get used pretty heavily. :( So, even if this gets done, I think there should be an option to turn it off.

@jin
Copy link
Member

jin commented Apr 12, 2019

So, even if this gets done, I think there should be an option to turn it off.

I agree. It's also possible for the rule, or use bazel query, to provide the flat list of artifacts that are actually used, so it's simple to switch to this behavior.

@jin jin closed this as completed in #237 Sep 7, 2019
jin pushed a commit that referenced this issue Sep 7, 2019
)

* Add `strict_visibility` attr to hide transitive dependencies (#94)

This commit adds an attribute, `strict_visibility`, to allow users to hide
transitive Maven dependencies, forcing the user to explicitly name artifacts
in their `maven_install`'s `artifacts` list before being able to reference
in downstream build rules.

Resolves #94.

Testing Done:
- `bazel test //tests/unit/build_tests/...` succeeded.
  `bazel test //tests/unit/build_tests:strict_version_neg` failed, as expected.

* fixup! Add `strict_visibility` attr to hide transitive dependencies (#94)

* fixup! Add `strict_visibility` attr to hide transitive dependencies (#94)

* fixup! Add `strict_visibility` attr to hide transitive dependencies (#94)

* fixup! Add `strict_visibility` attr to hide transitive dependencies (#94)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Triage
  
P2
Development

Successfully merging a pull request may close this issue.

3 participants