lingua-franca
lingua-franca copied to clipboard
possible build error when Kotlin is installed locally
During the Denso meeting, Ravi mentioned an error he encountered during build-lfc
where the task compileKotlin
failed.
The root cause seems to be that the version of kotlin (kotlin -v
) installed locally on his laptop is different from the one used in the build (specified in gradle.properties
).
The problem might be reproduced by installing kotlin locally and running build-lfc
After removing Kotlin from system, I still had the same issue with build-lfc
as well as with Gradle assemble
.
Rebuilding with mvn compile
resulted in build success
:
However, it did not produce LF jar file:
After downgrading Gradle from v7.4 that also packages with downgraded Kotlin, I was able to compile latest master successfully.
I just happened to try and the result holds true for JDKs 11,13, 17.
This is strange. Just out of curiosity: what happens if you now update to gradle 7.4 again? And have you tried to clean first (.\gradlew clean
or ./bin/build-lfc -c
)?
Note that Maven only builds the Epoch IDE, while Gradle only builds lfc. This is why the jar is not produced when running mvn
.
I believe Gradle is finicky about which version of Kotlin it can work with.
When you use ./gradlew
(the Gradle Wrapper that is checked into the repository), you're sure that you're using the version of Gradle that is tried and true (the build-lfc
script also does this). If you just use gradle
, however, there is no guarantee that it will work.
It's surprising to me that system installations of other versions of Kotlin affect the build process. Our build configuration is supposed to be self-contained and Gradle is supposed to pull in all the necessary dependencies as specified...
The same error occurred with re-upgrade to 7.4 and clean rebuild options. Thanks for clarifying regarding mvn build which explains why jar file error occurred. Better to include that in the documentation.
Even when I use gradlew, as long as I had Kotlin 1.5, I kept getting the errors. This reaffirms @lhstrh statements above.
I actually get the exact same output (including Kotlin 1.5.31). I am not sure why that is, as the kotlin Version is configured to 1.4.30
. However, it looks like we are doing something wrong in our build configuration. The kotlin documentation explicitly states that the kotlin plugin should be applied like this
plugins {
id "org.jetbrains.kotlin.jvm" version "1.6.10"
}
and not using apply plugin: 'kotlin'
. But when I change this, gradle gives me all kinds of seemingly unrelated errors.
I'm closing this issue because of inactivity, but @rcakella please reopen if this needs attention.