chrmelchior

    chrmelchior

    2 years ago
    I’m attempting to convert the Arrow Meta hello-world example to work in a Multiplatform project, but the
    compileKotlin
    closure is not present in KMP projects. Does anyone know how to configure it? I suspect I’m missing something trivial, but cannot seem to find any documentation for compiler arguments for KMP projects.
    It was just me being stupid. This worked:
    kotlin {
        targets.all {
            compilations.all {
                kotlinOptions {
                    freeCompilerArgs = ["-Xplugin=${project.rootDir}/create-plugin/build/libs/create-plugin-all.jar"]
                }
            }
        }
        sourceSets {
            all {
                dependencies {
                    api project(path: ':create-plugin', configuration: 'shadow')
                }
            }
            //...
        }
        //...
    }
    Rachel

    Rachel

    2 years ago
    Thanks for the info @chrmelchior!! No stupid, just it was necessary to "play" more and now we know something more, thanks!!!
    Please, don't hesitate to contribute with more examples in that repository, thanks!!
    chrmelchior

    chrmelchior

    2 years ago
    I can make a PR with this once I get it running. It seems the compiler plugin is now running but replacing the method fails with
    Unresolved reference: synthetic
    for some unknown reason and I’m currently trying to figure out how to debug what is happening
    Rachel

    Rachel

    2 years ago
    Great! In case you don't find the reason, you can create a draft pull request and we'll check it 👍
    Thanks @chrmelchior!!
    chrmelchior

    chrmelchior

    2 years ago
    Will do. Is there any way to get insights into exactly what is transformed by the compiler? I would assume I could find the transformed file under
    build/classes/kotlin/jvm
    somewhere, but so far I’m coming up short?
    Rachel

    Rachel

    2 years ago
    The transformations take place during compilation. However, you can see a meta debug file which appears together
    HelloWorld.kt
    . On the other hand,
    synthetic
    comes from
    io.arrow-kt:arrow-annotations
    dependency. I hope it's useful for you 👍
    chrmelchior

    chrmelchior

    2 years ago
    Thanks 🙇 I was missing the arrow-annotations dependency in the KMP project. It compiles now 🎉
    Rachel

    Rachel

    2 years ago
    Thanks to you!!