Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Don't sync the build file on project open #79

Closed
cbeust opened this issue Apr 1, 2017 · 13 comments
Closed

Don't sync the build file on project open #79

cbeust opened this issue Apr 1, 2017 · 13 comments

Comments

@cbeust
Copy link
Owner

cbeust commented Apr 1, 2017

Whenever I open a project, the plug-in resyncs my build file (even if it doesn't need to), which

  1. Forces me to reconfigure Kotlin for that project
  2. Causes the display of the recv failed message (separate issue filed for that)

I think we should not sync automatically like that and ultimately, we shouldn't have to reconfigure Kotlin every time we sync (I know it's connected to the fact that the Kobalt dependencies have kotlin-compiler-embeddable in them, any progress on fixing that?).

@dmitry-zhuravlev
Copy link
Collaborator

Forces me to reconfigure Kotlin for that project

Kotlin should be configured inside Build.kt script and you will not have that issue.

Causes the display of the recv failed message (separate issue filed for that)

This will be probably muted.

@cbeust
Copy link
Owner Author

cbeust commented Apr 1, 2017 via email

@dmitry-zhuravlev
Copy link
Collaborator

As you remember before Kotlin 1.1 out there was some talks about Kobalt Kotlin configurator. Mentioned about it previously.... e.g. here #69 (comment)

Also it could be done without this configurator by simple adding corresponding dependencies inside Build.kt file.

It is the only one proper way to configure Kotlin runtime- inside Build.kt file.

@cbeust
Copy link
Owner Author

cbeust commented Apr 1, 2017 via email

@dmitry-zhuravlev
Copy link
Collaborator

It is not an extra dependency. Kotlin runtime lib it is regular compile time project dependency which should be explicitly present like other dependencies in the project.

@cbeust
Copy link
Owner Author

cbeust commented Apr 2, 2017

Oh I didn't realize that's all I needed. I just added "org.jetbrains.kotlin:kotlin-runtime:${Versions.kotlin}" and synced and indeed, I didn't get the "Configure Kotlin" dialog".

Great!

I'd rather avoid forcing users to explicitly add this dependency, though, so I think if Kobalt detects a Kotlin project, it will automatically add this dependency (and getDependencyGraph() will return it).

Thoughts?

@dmitry-zhuravlev
Copy link
Collaborator

dmitry-zhuravlev commented Apr 3, 2017

I'd rather avoid forcing users to explicitly add this dependency, though, so I think if Kobalt detects a Kotlin project, it will automatically add this dependency (and getDependencyGraph() will return it).

Yeach it could be like this. But the users should not be forced to use Kotlin version which have Kobalt under the hood.... We again back to the main issue cbeust/kobalt#317

In general: Kotlin version inside Kobalt should not affect Kotlin version inside Kobalt's project.
E.g. user should be able to configure Kotlin embedded compiler together with Kotlin runtime of version 1.0 inside Build.kt definition. So Kobalt should pick the user-defined compiler and use it to compile user's project. But of course the Build.kt file itself could be compiled by latest version of Kotlin compiler which is bundled with Kobalt.

@dmitry-zhuravlev
Copy link
Collaborator

By the way I fixed the cause of "sync on every start". But we should take in mind #79 (comment) and cbeust/kobalt#317

@dmitry-zhuravlev
Copy link
Collaborator

I'd rather avoid forcing users to explicitly add this dependency, though, so I think if Kobalt detects a Kotlin project, it will automatically add this dependency (and getDependencyGraph() will return it).

Actually maybe it is a good solution together with directive kotlinCompiler {version = "...."} But in case if e.g. user have only Java based project.... In this case you shouldn't send Kotlin dependencies in getDependencyGraph(). @cbeust Any thoughts how to determine such case?

@cbeust
Copy link
Owner Author

cbeust commented Apr 6, 2017

Yes, that's trivial with Kobalt's architecture: the Kotlin plug-in can contribute additional classpath entries if it detects .kt files.

@dmitry-zhuravlev
Copy link
Collaborator

Great! In this case lets send at least org.jetbrains.kotlin:kotlin-runtime:${Versions.kotlin} for compile scope and org.jetbrains.kotlin:kotlin-test:${Versions.kotlin} for test scope in getDependencyGraph(). I'll make the corresponding issue for that.

@cbeust
Copy link
Owner Author

cbeust commented Apr 17, 2017

Actually that's already happening: https://github.com/cbeust/kobalt/blob/master/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt#L102

Not sending kotlin-test for test dependencies though, not sure we should.

@dmitry-zhuravlev
Copy link
Collaborator

Actually that's already happening

This doesn't work when Kobalt server send dependencies to plugin... Just recheched in Kobalt 1.0.68

Not sending kotlin-test for test dependencies though, not sure we should.

Actually yes, you are right. Expecialy in case if user don't want to use it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants