22import groovy.json.JsonSlurper
33
44dependencies {
5- implementation(name :' widgets-release' , ext :' aar' )
6-
75 def cameraxVersion = project. hasProperty(" cameraxVersion" ) ? project. cameraxVersion : " 1.4.0-alpha03"
86 implementation " androidx.camera:camera-core:${ cameraxVersion} "
97 implementation " androidx.camera:camera-camera2:${ cameraxVersion} "
@@ -25,10 +23,34 @@ dependencies {
2523 def kotlinCoroutine = project. hasProperty(" kotlinCoroutine" ) ? project. kotlinCoroutine : " 1.6.4"
2624 implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutine "
2725 implementation " org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutine "
28-
26+
27+ if (project. hasProperty(" tempBuild" )) {
28+ // we need to copy the code in both places as N main gradle system does not support top level code
29+ // for now we support only @nativescript/core and @akylas/nativescript
30+ // we should have a more generic way
31+ def widgetsDir = " $USER_PROJECT_ROOT /node_modules/@nativescript/core/platforms/android"
32+ def appPackageJsonFile = file(" $USER_PROJECT_ROOT /package.json" )
33+ if (appPackageJsonFile. exists()) {
34+ def appPackageJson = new JsonSlurper (). parseText(appPackageJsonFile. text)
35+ if (appPackageJson. dependencies[' @akylas/nativescript' ] != null ) {
36+ widgetsDir = " $USER_PROJECT_ROOT /node_modules/@akylas/nativescript/platforms/android"
37+ }
38+ }
39+
40+ // if ui-mobile-base is provided as source the name is nativescript.aar
41+ // else use widget-release.aar
42+ if (file(" $widgetsDir /widgets-release.aar" ). exists()) {
43+ implementation(name :' widgets-release' , ext :' aar' )
44+ } else {
45+ implementation(name :' nativescript' , ext :' aar' )
46+ }
47+ }
2948}
3049
3150repositories {
51+ // we need to copy the code in both places as N main gradle system does not support top level code
52+ // for now we support only @nativescript/core and @akylas/nativescript
53+ // we should have a more generic way
3254 def widgetsDir = " $USER_PROJECT_ROOT /node_modules/@nativescript/core/platforms/android"
3355 def appPackageJsonFile = file(" $USER_PROJECT_ROOT /package.json" )
3456 if (appPackageJsonFile. exists()) {
@@ -40,4 +62,4 @@ repositories {
4062 flatDir {
4163 dirs " $widgetsDir "
4264 }
43- }
65+ }
0 commit comments