@@ -67,32 +67,43 @@ def computeBuildToolsVersion = { ->
6767}
6868
6969project. ext. selectedBuildType = project. hasProperty(" release" ) ? " release" : " debug"
70+ project. ext. appResourcesPath = " "
7071
7172// //////////////////////////////////////////////////////////////////////////////////
7273// /////////////////////////// CONFIGURATIONS ///////////////////////////////////////
7374// //////////////////////////////////////////////////////////////////////////////////
7475
75- def getAppResourcesDirectory = { ->
76- def defaultPathToAppResources = " $USER_PROJECT_ROOT /app/App_Resources"
77- def pathToAppResources
76+ def getAppResourcesPath = { ->
77+ def relativePathToApp = " app"
78+ def relativePathToAppResources
79+ def absolutePathToAppResources
7880 def nsConfigFile = file(" $USER_PROJECT_ROOT /nsconfig.json" )
81+ def nsConfig
7982
8083 if (nsConfigFile. exists()) {
81- def nsConfigJsonContent = new JsonSlurper (). parseText(nsConfigFile. getText(" UTF-8" ))
84+ nsConfig = new JsonSlurper (). parseText(nsConfigFile. getText(" UTF-8" ))
85+ }
8286
83- if (nsConfigJsonContent. appResourcesPath != null ) {
84- pathToAppResources = java.nio.file.Paths . get(USER_PROJECT_ROOT ). resolve(nsConfigJsonContent. appResourcesPath). toAbsolutePath()
85- } else if (nsConfigJsonContent. appPath != null ) {
86- pathToAppResources = java.nio.file.Paths . get(USER_PROJECT_ROOT ). resolve(nsConfigJsonContent. appPath). toAbsolutePath()
87- }
87+ if (nsConfig != null && nsConfig. appPath != null ){
88+ relativePathToApp = nsConfig. appPath
8889 }
8990
90- return pathToAppResources != null ? pathToAppResources : defaultPathToAppResources
91- }
91+ if (nsConfig != null && nsConfig. appResourcesPath != null ) {
92+ relativePathToAppResources = nsConfig. appResourcesPath
93+ } else {
94+ relativePathToAppResources = " $relativePathToApp /App_Resources"
95+ }
96+
97+ absolutePathToAppResources = java.nio.file.Paths . get(USER_PROJECT_ROOT ). resolve(relativePathToAppResources). toAbsolutePath()
98+
99+ project. ext. appResourcesPath = absolutePathToAppResources
100+
101+ return absolutePathToAppResources
102+ };
92103
93104def applyAppGradleConfiguration = { ->
94- def appResourcesDir = getAppResourcesDirectory ()
95- def pathToAppGradle = " $a ppResourcesDir /Android/app.gradle"
105+ def appResourcesPath = getAppResourcesPath ()
106+ def pathToAppGradle = " $a ppResourcesPath /Android/app.gradle"
96107 def appGradle = file(pathToAppGradle)
97108 if (appGradle. exists()) {
98109 println " \t + applying user-defined configuration from ${ appGradle} "
@@ -170,8 +181,8 @@ repositories {
170181 pluginDependencies. add(" libs/runtime-libs" )
171182 }
172183
173- def localAppResources = getAppResourcesDirectory ()
174- def localAppResourcesLibraries = " $l ocalAppResources /Android/libs"
184+ def appResourcesPath = getAppResourcesPath ()
185+ def localAppResourcesLibraries = " $a ppResourcesPath /Android/libs"
175186
176187 pluginDependencies. add(localAppResourcesLibraries)
177188
@@ -244,8 +255,8 @@ task addDependenciesFromNativeScriptPlugins {
244255}
245256
246257task addDependenciesFromAppResourcesLibraries {
247- def appResources = getAppResourcesDirectory ()
248- def appResourcesLibraries = file(" $a ppResources /Android/libs" )
258+ def appResourcesPath = getAppResourcesPath ()
259+ def appResourcesLibraries = file(" $a ppResourcesPath /Android/libs" )
249260 if (appResourcesLibraries. exists()) {
250261 def aarFiles = fileTree(dir : appResourcesLibraries, include : [" **/*.aar" ])
251262 aarFiles. each { aarFile ->
0 commit comments