After migrating to convention plugin the aboutLibraries.json is not complete.
sunragav opened this issue · 2 comments
About this issue
- After migrating to convention plugin, the aboutLibraries.json includes only the dependencies from json files in the config/libraries folder.
- My convention plugin looks like this:
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import com.mikepenz.aboutlibraries.plugin.AboutLibrariesExtension
import java.util.regex.Pattern
class AboutLibrariesConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.mikepenz.aboutlibraries.plugin")
val extension = extensions.getByType<AboutLibrariesExtension>()
extension.apply{
registerAndroidTasks = false
exclusionPatterns = listOf("com\\.salesforce\\..*").map { Pattern.compile(it) }
configPath = "config"
}
dependencies {
add("implementation", libs.findLibrary("mikepenz-fastadapter").get())
add("implementation", libs.findLibrary("mikepenz-fastadapter-ext-binding").get())
add("implementation", libs.findLibrary("mikepenz-fastadapter-ext-expandable").get())
add("implementation", libs.findLibrary("mikepenz-aboutlibraries-compose-m3").get())
}
}
}
}
Important parts of the convention build.gradle.kts that registers the plugin
register("aboutLibraries") {
id = "android.application.aboutLibraries"
implementationClass = "AboutLibrariesConventionPlugin"
}
In the app module gradle file:
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.android.application.aboutLibraries)
}
After this change none of android sdk framework level dependencies like androidx.* were missing. Only the ones from the json files defined in the config/libraries is listed in the generated aboutlibraries.json.
I use the following command to generate the aboutlibraries.json file.
./gradlew app:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/res/raw/ -PaboutLibraries.exportVariant=prodRelease
Before:
After:
Files in the config/libraries folder:
libraries.zip
Details
- Used library version - "11.2.2"
- Used support library version - NA
- Used gradle build tools version - "8.3.2"
- Used tooling / Android Studio version - Android Studio Ladybug | 2024.2.1 Patch 1
- Other used libraries, potential conflicting libraries - NA
Checklist
- Searched for similar issues
- Checked out the sample application
- Read the README
- Checked out the CHANGELOG
- Read the MIGRATION GUIDE
I found the problem. It is not due to the convention plugins. I had the following settings ON in the root project's gradle.properties
org.gradle.caching=true
org.gradle.configuration-cache=true
Only when I remove both these settings, did the output aboutLibraries.json include all the dependencies. Is it possible to have correct output with the cache ON?