Open pswaminathan opened 2 years ago
I think this is not related to Kotlin rules at the moment.
Databinding requires few additional config to successfully compile, I have just created https://github.com/pswaminathan/bazel-kt-databinding-crash/pull/1 in which the app can be successfully built.
The only exception is supporting @BindingAdapter
s written in Kotlin as described here. We have implemented a solution that helps solve the problem by translating Kotlin to Java files during build but that is just a band-aid and does not address the root problem i.e Bazel's databinding annotation processor is coupled inside Bazel's android_tools hence can't be run on *.kt
files. Our motivation for building this to support same project structure as Gradle.
@restingbull Do you suppose we can track @BindingAdapter
Kotlin support can be tracked in a separate issue? From my understanding android.databinding.annotationprocessor.ProcessDataBinding
also requires couple of arguments and it is setup as part of native resourcing flow. Maybe once Starlark APIs for resource processing is available, it could be built as part of rules_koltin
and kt_android_library
.
That being said, @BindingAdapter
in Java works and this might be only an issue when folks migrate from Gradle project structure to Bazel.
Sample project found at https://github.com/pswaminathan/bazel-kt-databinding-crash
If you build this project as-is, you'll get a Bazel crash:
If you comment out the
enable_data_binding = True
lines, you no longer get a Bazel crash, but the project of course doesn't build.