From ab6b5afcef353019b550cef7920324aa1235c84d Mon Sep 17 00:00:00 2001 From: plamen5kov Date: Tue, 14 Feb 2017 14:26:48 +0200 Subject: [PATCH] gradle will respect productionDependencies.json file this file will contain all the production dependencies that are provided by cli if no such file is provided, we'll fallback to the previous behavior of traversing all of the node_modules and searching for all aar files --- .../project-template-gradle/build.gradle | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build-artifacts/project-template-gradle/build.gradle b/build-artifacts/project-template-gradle/build.gradle index cc2e43209..1337735a2 100644 --- a/build-artifacts/project-template-gradle/build.gradle +++ b/build-artifacts/project-template-gradle/build.gradle @@ -478,7 +478,22 @@ task pluginExtend { // we need to copy all dependencies into a flat dir, as pointed by the repositories configurations at the top task copyAarDependencies (type: Copy) { println "$configStage copyAarDependencies" - from fileTree(dir: nodeModulesDir, include: ["**/*.aar"], exclude: '**/.bin/**').files + + def productionDependencies = new File("$projectDir/productionDependencies.json") + def transformedArr = []; + if(productionDependencies.exists()) { + String content = productionDependencies.getText("UTF-8") + def jsonSlurper = new JsonSlurper() + def packageJsonMap = jsonSlurper.parseText(content) + + packageJsonMap.each { k -> + transformedArr.push(k + "/**/*.aar") + } + } else { + transformedArr.push("**/*.aar"); + } + + from fileTree(dir: nodeModulesDir, include: transformedArr, exclude: '**/.bin/**').files into "$projectDir/libs/aar" }