Open OldWartHog opened 6 years ago
Thanks for providing the demo project, I'll take a look.
@cbeust I think this issue related to issue I wrote you about some weeks ago.
You asked me how to reproduce it. Seems like I found what cause it. Every time I change a file which is importing Kotlin extensions the build fails. If I change a file which is not importing any extensions from SEPARATE file but use extensions from the same file build will be fine. It reproducable with your file from Kobalt as well. For example, I added a space character in file /kobal/app/BuildFiles.kt and tried to build the project. Build failed. So you can try it out and see what happens.
I've just encountered this issue with the sample project:
$ kobaltw --init kotlin
$ ./kobaltw test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/samuel/.kobalt/wrapper/dist/kobalt-1.0.115/kobalt/wrapper/kobalt-1.0.115.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
__ __ __ __ __
/ //_/ ____ / /_ ____ _ / / / /_
/ ,< / __ \ / __ \ / __ `/ / / / __/
/ /| | / /_/ / / /_/ // /_/ / / / / /_
/_/ |_| \____/ /_.___/ \__,_/ /_/ \__/ 1.0.115
Regular compilation time: 2250 ms
Parallel build starting
╔══════════════════╗
║ Building kobalt4 ║
╚══════════════════╝
───── kobalt4:compile
Kotlin 1.2.70 compiling 1 file
Kotlin incremental compilation is enabled
*****
***** ERROR Couldn't compile file: Source file or directory not found: /tmp/./src/main/kotlin/com/example/Main.kt
*****
*****
***** ERROR Couldn't compile file: Source file or directory not found: /tmp/./src/main/kotlin/com/example/Main.kt
*****
*****
***** ERROR Error: com.beust.kobalt.KobaltException: Couldn't compile file: Source file or directory not found: /tmp/./src/main/kotlin/com/example/Main.kt
*****
Thread report
╔════════════════════════════════════════╗
║ Time (sec) ║ Thread 16 ║
╠════════════════════════════════════════╣
║ 0 ║ kobalt4 ║
╚════════════════════════════════════════╝
PARALLEL BUILD SUCCESSFUL (0 SECONDS), sequential build would have taken 0 seconds
resolved with the addition of the noIncrementalKotlin flag:
./kobaltw --noIncrementalKotlin test
Have issues compiling multiple mixed Java/Kotlin project on MacOs (10.12.6). When attempting to compile the first kotlin file I see this error:
***** ERROR Error: com.beust.kobalt.KobaltException: Couldn't compile file: Source file or directory not found: /var/folders/6r/t_py7pf93ldc2q2w5rhrqd7w0000gn/T/./specification/src/main/kotlin/uk/co/strand/peabrain/specification/Flavour.kt
Running with --log 3 also shows this message: ICReport: Possible cache corruption. Rebuilding. com.beust.kobalt.KobaltException: Couldn't compile file: import uk.co.strand.peabrain.serverbase.WorkRequest /Users/martingittins/Technical/Projects/Private/estimatorproject/webby/serverBase/src/main/kotlin/uk/co/strand/peabrain/serverbase/gen/engine/ComputeService.kt:6:41 Unresolved reference: WorkRequest
Note that it's ComputeService.kt that is referenced here, from the second project, not Flavour.kt which is in the first project.
It looks like the source cache handling is being corrupted by other projects.
The error reported is not consistent - it seems to alternate between being in the first and second project.
It never complains about any java files, and the project builds ok with gradle and in Idea, both with default settings for incremental compilation.
I made a local Kobalt and stopped it in the debugger at the point it's calling makeIncrementally in KotlinCompiler and all the inputs looked to be as expected. In particular the sourceRoots where correct, and the cachesDir existed.
Here is a small project that demonstrates the problem. The critical requirement appears to be to have at least two projects (maybe with both Java and Kotlin and maybe be on Mac). This project is incomplete rubbish - the important point is that the cache fails to find one or more files. Just expand this and try "./kobaltw compile" demo.zip