(config: Config, cordovaPlugins: Plugin[])
| 323 | } |
| 324 | |
| 325 | async function copyPluginsNativeFiles(config: Config, cordovaPlugins: Plugin[]) { |
| 326 | const pluginsPath = join(config.android.cordovaPluginsDirAbs, 'src', 'main'); |
| 327 | for (const p of cordovaPlugins) { |
| 328 | const androidPlatform = getPluginPlatform(p, platform); |
| 329 | if (androidPlatform) { |
| 330 | const sourceFiles = androidPlatform['source-file']; |
| 331 | if (sourceFiles) { |
| 332 | for (const sourceFile of sourceFiles) { |
| 333 | const fileName = sourceFile.$.src.split('/').pop(); |
| 334 | let baseFolder = 'java/'; |
| 335 | if (fileName.split('.').pop() === 'aidl') { |
| 336 | baseFolder = 'aidl/'; |
| 337 | } |
| 338 | const target = sourceFile.$['target-dir'].replace('app/src/main/', '').replace('src/', baseFolder); |
| 339 | await copy(getFilePath(config, p, sourceFile.$.src), join(pluginsPath, target, fileName)); |
| 340 | } |
| 341 | } |
| 342 | const resourceFiles = androidPlatform['resource-file']; |
| 343 | if (resourceFiles) { |
| 344 | for (const resourceFile of resourceFiles) { |
| 345 | const target = resourceFile.$['target']; |
| 346 | if (resourceFile.$.src.split('.').pop() === 'aar') { |
| 347 | await copy(getFilePath(config, p, resourceFile.$.src), join(pluginsPath, 'libs', target.split('/').pop())); |
| 348 | } else if (target !== '.') { |
| 349 | await copy(getFilePath(config, p, resourceFile.$.src), join(pluginsPath, target)); |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | const libFiles = getPlatformElement(p, platform, 'lib-file'); |
| 354 | for (const libFile of libFiles) { |
| 355 | await copy(getFilePath(config, p, libFile.$.src), join(pluginsPath, 'libs', libFile.$.src.split('/').pop())); |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | async function removePluginsNativeFiles(config: Config) { |
| 362 | await remove(config.android.cordovaPluginsDirAbs); |
no test coverage detected