Repository navigation
fix(android): apply a plugin's own buildscript.gradle in its aar build - #6216
edusperoni wants to merge 1 commit into
Conversation
The plugin-build template applied the buildscript.gradle of the plugin's
dependencies but never the plugin's own. Its $rootDir/buildscript.gradle step
was meant for that, but the CLI never copies the file into the temporary build
folder, so the step never ran. A plugin's Gradle classpath additions (Gradle
plugins, libraries its copied dependencies {} block uses) are now available in
its own aar build too.
This changes the build of every plugin that ships a buildscript.gradle: that
file now also runs in the plugin's own aar build.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
PR Checklist
gradle-api's plugin-build functional tests in feat(android): org.nativescript:gradle-api, Gradle facts file and opt-in plugin builds outside node_modules #6175.)What is the current behavior?
When the CLI builds a plugin's Android sources into an
.aar, it uses the template invendor/gradle-plugin/build.gradle. That template applies theplatforms/android/buildscript.gradleof each plugin the plugin depends on, but never the plugin's ownbuildscript.gradle.There is a step meant for that (
$rootDir/buildscript.gradle, added in #5555), but$rootDiris the temporary build folder and the CLI never copies the plugin'sbuildscript.gradleinto it, so the step has never run. As a result, anything a plugin puts on the build classpath (a Gradle plugin, a library its copieddependencies {}block uses) is missing from its own.aarbuild, while it works in the app build and in builds of plugins that depend on it.What is the new behavior?
The template applies the plugin's own
platforms/android/buildscript.gradlein its.aarbuild, next to its dependencies' files, and the dead$rootDir/buildscript.gradlestep is removed (if the CLI ever copied that file, the plugin's script would have been applied twice).This changes the build of every plugin that ships a
buildscript.gradle, so it belongs in the release notes: that file now also runs in the plugin's own.aarbuild, a separate Gradle project. I checked everybuildscript.gradleI could find (firebase core / messaging / crashlytics / performance, sentry, ui-webview, gesturehandler): they only add repositories and classpath entries, sentry also reads one optional property. firebase-core, firebase-performance and sentry build as their own.aarwith their realbuildscript.gradle, with unchanged Android Gradle plugin and Kotlin versions on the classpath.Split out of #6175, where
org.nativescript:gradle-apirelies on this to be usable inside a plugin's own.aarbuild.Summary by CodeRabbit