Skip to content

Commit 4aa0947

Browse files
authored
Merge pull request #723 from NativeScript/yosifov/skip-dangling-links
Use Java to search recursively for the *.aar files
2 parents 4384f66 + 7c17d07 commit 4aa0947

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

build-artifacts/project-template-gradle/build.gradle

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
*/
2020

2121
import groovy.json.JsonSlurper //used to parse package.json
22+
23+
import java.nio.file.Files;
24+
import java.nio.file.Paths;
25+
import java.util.regex.Pattern;
26+
2227
buildscript {
2328
repositories {
2429
jcenter()
@@ -477,9 +482,27 @@ task pluginExtend {
477482

478483
// we need to copy all dependencies into a flat dir, as pointed by the repositories configurations at the top
479484
task copyAarDependencies (type: Copy) {
480-
println "$configStage copyAarDependencies"
481-
from fileTree(dir: nodeModulesDir, include: ["**/*.aar"], exclude: '**/.bin/**').files
485+
def filterAarFilesFn = { path, attrs ->
486+
String pathString = path.toString();
487+
def isBin = Pattern.matches(".*/\\.bin/.*", pathString);
488+
def isAar = Pattern.matches(".*\\.aar\$", pathString);
489+
return !isBin && isAar;
490+
}
491+
492+
def mapToStringFn = { path ->
493+
return path.toString();
494+
}
495+
496+
Object[] files = Files.find(
497+
Paths.get("$nodeModulesDir"),
498+
Integer.MAX_VALUE,
499+
filterAarFilesFn
500+
)
501+
.map(mapToStringFn)
502+
.toArray();
503+
482504
into "$projectDir/libs/aar"
505+
from files
483506
}
484507

485508
task addAarDependencies {

0 commit comments

Comments
 (0)