()
| 1317 | console.log('Does not exist [1]', extraNativeDebugSymbolsPath); |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | if (settings.modify_debug_symbols !== true && !allowExtraDebugSymbols) { |
| 1322 | console.log('Using original native-debug-symbols.zip'); |
| 1323 | return filePath; |
| 1324 | } |
| 1325 | |
| 1326 | const abiFilter = [ |
| 1327 | 'armeabi-v7a', |
| 1328 | 'arm64-v8a', |
| 1329 | 'x86', |
| 1330 | 'x86_64' |
| 1331 | ].filter((abi) => { |
| 1332 | switch (abiVariant) { |
| 1333 | case 'universal': return true; |
| 1334 | case 'arm64': return abi === 'arm64-v8a'; |
| 1335 | case 'arm32': return abi === 'armeabi-v7a'; |
| 1336 | case 'x86': return abi === 'x86'; |
| 1337 | case 'x64': return abi === 'x86_64'; |
| 1338 | default: { |
| 1339 | console.error('Unknown abi variant:', abiVariant); |
| 1340 | return true; |
| 1341 | } |
| 1342 | } |
| 1343 | }); |
| 1344 | |
| 1345 | const existingArchivePath = path.parse(filePath); |
| 1346 | const modifiedArchivePath = path.join(existingArchivePath.dir, existingArchivePath.name + '-modified' + existingArchivePath.ext); |
| 1347 | const existingZip = new AdmZip(filePath); |
| 1348 | |
| 1349 | // Filter rudimentary abi |
| 1350 | let removedCount = 0; |
| 1351 | existingZip.getEntries() |
| 1352 | .filter(e => !abiFilter.includes(e.entryName.split('/')[0])) |
| 1353 | .forEach(e => { |
| 1354 | existingZip.deleteFile(e); |
| 1355 | removedCount++; |
| 1356 | }); |
| 1357 | |
| 1358 | // Copy extra *.so.dbg files to native-debug-symbols-modified.zip |
| 1359 | let addedCount = 0; |
| 1360 | if (allowExtraDebugSymbols) { |
| 1361 | abiFilter.forEach((abi) => { |
| 1362 | const extraPath = path.join(extraNativeDebugSymbolsPath, abi); |
| 1363 | if (fs.existsSync(extraPath) && fs.statSync(extraPath).isDirectory()) { |
| 1364 | fs.readdirSync(extraPath).forEach((name) => { |
| 1365 | const entryName = `${abi}/${name}`; |
| 1366 | if (!existingZip.getEntry(entryName)) { |
| 1367 | const extraSymbolsFile = path.join(extraPath, name); |
| 1368 | existingZip.addLocalFile(extraSymbolsFile, abi); |
| 1369 | addedCount++; |
| 1370 | } |
| 1371 | }); |
| 1372 | } |
| 1373 | }); |
no test coverage detected