lingua-franca icon indicating copy to clipboard operation
lingua-franca copied to clipboard

possible build error when Kotlin is installed locally

Open housengw opened this issue 2 years ago • 7 comments

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

housengw avatar Mar 04 '22 22:03 housengw

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 image : image

However, it did not produce LF jar file: image

rcakella avatar Mar 05 '22 02:03 rcakella

After downgrading Gradle from v7.4 that also packages with downgraded Kotlin, I was able to compile latest master successfully. image

I just happened to try and the result holds true for JDKs 11,13, 17.

rcakella avatar Mar 05 '22 03:03 rcakella

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.

cmnrd avatar Mar 07 '22 13:03 cmnrd

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...

lhstrh avatar Mar 07 '22 19:03 lhstrh

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.

rcakella avatar Mar 08 '22 17:03 rcakella

Even when I use gradlew, as long as I had Kotlin 1.5, I kept getting the errors. This reaffirms @lhstrh statements above. image

rcakella avatar Mar 08 '22 17:03 rcakella

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.

cmnrd avatar Mar 09 '22 09:03 cmnrd

I'm closing this issue because of inactivity, but @rcakella please reopen if this needs attention.

lhstrh avatar Mar 04 '23 01:03 lhstrh