@@ -67,32 +67,43 @@ def computeBuildToolsVersion = { ->
67
67
}
68
68
69
69
project. ext. selectedBuildType = project. hasProperty(" release" ) ? " release" : " debug"
70
+ project. ext. appResourcesPath = " "
70
71
71
72
// //////////////////////////////////////////////////////////////////////////////////
72
73
// /////////////////////////// CONFIGURATIONS ///////////////////////////////////////
73
74
// //////////////////////////////////////////////////////////////////////////////////
74
75
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
78
80
def nsConfigFile = file(" $USER_PROJECT_ROOT /nsconfig.json" )
81
+ def nsConfig
79
82
80
83
if (nsConfigFile. exists()) {
81
- def nsConfigJsonContent = new JsonSlurper (). parseText(nsConfigFile. getText(" UTF-8" ))
84
+ nsConfig = new JsonSlurper (). parseText(nsConfigFile. getText(" UTF-8" ))
85
+ }
82
86
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
88
89
}
89
90
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
+ };
92
103
93
104
def 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"
96
107
def appGradle = file(pathToAppGradle)
97
108
if (appGradle. exists()) {
98
109
println " \t + applying user-defined configuration from ${ appGradle} "
@@ -170,8 +181,8 @@ repositories {
170
181
pluginDependencies. add(" libs/runtime-libs" )
171
182
}
172
183
173
- def localAppResources = getAppResourcesDirectory ()
174
- def localAppResourcesLibraries = " $l ocalAppResources /Android/libs"
184
+ def appResourcesPath = getAppResourcesPath ()
185
+ def localAppResourcesLibraries = " $a ppResourcesPath /Android/libs"
175
186
176
187
pluginDependencies. add(localAppResourcesLibraries)
177
188
@@ -244,8 +255,8 @@ task addDependenciesFromNativeScriptPlugins {
244
255
}
245
256
246
257
task 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" )
249
260
if (appResourcesLibraries. exists()) {
250
261
def aarFiles = fileTree(dir : appResourcesLibraries, include : [" **/*.aar" ])
251
262
aarFiles. each { aarFile ->
0 commit comments