kobalt
kobalt copied to clipboard
Support "export" for dependencies
While trying to investigate https://github.com/cbeust/kobalt-intellij-plugin/issues/55 bug I noticed that it would be a good idea to suport "export" dependencies in IDEA. For example consider the following project https://github.com/cbeust/ktor/tree/kobalt :
ktor-samples-async depends on ktor-samples but also depends to some libraries which specified in ktor-samples like Kotlin runtime and so on. So this libraries can be "exported" to the dependent modules like this:

@cbeust So it would be good to have the ability to specify dependencies like "exported" in Build.kt.
I'm not sure I understand what you're asking me to do on the Kobalt side...
Cédric
On Thu, Aug 4, 2016 at 2:50 AM, Dmitry Zhuravlev [email protected] wrote:
While trying to investigate cbeust/kobalt-intellij-plugin#55 https://github.com/cbeust/kobalt-intellij-plugin/issues/55 bug I noticed that it would be a good idea to suport "export" dependencies in IDEA. For example consider the following project https://github.com/cbeust/ktor/tree/kobalt : ktor-samples-async depends on ktor-samples but also depends to some libraries which specified in ktor-samples like Kotlin runtime and so on. So this libraries can be "exported" to the dependent modules like this: [image: image] https://cloud.githubusercontent.com/assets/6297697/17399313/0861e286-5a4a-11e6-81ef-d1bea92b9513.png
So it would be good to have the ability to specify dependencies like "exported" in Build.kt.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cbeust/kobalt/issues/301, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFooiUxY-a4BqOGa8KW1OV4ixmNzaJBks5qccPfgaJpZM4Jck2f .
E.g. it could be some boolean flag in Dependencies.compile(export=true) And not only for compile (compile, test, runtime, provided).
Kobalt server should send this flag together with all dependencies.
And I'll extend the plugin to mark such dependencies like exported.
Ok but how do I determine which dependencies get exported?
It is simple: user just specified it in the Build.kt e.g.:
dependencies { compile("com.google.inject:guice:4.0", exported=true) }
Mmmh... Currently, all dependencies are automatically exported, i.e. if you have project A with dependency dep1, then any project that depends on A will automatically get dep1 on its classpath. I'm not sure when you would ever not want that.
So shouldn't all dependencies be exported in IDEA as well?
I can't think of a situation when you'd ever want a dependency not exported.
"I can't think of a situation when you'd ever want a dependency not imported." Maybe the case is when user want to use some other version of library in the classpath but in the same time depends on some other module with another version of library. So in this case it shouldn't be exported. In general I'm not sure if all libraries should be exported by default. In Maven integration it is duplicated and I cannot guess any case when it is exported.
Also the main cons against "export" is because it not so obvious. So you cannot just open the module structure and see all dependencies. You see only one dependency and can only guess that there should be some exported dependency.
Now I think that Kobalt server should send for cases "A depends on B" for module A:
- module "B" like dependency
- all dependencies which "B" have
And we don't need this not obvious "export" at all.
At the moment only 1) point is working. @cbeust could you please add the 2) point in the Kobalt server response?