juanchosaravia / autodsl

Auto-generate Kotlin DSL
Apache License 2.0
338 stars 15 forks source link

Android Sample App: compilation fails with latest Kotlin and Gradle version #16

Open cee-dee opened 3 years ago

cee-dee commented 3 years ago

When updating the included sample app to the latest Kotlin and Gradle version, one gets compilation errors:

...\autodsl\samples\android-autodsl\app\build\tmp\kapt3\stubs\debug\com\autodsl\sample\AnimSequence.java:7: error: There was an error while processing your annotated classes. error = 
public final class AnimSequence implements com.autodsl.sample.Anim {
             ^...\autodsl\samples\android-autodsl\app\build\tmp\kapt3\stubs\debug\com\autodsl\sample\AnimTogether.java:7: error: There was an error while processing your annotated classes. error = 
public final class AnimTogether implements com.autodsl.sample.Anim {
             ^...\autodsl\samples\android-autodsl\app\build\tmp\kapt3\stubs\debug\com\autodsl\sample\TranslateX.java:7: error: There was an error while processing your annotated classes. error = 
public final class TranslateX extends com.autodsl.sample.TranslateAnim {
             ^

Changed files are

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip\
  zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

build.gradle

buildscript {
    ext.kotlin_version = '1.4.10'
    ext.autodsl_version = '0.0.11'
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        ...
    }
}

Is this already known? Is there a fix or workaround?

juanchosaravia commented 3 years ago

Thanks for filling an issue! I'll take a look

ckmcd commented 3 years ago

Eeeks. I am seeing the same. Any updates? I am using maven and not gradle if that helps eliminate that. I am also using Kotlin 1.4.10 but with autodsl 0.0.10.

juanchosaravia commented 3 years ago

I found the issue. The problem is with the library that I use to parse Kotlin Metadata: me.eugeniomarletti.kotlin.metadata:kotlin-metadata:1.4.0

It doesn't support the new metadata format in Kotlin 1.4.x and there is no new available release version. Probably because a new kotlinx-metadata parsing lib is being developed by JetBrains: https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-metadata-jvm/0.2.0/jar

So the workaround would be go to back to Kotlin 1.3.72 and you can use the latest gradle version.

I'm going to work in a proper solution for this. I'll have to review the new jetbrain kotlinx-metadata lib to see if I can do the same for 1.4.x Kotlin version or update eugeniomarletti lib.

juanchosaravia commented 3 years ago

Reviewing kotlinx-metadata-jvm version 0.2.0, it's far from bringing all the required data to replace eugenio's lib. And in Eugenio's github repo there is already an issue reported about this: https://github.com/Takhion/kotlin-metadata/issues/15