11import groovy.json.JsonSlurper
22dependencies {
3+ implementation " androidx.annotation:annotation:1.1.0"
4+
35 if (project. hasProperty(" tempBuild" )) {
4- implementation(name :' widgets-release' , ext :' aar' )
6+ // we need to copy the code in both places as N main gradle system does not support top level code
7+ // for now we support only @nativescript/core and @akylas/nativescript
8+ // we should have a more generic way
9+ def widgetsDir = " $USER_PROJECT_ROOT /node_modules/@nativescript/core/platforms/android"
10+ def appPackageJsonFile = file(" $USER_PROJECT_ROOT /package.json" )
11+ if (appPackageJsonFile. exists()) {
12+ def appPackageJson = new JsonSlurper (). parseText(appPackageJsonFile. text)
13+ if (appPackageJson. dependencies[' @akylas/nativescript' ] != null ) {
14+ widgetsDir = " $USER_PROJECT_ROOT /node_modules/@akylas/nativescript/platforms/android"
15+ }
16+ }
17+
18+ // if ui-mobile-base is provided as source the name is nativescript.aar
19+ // else use widget-release.aar
20+ if (file(" $widgetsDir /widgets-release.aar" ). exists()) {
21+ implementation(name :' widgets-release' , ext :' aar' )
22+ } else {
23+ implementation(name :' nativescript' , ext :' aar' )
24+ }
525 }
6- implementation " androidx.annotation:annotation:1.1.0"
726}
827repositories {
928 if (project. hasProperty(" tempBuild" )) {
29+ // we need to copy the code in both places as N main gradle system does not support top level code
30+ // for now we support only @nativescript/core and @akylas/nativescript
31+ // we should have a more generic way
1032 def widgetsDir = " $USER_PROJECT_ROOT /node_modules/@nativescript/core/platforms/android"
1133 def appPackageJsonFile = file(" $USER_PROJECT_ROOT /package.json" )
1234 if (appPackageJsonFile. exists()) {
@@ -19,4 +41,4 @@ repositories {
1941 dirs " $widgetsDir "
2042 }
2143 }
22- }
44+ }
0 commit comments