@@ -67,37 +67,43 @@ def computeBuildToolsVersion = { ->
67
67
}
68
68
69
69
project. ext. selectedBuildType = project. hasProperty(" release" ) ? " release" : " debug"
70
- project. ext. appPath = " "
71
70
project. ext. appResourcesPath = " "
72
71
73
72
// //////////////////////////////////////////////////////////////////////////////////
74
73
// /////////////////////////// CONFIGURATIONS ///////////////////////////////////////
75
74
// //////////////////////////////////////////////////////////////////////////////////
76
75
77
- def getAppResourcesDirectory = { ->
78
- def defaultPathToAppResources = " $USER_PROJECT_ROOT /app/App_Resources"
79
- def pathToAppResources
76
+ def getAppResourcesPath = { ->
77
+ def relativePathToApp = " app"
78
+ def relativePathToAppResources
79
+ def absolutePathToAppResources
80
80
def nsConfigFile = file(" $USER_PROJECT_ROOT /nsconfig.json" )
81
+ def nsConfig
81
82
82
83
if (nsConfigFile. exists()) {
83
- def nsConfigJsonContent = new JsonSlurper (). parseText(nsConfigFile. getText(" UTF-8" ))
84
+ nsConfig = new JsonSlurper (). parseText(nsConfigFile. getText(" UTF-8" ))
85
+ }
84
86
85
- if (nsConfigJsonContent. appResourcesPath != null ) {
86
- pathToAppResources = java.nio.file.Paths . get(USER_PROJECT_ROOT ). resolve(nsConfigJsonContent. appResourcesPath). toAbsolutePath()
87
- } else if (nsConfigJsonContent. appPath != null ) {
88
- project. ext. appPath = nsConfigJsonContent. appPath
89
- pathToAppResources = java.nio.file.Paths . get(USER_PROJECT_ROOT ). resolve(nsConfigJsonContent. appPath). toAbsolutePath()
90
- }
87
+ if (nsConfig != null && nsConfig. appPath != null ){
88
+ relativePathToApp = nsConfig. appPath
91
89
}
92
90
93
- def result = pathToAppResources != null ? pathToAppResources : defaultPathToAppResources
94
- project. ext. appResourcesPath = result
95
- return result
96
- }
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
+ };
97
103
98
104
def applyAppGradleConfiguration = { ->
99
- def appResourcesDir = getAppResourcesDirectory ()
100
- def pathToAppGradle = " $a ppResourcesDir /Android/app.gradle"
105
+ def appResourcesPath = getAppResourcesPath ()
106
+ def pathToAppGradle = " $a ppResourcesPath /Android/app.gradle"
101
107
def appGradle = file(pathToAppGradle)
102
108
if (appGradle. exists()) {
103
109
println " \t + applying user-defined configuration from ${ appGradle} "
@@ -175,8 +181,8 @@ repositories {
175
181
pluginDependencies. add(" libs/runtime-libs" )
176
182
}
177
183
178
- def localAppResources = getAppResourcesDirectory ()
179
- def localAppResourcesLibraries = " $l ocalAppResources /Android/libs"
184
+ def appResourcesPath = getAppResourcesPath ()
185
+ def localAppResourcesLibraries = " $a ppResourcesPath /Android/libs"
180
186
181
187
pluginDependencies. add(localAppResourcesLibraries)
182
188
@@ -249,8 +255,8 @@ task addDependenciesFromNativeScriptPlugins {
249
255
}
250
256
251
257
task addDependenciesFromAppResourcesLibraries {
252
- def appResources = getAppResourcesDirectory ()
253
- def appResourcesLibraries = file(" $a ppResources /Android/libs" )
258
+ def appResourcesPath = getAppResourcesPath ()
259
+ def appResourcesLibraries = file(" $a ppResourcesPath /Android/libs" )
254
260
if (appResourcesLibraries. exists()) {
255
261
def aarFiles = fileTree(dir : appResourcesLibraries, include : [" **/*.aar" ])
256
262
aarFiles. each { aarFile ->
0 commit comments