@@ -91,7 +91,7 @@ class VersionComparator implements Comparator<String> {
91
91
92
92
class axistools {
93
93
94
- static String [] findNativeBuildTools (project , ndkVer = " 23.2.8568313" , cmakeVer = " 3.22.1+" ) {
94
+ static String [] findNativeBuildTools (project , ndkVer = " 23.2.8568313+ " , cmakeVer = " 3.22.1+" ) {
95
95
96
96
// Detecting sdkRoot
97
97
def sdkRoot = null
@@ -131,14 +131,25 @@ class axistools {
131
131
ndkVer = ndkVer. substring(0 , ndkVer. length() - 1 )
132
132
}
133
133
134
- def ndkDirs = []
135
- File dir = new File (" ${ sdkRoot} / ndk" )
134
+ def verList = []
135
+ File dir = new File (" ${ sdkRoot}${ File.separator } ndk" )
136
136
if (dir. isDirectory()) {
137
137
for (ndkDir in dir. listFiles()) {
138
- ndkDirs . add(ndkDir. toString ())
138
+ verList . add(ndkDir. getName ())
139
139
}
140
140
}
141
141
142
+ verList. sort {a ,b ->
143
+ return axistools. compareVersion(b, a)
144
+ }
145
+
146
+ def ndkDirs = []
147
+
148
+ // Collect ndkDirs for search
149
+ for (ver in verList){
150
+ ndkDirs. add(" ${ sdkRoot}${ File.separator} ndk${ File.separator}${ ver} " )
151
+ }
152
+
142
153
/* Find suitable ndk in dirs */
143
154
rets[0 ] = ndkVer
144
155
@@ -173,7 +184,7 @@ class axistools {
173
184
def verList = []
174
185
175
186
// Scan installed cmake in $sdk_root/cmake
176
- File sdkCMakeDir = new File (sdkRoot + ' / cmake' )
187
+ File sdkCMakeDir = new File (" ${ sdkRoot}${ File.separator } cmake" )
177
188
if (sdkCMakeDir. isDirectory()) {
178
189
for (cmakeDir in sdkCMakeDir. listFiles()) {
179
190
verList. add(cmakeDir. getName())
@@ -186,8 +197,8 @@ class axistools {
186
197
}
187
198
188
199
// Collect cmakeBinDirs for search
189
- for (foundVer in verList){
190
- cmakeBinDir = sdkRoot + File . separator + " cmake" + File . separator + foundVer + File . separator + " bin"
200
+ for (ver in verList){
201
+ cmakeBinDir = sdkRoot + File . separator + " cmake" + File . separator + ver + File . separator + " bin"
191
202
if (new File (cmakeBinDir). isDirectory()) {
192
203
cmakeBinDirs. add(cmakeBinDir)
193
204
}
@@ -222,7 +233,7 @@ class axistools {
222
233
private static String findNDKInDir (ndkVer , allowNewerNdk , ndkDir , rets ) {
223
234
def found = null
224
235
def properties = new Properties ()
225
- File propertiesFile = new File (" $ndkDir / source.properties" )
236
+ File propertiesFile = new File (" $ndkDir ${ File.separator } source.properties" )
226
237
propertiesFile. withInputStream {
227
238
properties. load(it)
228
239
def foundNdkVer = properties[' Pkg.Revision' ]
0 commit comments