This repository has been archived by the owner on Mar 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Remove the library() macro and _lib targets #16
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FWIW, LGTM. 🙈 |
dkelmer
suggested changes
Mar 5, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to make sure I understand: let's assume maven jar-A depends on maven jar-B. Before this change, projects could depend on the _lib
target and then use symbols from both jar-A and jar-B? And what you're saying is that with this change, users would need to explicitly depend on jar-B if they wanted to use symbols from it? That definitely sounds like a step in the right direction. I eventually want to ban usage of jar-B entirely unless it's explicitly added to the artifacts
list in the repository rule.
@dkelmer that is exactly right. |
dkelmer
approved these changes
Mar 6, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original motivation for adding _lib targets for every artifact was to ensure that you don't need to specify transitive dependencies on top of the top level artifact in
deps
in order to use the top level artifact. This is already fully wired up in the versionless aliases and thejava_import
andaar_import
targets.For example, if you want to use
junit:junit
which itself depends onorg.hamcrest:hamcrest-core
, you do not need to specifyartifact("org.hamcrest:hamcrest-core")
alongsideartifact("junit:junit")
indeps
, because thejava_import
target forjunit:junit
already depends onorg:hamcrest:hamcrest-core
.The generated
_lib
targets, as it's implemented currently, re-exports the direct dependencies of an artifact, and itself, in ajava_library
. This may be useful to reduce the number of specified artifacts indeps
, but it can hide unnecessary dependencies in the classpath, causing a large over-specification of available compile-time classes. If a target wishes to use an indirect dependency, the target should specify the versionless alias of the indirect dependency in itsdeps
, and not rely on the overspecification of_lib
/library()
targets.