-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Creating a JAR With No Dependencies? #55
Comments
It's seems like |
Bingo! The aspect solves a bunch of problems and produces just as many itself... If I'm understanding correctly, this is similar to the issue with C++, where shared upstream dependencies lead to unexpected behavior due to multiple definitions: #25. The solution in that case is to make cpp_*_library interact natively with the C++ compilation, rather than just being a macro around the library function. I expect we'll have to do the same here, unless I've missed the point? |
Yes, I think so. The difference is that everything works on Scala/Java - but the end artifact is somehow tainted.
The provider of
So there's benefits in return all transitive dependencies. That being said - The rule So I think some people will find it useful to get all transitive dependencies - while other won't. I'm assuming that's why I was a flag on the original |
Well, I was able to kinda solve it - but the solution is specific to how ouר Bazel project looks like. I added another argument to the
I'm letting everything compiles, but I modify the
The problem is how I extract the direct ouputs. The logic is very coupled with how I build my project, and it's not a generic solution. Another thing to remember, is that some rules has multiple tools, so Java for example will output two outputs - one for |
This should be resolved in 3.0.0, where non-transitive build is available |
At the moment, when building a Java Library, all dependencies are being included into a single artifact (JAR). For example:
The Jar that will get created will have both the
test.java
class, and thetest2
classes. This is kinda goes against howjava_proto_library
works. The reason it's important for Java users is due to dependency management. Let's say for example I have two Jars. One would betest
(the one defined above), and another one calledtest2
. Both have dependency in['://dependencies:java_dependency']
- but one Jar was created a week ago, and one Jar today and include changes in['://dependencies:java_dependency']
. When both Jars will load, JVM will randomly pick one - and that's a problem.EDIT: Well, this is more complex than I originally thought.
It looks like all the Provider returns all the chain of dependencies. I'm assuming that's on purpose, so you won't have to re-define the same deps on target that use the rule. So while makes writing Bazel easier, it's a problem with Java. Maybe it's worth considering adding a 'Transitive' flag of a sort that defines if the return value form the rule return all transitive dependencies - or just the head.
The text was updated successfully, but these errors were encountered: