How can my Gradle plugin access the source sets of AGP 7.0.0?

Viewed 184

I have written a Gradle plugin for collecting the source directories of the Java code in a project managed by Android Gradle Plugin.
My plugin works properly with AGP 4.2.2.

AGP 7.0.0 deprecates com.android.build.gradle.api.LibraryVariant and replaces it by com.android.build.api.variant.LibraryVariant, so that I have to replace also com.android.build.gradle.LibraryExtension by com.android.build.api.variant.LibraryAndroidComponentsExtension and the loop on the variants.

The problem is that the new class com.android.build.api.variant.LibraryVariant does not implement the method getSourceSets and I can not find a replacement.

You can see sample code at https://gist.github.com/dscoppelletti/350976a5d4b15be5ddc76d515df3c8c2

Any help is appreciated.

0 Answers
Related