Add a way to dependent android and iOS library from node modules

This commit is contained in:
pengfei.zhou
2021-08-17 18:38:24 +08:00
committed by osborn
parent 904d1d99cf
commit 67915e6db0
5 changed files with 40 additions and 2 deletions

View File

@@ -47,4 +47,19 @@ afterEvaluate {
task buildJSBundle(type: Exec) {
workingDir project.rootDir.getParent()
commandLine 'npm', 'run', 'build'
}
def nodeModuleDir = new File(rootDir.getParent() + File.separator + "node_modules")
if (nodeModuleDir.isDirectory()) {
nodeModuleDir.listFiles().each {
if (new File(it.getAbsolutePath() + File.separator + "__doric_library__").exists()) {
println("Find doric plugin library ${it.name} in ${it}")
def name = it.name
android {
dependencies {
implementation project(":${name}")
}
}
}
}
}

View File

@@ -1,2 +1,13 @@
include ':app'
rootProject.name='__$__'
def nodeModuleDir = new File(rootDir.getParent() + File.separator + "node_modules")
if (nodeModuleDir.isDirectory()) {
nodeModuleDir.listFiles().each {
if (new File(it.getAbsolutePath() + File.separator + "__doric_library__").exists()) {
println("Find doric plugin library ${it.name} in ${it}")
include ":${it.name}"
project(":${it.name}").projectDir = file(it.getAbsolutePath() + File.separator + "android")
}
}
}