|
1 | 1 | import groovy.json.JsonSlurper |
2 | 2 |
|
3 | | -// for now we support only @nativescript/core and @akylas/nativescript |
4 | | -// we should have a more generic way |
5 | | -def widgetsDir = "$USER_PROJECT_ROOT/node_modules/@nativescript/core/platforms/android" |
6 | | -def appPackageJsonFile = file("$USER_PROJECT_ROOT/package.json") |
7 | | -if (appPackageJsonFile.exists()) { |
8 | | - def appPackageJson = new JsonSlurper().parseText(appPackageJsonFile.text) |
9 | | - if (appPackageJson.dependencies['@akylas/nativescript'] != null) { |
10 | | - widgetsDir = "$USER_PROJECT_ROOT/node_modules/@akylas/nativescript/platforms/android" |
11 | | - } |
12 | | -} |
13 | | - |
14 | 3 | dependencies { |
15 | 4 | implementation "androidx.annotation:annotation:1.1.0" |
16 | 5 |
|
17 | 6 | if (project.hasProperty("tempBuild")) { |
| 7 | + // we need to copy the code in both places as N main gradle system does not support top level code |
| 8 | + // for now we support only @nativescript/core and @akylas/nativescript |
| 9 | + // we should have a more generic way |
| 10 | + def widgetsDir = "$USER_PROJECT_ROOT/node_modules/@nativescript/core/platforms/android" |
| 11 | + def appPackageJsonFile = file("$USER_PROJECT_ROOT/package.json") |
| 12 | + if (appPackageJsonFile.exists()) { |
| 13 | + def appPackageJson = new JsonSlurper().parseText(appPackageJsonFile.text) |
| 14 | + if (appPackageJson.dependencies['@akylas/nativescript'] != null) { |
| 15 | + widgetsDir = "$USER_PROJECT_ROOT/node_modules/@akylas/nativescript/platforms/android" |
| 16 | + } |
| 17 | + } |
| 18 | + |
18 | 19 | // if ui-mobile-base is provided as source the name is nativescript.aar |
19 | | - if (file("$widgetsDir/nativescript.aar").exists()) { |
| 20 | + //else use widget-release.aar |
| 21 | + if (file("$widgetsDir/widgets-release.aar").exists()) { |
| 22 | + implementation(name:'widgets-release', ext:'aar') |
| 23 | + } else { |
20 | 24 | implementation(name:'nativescript', ext:'aar') |
21 | 25 | } |
22 | | - // if ui-mobile-base is provided as aar the name is widget-release.aar |
23 | | - if (file("$widgetsDir/widget-release.aar").exists()) { |
24 | | - implementation(name:'widget-release', ext:'aar') |
25 | | - } |
26 | 26 | } |
27 | 27 | } |
28 | 28 | repositories { |
| 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 |
| 32 | + def widgetsDir = "$USER_PROJECT_ROOT/node_modules/@nativescript/core/platforms/android" |
| 33 | + def appPackageJsonFile = file("$USER_PROJECT_ROOT/package.json") |
| 34 | + if (appPackageJsonFile.exists()) { |
| 35 | + def appPackageJson = new JsonSlurper().parseText(appPackageJsonFile.text) |
| 36 | + if (appPackageJson.dependencies['@akylas/nativescript'] != null) { |
| 37 | + widgetsDir = "$USER_PROJECT_ROOT/node_modules/@akylas/nativescript/platforms/android" |
| 38 | + } |
| 39 | + } |
29 | 40 | flatDir { |
30 | 41 | dirs "$widgetsDir" |
31 | 42 | } |
|
0 commit comments