You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8cf2855
Browse filesBrowse the repository at this point in the historyBrowse files
fix(android): apply a plugin's own buildscript.gradle in its aar build
The plugin-build template only applied the buildscript.gradle files of the
plugin's dependencies; the $rootDir/buildscript.gradle step never ran because
the CLI never copies that file into the temp build folder. The plugin's own
buildscript.gradle is now applied there, and org.nativescript:gradle-api is
applied when that puts it on the classpath, so the dependencies {} and
repositories {} blocks copied from include.gradle can use it.
The plugin-build functional tests run against both this template and a frozen
copy of the 9.1 one, and compile against a class from core's aar. The README
gains a 'Supporting CLIs before 9.2' section.
The right-hand column only holds in a plugin's `.aar` build, and assumes a hoisted `node_modules`
131
+
at the project root.
132
+
106
133
## API
107
134
108
135
`apiLevel` is `1` for everything below. New methods raise it; nothing is ever removed or changed.
@@ -156,7 +183,7 @@ your app doesn't depend on directly.
156
183
## Recipes
157
184
158
185
**Compile against another plugin's Android library (e.g. core's widgets) in your own `.aar` build:**
159
-
the guarded block in [The one thing to know](#the-one-thing-to-know-your-plugins-own-aar-build).
186
+
the block in [Supporting CLIs before 9.2](#supporting-clis-before-92).
160
187
Use `compileOnly`, not `implementation`: an Android library can't bundle local `.aar` files, and the
161
188
app build already links every plugin.
162
189
@@ -180,11 +207,14 @@ repositories {
180
207
181
208
## Compatibility
182
209
183
-
|| CLI 9.1 and older | CLI 9.2+ | CLI 9.2+ with `pluginBuildLocation: "platforms"`|
184
-
|---|---|---|---|
185
-
| Plugin not using the library | Unchanged | Unchanged | Gradle reads its files from a copy in `platforms/android/.ns-plugins/`, and its own `buildscript.gradle` also runs in its own `.aar` build |
186
-
| Plugin using the library, app build | Fallback rules | Facts from the CLI | Facts from the CLI |
187
-
| Plugin using the library, its own `.aar` build | Library not loaded: the guarded fallback runs | Library not loaded: the guarded fallback runs | Library loaded |
210
+
|| CLI 9.1 and older | CLI 9.2+ |
211
+
|---|---|---|
212
+
| Plugin not using the library | Unchanged | Its own `buildscript.gradle` also runs in its own `.aar` build |
213
+
| Plugin using the library, app build | Fallback rules | Facts from the CLI |
214
+
| Plugin using the library, its own `.aar` build | Library not applied unless a plugin it depends on loaded it: the [fallback branch](#supporting-clis-before-92) runs | Library applied |
215
+
216
+
With [`pluginBuildLocation: "platforms"`](#for-app-developers-building-plugins-in-platformsandroid-opt-in)
217
+
(CLI 9.2+), Gradle also reads every plugin's files from a copy in `platforms/android/.ns-plugins/`.
188
218
189
219
The fallback rules are exactly what CLIs up to 9.1 do: plugins live in
190
220
`node_modules/<name>/platforms/android`, the project root is `USER_PROJECT_ROOT`, the app and
@@ -222,7 +252,8 @@ future major version of the CLI.
222
252
an older one. To use something newer only when it's available, check `apiLevel` (or `has(...)`)
223
253
first.
224
254
- Never build paths into `node_modules` or into the CLI's output folders; ask the library.
225
-
- In `dependencies {}` / `repositories {}`, use the guarded lookup shown above.
255
+
- In `dependencies {}` / `repositories {}`, look the extension up and keep a fallback while you
256
+
support CLIs before 9.2 ([how](#supporting-clis-before-92)).
0 commit comments