Several issues with IDEA plugin and the app itself
Closed this issue · 19 comments
It is my second attempt to use your application. Now i'm doing a server (not for Android).
I have several issues. Some of them are really annoying. Some of them just breaks everything.
- Sometimes when Kobalt syncs it remakes IDEA folder structure. So if i marked some of the folders with different marks (Source folder, excluded, etc) it will not be preserved.
- It deletes my main module and only module named Build with Build.kt exists. So i'm unable to setup module for src/main/kotlin/com/avently/something. This means i see only Build module in plugin from the right side of the screen and in the left side of the screen in IDEA "packages" tab
- It doesn't deletes library that was removed from Build.kt
- It doesn't add sometimes to class path libraries that was added in a proccess of making an app (first sync was OK, something breaks after minutes/hours from first sync)
- It shows:
PARALLEL BUILD SUCCESSFUL (16 SECONDS)
but before that it shows:
ERROR Error: Could not find artifact io.reactivex:rxkotlin:jar:2.2.0 in https___clojars.org_repo (https://clojars.org/repo/
So the error happened but it tells me that everything is fine. - I'm getting "Could not find or load main class com.avently.myapp.MainKt" error even after i wrote to a config:
assemble {
jar {
fatJar = true
name = projectName + ".jar"
manifest {
attributes("Main-Class", "$group.$artifactId.MainKt")
}
}
}
application {
mainClass = "$group.$artifactId.MainKt"
}
and then executed ./kobaltw clean
You know why? I know. Jar file doesn't contain any of my classes. Only classes from external libs located in the jar.
7. It doesn't show any errors in the IDEA UI if it couldn't find a library in a specified location on the repo. Looks like everything is OK but its false.
8. After i clicked "Import changes" button from notification window and then clicked tried to build a project i got:
11:25:13: Executing task 'run'...
no such object in table
11:25:14: Task execution finished 'run'.
- Seems like it doesn't set chmod +x to a java file. I needed to do it manually
I really really like the idea behind Kobalt and that's why i'm returned to it after fail with Android version. But it makes impossible to use it in any of my projects. Do you have the same problems?
Uploaded Build.kt to Gist https://gist.github.com/avently/eb826e6398fe84eab7c603aba1975a68
- fixed after removing 'directory = "src"'
Other issues with Kobalt binary are not so sirious. So i just deleted the plugin for IDEA and starting a build from command line. Speed and memory usage is fantastic.
Thanks for the update, I'll look into this soon.
@cbeust can you suggest me how to run Kobalt in server mode? I'm doing this:
./kobaltw --server
in terminal
Then in IDEA i'm executing another command:
./kobaltw run --client
And getting this:
xception in thread "main" java.lang.NoSuchMethodError: okhttp3.internal.Internal.setCallWebSocket(Lokhttp3/Call;)V
at okhttp3.ws.WebSocketCall.enqueue(WebSocketCall.java:108)
at com.beust.kobalt.app.remote.KobaltClient.run(KobaltClient.kt:42)
at com.beust.kobalt.Main.run(Main.kt:108)
at com.beust.kobalt.Main$Companion.launchMain(Main.kt:71)
at com.beust.kobalt.Main$Companion.mainNoExit(Main.kt:50)
at com.beust.kobalt.MainKt.main(Main.kt:20)
In that situation server listens on port 1234 for some reason and it it accessible via browser:
Listening on 0.0.0.0:1234
Kobalt has version 1.0.110
Mmmh that should work since this is how the IDEA plug-in runs. I'll take a look.
I can reproduce the problem. Looks like there is an old version of okhttp that was included in the jar file, but that's a bug.
Ok this is fixed in 1.0.111
. Update (./kobaltw --update)
and then launch both with ./kobaltw --server
and ./kobaltw --client
.
Seems like when i use ./kobaltw assemble --client
it uses port 1240 but server listens on 1234 by default. If i write command like this: ./kobaltw assemble --client --port 1234
it just ignores port and trying to connect to 1240. So the one solution here is to start a server on port 1240. Then it works.
Now it shows this info for a ~1 minute:
Received dependency data for 0 projects Closing socket
Then exits with error code 0 (everything is fine).
Maybe you setup timeout or something. Because ordinary compilation without a server takes about 10 seconds. Project has only a couple of files.
First of all, it's not very common to run both assemble
and --client
. Usually, it's one or the other.
But I have indeed noticed some odd port / port file behavior similar to what you describe, I'll look into it.
So how the server will know what to do without a task specified?
I tried to start without --assemble
but ~1 minute waiting still exists
The Kobalt server right now is not a build daemon, like Gradle (but it would be trivial to achieve if necessary).
Right now, all the Kobalt server does is return dependencies for a project, and this is achieved by the client (e.g. IDEA) hitting a specific URL on the server (/v1/getDependencyGraph
, see SparkServer.kt
). The IDEA plug-in spawns a Kobalt server, sends an HTTP call to that URL, retrieves the dependencies and then configures the classpaths and modules with that information.
I totally understand your expectation :-)
Like I said, it would be trivial to turn this into a build daemon: add a new URL with possibly query parameters, e.g. /v1/call?target=assemble¶meters=kobalt:compile
.call the Kobalt command and return its result in JSON form.
I'll do that at some point but performance is not really a huge problem in Kobalt at this time.
@cbeust i'm often see one strange situation. Kobalt tries to build my app with command ./kobaltw assemble
but shows me an error like this:
Kotlin 1.2.10 compiling 13 files
Kotlin incremental compilation is enabled
*****
***** ERROR Couldn't compile file: val somehthing: BigDecimal = Utils.someFunction(conf)
/home/avently/app/src/main/kotlin/com/avently/app/SomeClass.kt:33:48 Cannot access class 'com.avently.app.AnotherClass'. Check your module classpath for missing or conflicting dependencies
*****
*****
***** ERROR Couldn't compile file: Source file or directory not found: /tmp/./src/main/kotlin/com/avently/app/YetAnotherClass.kt
*****
*****
***** ERROR Error: com.beust.kobalt.KobaltException: Couldn't compile file: Source file or directory not found: /tmp/./src/main/kotlin/com/avently/app/YetAnotherClass.kt
*****
If I execute ./kobaltw assemble
one more time without any changes in code it will build the app as expected. This situation happens randomly so I can't say how to reproduce it.
I'm running this command from IDEA via external tool configuration:
Program:
Arguments: assemble
Working directory:
Search sources using module's classpath:
This looks a lot like the bug I filed for Kotlin 1.2.21 but I have never seen it with 1.2.10 (which is why Kobalt is back to 1.2.10 for now).
Let me know if you manage to reproduce it consistently (and if you do, I noticed that turning off incremental compilation fixes it, ./kobaltw -noIncrementalKotlin
).
Got a log with --log 3 option. Some interesting lines:
Calculating checksum of 13 files in ./src/main/kotlin
INC - Incremental task appname:compile input is out of date, running it (different input checksums old: f8e82588e9e046af22c0cf991ad2bc28 new: e121b50642109848b23e1db4916cec39)
....
Additional kotlinc arguments: -moduleName appname -friendPaths ./kobaltBuild/classes
Kotlin incremental compilation is enabled
ICReport: Last Kotlin Build info -- BuildInfo(startTS=1519569659294)
ICReport: No classpath changes
ICReport: Deleting /home/avently/appname/./kobaltBuild/classes/com/avently/appname/SomeClass.class on clearing cache for /home/avently/appname/src/main/kotlin/com/avently/appname/SomeClass.kt
....
then other files were deleted too
....
errors i already showed from my last post
....
ICReport: Possible cache corruption. Rebuilding
.... then all files were recompiled
So seems like compiled classes were deleted without reason and then compiler couldn't find it. Also this issue is related to #465. Maybe you can find broken part of code using provided zip file from that issue.
@cbeust every time I build the app in console I see annoying red colored warning:
***** WARNING Couldn't parse version 1.1.0.Final or 1.1.0.Final
Can this warning from external libs be disabled by default (and enabled via option or something)? This bad version string comes from http://mvnrepository.com/artifact/javax.validation/validation-api
Yes, I will disable this warning.
Fixed in 1.0.113.